[issue14665] faulthandler prints tracebacks in reverse order

STINNER Victor report at bugs.python.org
Wed Apr 25 00:51:14 CEST 2012


STINNER Victor <victor.stinner at gmail.com> added the comment:

faulthandler has to be as simple as possible because Python internal state may be completly corrupted. faulthandler was written to display the traceback on bugs like invalid memory read or write. I chose to print the traceback as it is stored in memory (from the current frame to the bottom of the stack using f_back).

If the traceback is corrupted in the middle of the frame stack, faulthandler displays the first half of the traceback, whereas it would not display anything with your patch.

The number of frames is also limited to avoid unlimited loops. The internal state may be corrupted and I don't want to track already seen frames or something like that. With your patch, you may miss where the bug occurred if the stack contains more than 100 frames. The limit is hardcoded and cannot be changed at runtime yet.

I already seen a segfault while faulthandler was trying to display the traceback of a segfault, more than once :-)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14665>
_______________________________________


More information about the Python-bugs-list mailing list