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

Alexander Belopolsky alexander.belopolsky at gmail.com
Mon Dec 20 19:09:32 CET 2010


On Mon, Dec 20, 2010 at 12:51 PM, Victor Stinner <vstinner at edenwall.com> wrote:
..
> 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.
>
What if the program crashes (again) in the signal handler before
having a chance to restore registers?  Also, can you point to
documentation that describes register restoring behavior?  I am not
sure all registers are (or even can be) restored.

> 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?

Because I had actual experience with that using R.  Your code may be
better, but R brings up a dialog on segfault asking whether to produce
a core dump.  Occasionally, that core dump would be completely
unusable because it would point to an unrelated point in the code.  I
don't have a specific case handy because long ago I disabled segfault
handlers in the local R installation.  (I actually use RPy which loads
R into  Python as a shared library, so the two handlers will conflict
anyways.)


More information about the Python-Dev mailing list