This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_signal: test_sigwait_thread failure on FreeBSD 6.4 buildbot
Type: behavior Stage:
Components: Tests Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: neologix, python-dev, vstinner
Priority: normal Keywords: patch

Created on 2011-06-10 22:01 by neologix, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_sigwait_thread.diff neologix, 2011-06-13 14:01 review
Messages (6)
msg138138 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2011-06-10 22:01
http://www.python.org/dev/buildbot/all/builders/x86 FreeBSD 6.4 3.x/builds/1570/steps/test/logs/stdio

"""
[ 29/356] test_signal
Fatal error 'mutex is on list' at line 540 in file /usr/src/lib/libpthread/thread/thr_mutex.c (errno = 22)
test test_signal failed -- Traceback (most recent call last):
  File "/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/test/test_signal.py", line 669, in test_sigwait_thread
    self.check_sigwait(test, signal.SIGUSR1)
  File "/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/test/test_signal.py", line 632, in check_sigwait
    self.assertEqual(os.waitpid(pid, 0), (pid, 0))
AssertionError: Tuples differ: (50592, 134) != (50592, 0)

First differing element 1:
134
0

- (50592, 134)
?         ^^^

+ (50592, 0)
?         ^
"""


Fatal error 'mutex is on list' at line 540 in file /usr/src/lib/libpthread/thread/thr_mutex.c (errno = 22)

In a multi-threaded program, we're only allowed to call async-safe functions between fork() and exec() in the child process (well, taken literaly this means we shouldn't run Python at all after fork...). It looks like FreeBSD 6.4 doesn't like new threads after fork() :
http://unix.derkeiler.com/Mailing-Lists/FreeBSD/hackers/2008-03/msg00108.html

test_sigwait_thread should either be skipped on FreeBSD 6 (it seems to pass on FreeBSD 7), or removed altogether.
msg138141 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-06-10 22:36
> In a multi-threaded program, we're only allowed to call async-safe
> functions between fork() and exec() in the child process

Oh, I don't know that. The test should be modified to create a new clean Python process using subprocess to run the test.
msg138248 - (view) Author: Charles-François Natali (neologix) * (Python committer) Date: 2011-06-13 14:01
Patch attached:
- a new process is spawned (using assert_python_ok()) to avoid
undefined behavior (and crash on FreeBSD)
- I've kept SIGUSR1 default handler, because, as noted in
http://bugs.python.org/issue8407#msg138066 , there can be subtle
differences between default handlers and user-installed ones which can
mask bugs
- I've fixed a comment in test_sigwait
msg138249 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-06-13 14:20
New changeset d07d0afea9a7 by Victor Stinner in branch 'default':
Issue #12316: Fix sigwait() test using threads
http://hg.python.org/cpython/rev/d07d0afea9a7
msg138250 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-06-13 14:22
> Patch attached

The patch looks correct, but only FreeBSD 6.4 can tell us if it "works" or not, so I commited your new version of the test.

I inlined check_sigwait() because the function was only called by test_sigwait().
msg138257 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2011-06-13 15:30
test_signal passed in build #1577 of x86 FreeBSD 6.4 3.x: I close this issue. Thanks neologix!
History
Date User Action Args
2022-04-11 14:57:18adminsetgithub: 56525
2011-06-13 15:30:46vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg138257
2011-06-13 14:22:59vstinnersetmessages: + msg138250
2011-06-13 14:20:16python-devsetnosy: + python-dev
messages: + msg138249
2011-06-13 14:01:17neologixsetfiles: + test_sigwait_thread.diff
keywords: + patch
messages: + msg138248
2011-06-10 22:36:05vstinnersetmessages: + msg138141
title: test_signal: test_sigwait_thread failure on FreeBSD 6.4 buildbot -> test_signal: test_sigwait_thread failure on FreeBSD 6.4 buildbot
2011-06-10 22:01:24neologixcreate