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.

Author neologix
Recipients neologix, vstinner
Date 2013-08-28.16:24:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1377707093.4.0.0816466324955.issue18869@psf.upfronthosting.co.za>
In-reply-to
Content
At the beginning of the test suit execution, faulthandler registers its signal handler for fatal signals, as well as SIGUSR1 and SIGALRM.

The problem is that some tests temporary change those handlers, e.g. for EINTR-handling tests.
While they do restore the original handlers after the test, this doesn't work as expected because of an artifact of the signal implementation: when a signal handler isn't registered through the signal module (e.g. directly from C for faulthandler), getsignal() and setsignal() return None/SIG_DFL (depending on whether it was registered before or after the module initialization). Which means that when the test is done, it will restore the default signal handler, and not the faulthandler's one. Thus, any subsequent crash due to this signal won't benefit from faulthandler debug output, see e.g. (issue #18786):
http://buildbot.python.org/all/builders/PPC64%20PowerLinux%203.x/builds/616/steps/test/logs/stdio
"""
[310/379] test_multiprocessing_spawn
make: *** [buildbottest] User defined signal 1
/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/multiprocessing/semaphore_tracker.py:121: UserWarning: semaphore_tracker: There appear to be 4 leaked semaphores to clean up at shutdown
  len(cache))
program finished with exit code 2
elapsedTime=2459.665997
"""

One way to fix this would be to add a WithSignalHandler(signal, handler) context manager to test.support that would replace the signal handler upon entry, and re-register faulthandler's handler upon exit.
History
Date User Action Args
2013-08-28 16:24:53neologixsetrecipients: + neologix, vstinner
2013-08-28 16:24:53neologixsetmessageid: <1377707093.4.0.0816466324955.issue18869@psf.upfronthosting.co.za>
2013-08-28 16:24:53neologixlinkissue18869 messages
2013-08-28 16:24:52neologixcreate