[issue12392] pthread_kill() doesn't work on the main thread on FreeBSD6
Changes by Florent Xicluna florent.xicl...@gmail.com: -- Removed message: http://bugs.python.org/msg147102 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12392] pthread_kill() doesn't work on the main thread on FreeBSD6
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 8ea34a74f118 by Éric Araujo in branch '2.7': Add missing versionadded (fixes #12392) http://hg.python.org/cpython/rev/8ea34a74f118 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12392] pthread_kill() doesn't work on the main thread on FreeBSD6
STINNER Victor victor.stin...@haypocalc.com added the comment: As discussed in issue #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. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12392] pthread_kill() doesn't work on the main thread on FreeBSD6
STINNER Victor victor.stin...@haypocalc.com added the comment: This issue introduced regressions in the faulthandler module: see issue #12469. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12392] pthread_kill() doesn't work on the main thread on FreeBSD6
Changes by STINNER Victor victor.stin...@haypocalc.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12392] pthread_kill() doesn't work on the main thread on FreeBSD6
Charles-François Natali neolo...@free.fr added the comment: Attached patch implements the suggested fix. The patch looks good to me. It would be possible to fix the test to fail instead of blocking I think this issue deserves a specific test, since: - test_pending tests something completely different - at the time test_pending gets to run, there's a high chance that threads have already been created I've attached a patch spawning a new interpreter to test that. -- Added file: http://bugs.python.org/file22445/pthread_kill_main_thread.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12392 ___diff -r 5ec95f46bac5 Lib/test/test_signal.py --- a/Lib/test/test_signal.py Fri Jun 24 13:28:08 2011 -0400 +++ b/Lib/test/test_signal.py Fri Jun 24 20:01:37 2011 +0200 @@ -295,6 +295,31 @@ self.check_signum(signum1, signum2) +@unittest.skipUnless(hasattr(signal, 'pthread_kill'), + 'need signal.pthread_kill()') +def test_pthread_kill_main_thread(self): +# Test that a signal can be sent to the main thread with pthread_kill() +# before any other thread has been created (see issue #12392). +code = if True: +import threading +import signal +import sys + +def handler(signum, frame): +sys.exit(3) + +signal.signal(signal.SIGUSR1, handler) +signal.pthread_kill(threading.get_ident(), signal.SIGUSR1) +sys.exit(0) + + +with spawn_python('-c', code) as process: +stdout, stderr = process.communicate() +exitcode = process.wait() +if exitcode != 3: +raise Exception(Child error (exit code %s): %s % +(exitcode, stdout)) + def setUp(self): import fcntl ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12392] pthread_kill() doesn't work on the main thread on FreeBSD6
Roundup Robot devnull@devnull added the comment: New changeset 024827a9db64 by Victor Stinner in branch 'default': Issue #12392: fix thread initialization on FreeBSD 6 http://hg.python.org/cpython/rev/024827a9db64 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12392] pthread_kill() doesn't work on the main thread on FreeBSD6
STINNER Victor victor.stin...@haypocalc.com added the comment: I've attached a patch spawning a new interpreter to test that. Thanks, I commited your test at the same time of the fix. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12392] pthread_kill() doesn't work on the main thread on FreeBSD6
New submission from STINNER Victor victor.stin...@haypocalc.com: 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: - call pthread_init() - create a dummy thread (no-op) and join it - do nothing pthread_init() doesn't exist on FreeBSD6. If the dummy thread implementation is used, pthread_kill() works directly on the main thread at startup. -- messages: 138875 nosy: haypo, neologix priority: normal severity: normal status: open title: pthread_kill() doesn't work on the main thread on FreeBSD6 versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12392] pthread_kill() doesn't work on the main thread on FreeBSD6
STINNER Victor victor.stin...@haypocalc.com added the comment: Attached patch implements the suggested fix. -- keywords: +patch Added file: http://bugs.python.org/file22431/thread_init_freebsd6.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12392] pthread_kill() doesn't work on the main thread on FreeBSD6
STINNER Victor victor.stin...@haypocalc.com added the comment: 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). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12392 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com