8000 `select.poll()` objects are not thread-safe in the free-threaded build · Issue #121592 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

select.poll() objects are not thread-safe in the free-threaded build #121592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
colesbury opened this issue Jul 10, 2024 · 0 comments
Closed

select.poll() objects are not thread-safe in the free-threaded build #121592

colesbury opened this issue Jul 10, 2024 · 0 comments
Labels
3.13 bugs and security fixes 3.14 bugs and security fixes topic-free-threading type-bug An unexpected behavior, bug, or error

Comments

@colesbury
Copy link
Contributor
colesbury commented Jul 10, 2024

Bug report

The polling objects returned by select.poll and related functions are not thread-safe in the free-threaded build.

The fix might be as simple as adding critical sections to the functions on pollObject or it may require more work.

The following test exercises the thread-unsafe behavior:

  • ./python -m test test_poll -m test_threaded_poll

Relevant object:

typedef struct {
PyObject_HEAD
PyObject *dict;
int ufd_uptodate;
int ufd_len;
struct pollfd *ufds;
int poll_running;
} pollObject;

Linked PRs

@colesbury colesbury added type-bug An unexpected behavior, bug, or error 3.13 bugs and security fixes topic-free-threading 3.14 bugs and security fixes labels Jul 10, 2024
colesbury added a commit to colesbury/cpython that referenced this issue Jul 10, 2024
This makes select.poll() and kqueue() objects thread-safe in the
free-threaded build. Note that calling close() concurrently with other
functions is still not thread-safe due to races on file descriptors
(pythongh-121544).
colesbury added a commit to colesbury/cpython that referenced this issue Jul 10, 2024
This makes select.poll() and kqueue() objects thread-safe in the
free-threaded build. Note that calling close() concurrently with other
functions is still not thread-safe due to races on file descriptors
(pythongh-121544).
colesbury added a commit that referenced this issue Jul 11, 2024
This makes select.poll() and kqueue() objects thread-safe in the
free-threaded build. Note that calling close() concurrently with other
functions is still not thread-safe due to races on file descriptors
(gh-121544).
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 11, 2024
…ythonGH-121594)

This makes select.poll() and kqueue() objects thread-safe in the
free-threaded build. Note that calling close() concurrently with other
functions is still not thread-safe due to races on file descriptors
(pythongh-121544).
(cherry picked from commit 44937d1)

Co-authored-by: Sam Gross <colesbury@gmail.com>
colesbury added a commit that referenced this issue Jul 11, 2024
…H-121594) (#121623)

This makes select.poll() and kqueue() objects thread-safe in the
free-threaded build. Note that calling close() concurrently with other
functions is still not thread-safe due to races on file descriptors
(gh-121544).
(cherry picked from commit 44937d1)

Co-authored-by: Sam Gross <colesbury@gmail.com>
noahbkim pushed a commit to hudson-trading/cpython that referenced this issue Jul 11, 2024
…ython#121594)

This makes select.poll() and kqueue() objects thread-safe in the
free-threaded build. Note that calling close() concurrently with other
functions is still not thread-safe due to races on file descriptors
(pythongh-121544).
estyxx pushed a commit to estyxx/cpython that referenced this issue Jul 17, 2024
…ython#121594)

This makes select.poll() and kqueue() objects thread-safe in the
free-threaded build. Note that calling close() concurrently with other
functions is still not thread-safe due to races on file descriptors
(pythongh-121544).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes 3.14 bugs and security fixes topic-free-threading type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant
0