[Python-Dev] faulthandler is now part of Python 3.3

Victor Stinner victor.stinner at haypocalc.com
Thu Mar 31 03:54:34 CEST 2011


Hi,

I pushed my faulthandler module into the default branch (Python 3.3).
Since one week, I fixed a lot of bugs (platform issues), improved the
tests and Antoine wrote a new implementation of dump_backtraces_later()
using a thread (instead of SIGALRM+alarm()). It should now work on all
platforms (but register() is not available on Windows).

Use "python -X faulthandler" or "PYTHONFAULTHANDLER=1 python" to install
the fault handler at startup (catch segfaults and other fatal errors).

You can also register a signal (e.g. SIGUSR1) to dump the traceback on
this signal.

The latest added feature is to be able to the dump the traceback after a
timeout and exit the process: we may use it on regrtest.py to learn more
about test_multiprocess and test_threadsignals hangs. Issue #11393 has a
patch implementing this issue: add --timeout option to regrtest.py. You
can also just dump the traceback after the timeout without exiting.

Py_FatalError() always print the Python traceback (except if an
exception was raised: print the exception with its traceback).

For more information, read the doc:
http://docs.python.org/dev/library/faulthandler.html

Please tell me if you have any issue related to faulthandler.

--

If you get "undefined reference to `_PyFaulthandler_Init'" compiler
error, copy Modules/Setup.dist to Modules/Setup (cp Modules/Setup.dist
Modules/Setup).

test_faulthandler hangs on AMD64 Gentoo Wide 3.x and AMD64 OpenIndiana
3.x. It looks to be related to the stack overflow test (the stack is
maybe not limited on these buildbots?). I have a patch, but I cannot
test it because these buildbots are dead (oops, sorry!).

Most buildbots are red because a regression in test_logging (since 2
days): I disabled temporary the test (issue #11557), I hope that the
situation will be better in a few hours.

Thank you Antoine for your reviews!

Victor



More information about the Python-Dev mailing list