New submission from STINNER Victor:

While working on the PEP 475, I noticed that the faulthandler module doesn't 
handle well reentrant calls to its signal handlers. If a signal is received 
while faulthandler is displaying the traceback, faulthandler restarts to 
display a new traceback (and then finish to display the previous traceback).

Moreover, faulthandler uses the C function write() to display the traceback and 
it ignores write() errors. It should retry write() if write() is interrupted by 
a signal (fails with EINTR).

Attached py_write_noraise.patch:

- Add a new _Py_write_noraise() function
- Document functions releasing the GIL

Attached traceback_eintr.patch:

- Modify functions displaying traceback to use _Py_write_noraise() instead of 
write()

Attached faulthandler_eintr.patch:

- Add a reentrant flag to the two signal handlers of faulthandler
- Modify faulthandler.dump_traceback() to call PyErr_CheckSignals(), to call 
the Python signal handler if a signal was received while faulthandler was 
displaying the traceback of all Python threads

----------
files: py_write_noraise.patch
keywords: patch
messages: 239776
nosy: haypo
priority: normal
severity: normal
status: open
title: PEP 475: Enhance faulthandler to handle better reentrant calls
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file38775/py_write_noraise.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23836>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to