[Python-Dev] Fault handler updated, now disabled by default (original) (raw)
Victor Stinner victor.stinner at haypocalc.com
Thu Dec 23 03:08:13 CET 2010
- Previous message: [Python-Dev] issue 10296
- Next message: [Python-Dev] Fault handler updated, now disabled by default
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
Thanks to all your useful remarks, I improved my patch twice (version 10 and 11). I think that the last version (11) addresses all reported issues. The most notable change is that the fault handler is now disabled by default. It fixes also the function getting the thread state, it now works in all cases (especially if the thread causing the fault doesn't hold the GIL).
Summary of the patch (#8863):
- Add an optional fault handler for SIGSEGV, SIGFPE, SIGILL and SIGBUS signals displaying the Python backtrace
- Setting PYTHONFAULTHANDLER environment variable, or using "-X faulthandler" command line option, enables it
- If it's enabled, display also the Python backtrace on a fatal error
Use case: when a program crashs, the user reruns its application with the fault handler enabled and tries to reproduce the crash. He/She can send the Python backtrace to the developer, or use it directly (if he/she understands it).
I think that this patch helps to isolate crashs in Python or libraries, especially if the user doesn't have all tools needed to get a Python backtrace (on a crash) and the developer is unable to reproduce the bug (because it doesn't have the same OS or libraries). For example, gdb 7 and python-gdb.py are rare on Windows :-) (even on Linux!)
So, do you agree with the fault handler? Does someone want to give a last review because I commit it?
http://bugs.python.org/issue8863
Victor
- Previous message: [Python-Dev] issue 10296
- Next message: [Python-Dev] Fault handler updated, now disabled by default
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]