[issue27889] ctypes interfers with signal handling

George Slavin report at bugs.python.org
Tue Sep 6 02:47:04 EDT 2016


George Slavin added the comment:

Thanks for the reply!  I've managed to reproduce the issue without using ctypes, so we can exclude ctypes as the cause of the problem :)

The bug only occurs for me after hundreds of iterations of the script, so it is very intermittent.

>From my results, it appears the signal handler is called, but the exception isn't caught in the try block (this matches your result).

>From the call stack it appears the exception handler is called at
"print 'unexcepted'", which is after the try block.

Interestingly, if I place a print after time.sleep, I cannot repro this issue.  Maybe there is a race between the signal handler execution and execution of the try block in the main thread?  Adding the print might slow down the main thread enough that the race disappears.

I don't know the source that well, so I'll need to do some digging to get any more information.

I hope this helps!

-George Slavin

----------

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


More information about the Python-bugs-list mailing list