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
pthread_kill() doesn't work on the main thread on FreeBSD6 #56601
Comments
pthread_kill() doesn't work on the main thread on FreeBSD6: sending a signal to the main thread does nothing. It works on the main thread just after the creation of the first thread. PyThread__init_thread() has 3 implementations in Python/thread_pthread.h:
pthread_init() doesn't exist on FreeBSD6. If the dummy thread implementation is used, pthread_kill() works directly on the main thread at startup. |
Attached patch implements the suggested fix. |
FreeBSD 7 is not affected by this issue. To test this issue, call signal.pthread_kill(threading.get_ident(), signal.SIGINT) in an interpreter: it should raise a KeyboardInterrupt. On FreeBSD6, it does nothing. Or run ./python -m test -v test_signal: test_pendings hangs because the test reads 3 bytes from a pipe whereas the pipe is empty. The write end is non blocking, but the read end is blocking. It would be possible to fix the test to fail instead of blocking: set the read end as non blocking (setUp() does always set the write end as non blocking). |
The patch looks good to me.
I think this issue deserves a specific test, since:
I've attached a patch spawning a new interpreter to test that. |
New changeset 024827a9db64 by Victor Stinner in branch 'default': |
Thanks, I commited your test at the same time of the fix. |
This issue introduced regressions in the faulthandler module: see issue bpo-12469. |
As discussed in issue bpo-12469, the commit 024827a9db64 makes things worse: it changes the behaviour of many functions related to signal handling (e.g. sigwait()) just to be able to use pthread_kill() on the main thread. I reverted the patch: commit 34061f0d35ba. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: