[Python-Dev] Issue #8863 adds a new?PYTHONNOFAULTHANDLER?environment variable

Victor Stinner vstinner at edenwall.com
Mon Dec 20 18:51:09 CET 2010


Le lundi 20 décembre 2010 18:22:48, Alexander Belopolsky a écrit :
> On Mon, Dec 20, 2010 at 11:56 AM, Stefan Krah <stefan at bytereef.org> wrote:
> > Victor Stinner <vstinner at edenwall.com> wrote:
> ..
> 
> >> The fault handler helps developers because they don't have to have a
> >> Python compiled in debug mode and to run the application in a debugger
> >> (like gdb).
> >> 
> >> If the developer is unable to reproduce an error, because it's an
> >> Heisenbug, or because the developer doesn't have the same OS, libraries
> >> and/or applications, the fault handler helps the developer to isolate
> >> the problem.
> > 
> > This is what I'm sceptical about. I think the tracebacks are don't carry
> > enough information for that.

Yes, in some cases the backtrace doesn't help. But why don't you want to 
display the backtrace if it can help in some other cases?

> My concern is that the traceback generated by a signal handler may
> actually contain *less* information that what would otherwise be
> available from the core dump or other system diagnostic facilities.

I changed my patch to call the previous signal handler starting at version 10. 
So the core dump function or OS fault handler will be called two. Said 
differently, it only gives *more* information, not less.

If you have a better OS fault handler than Python fault handler, you should 
disable Python fault handler by setting the environment variable.

> Whenever you continue to execute code after  a fault occurs (even in
> an alternative stack), you change register values and run the risk
> that the program will not be able to produce a core dump at all or
> will produce a core dump with misleading information in it.

Are you sure that a signal handler changes the registers? At least Linux saves 
integer and float registers before calling the signal handler, and then 
restores them.

The fault handler only changes some registers and write some bytes on the 
stack. The stack pointer is restored at exit, so I don't think that it causes 
troubles to use a core dump.

Dump a core file doesn't rely on process registers or mappings. Why do you 
think that it will break the core dump function?

Victor


More information about the Python-Dev mailing list