Martin Panter added the comment:

Here is a modified version of the script that is not a slow fork bomb. In the 
original, if time.sleep(600) fails to be interrupted, the children end up 
continuing the loop and forking more children.

I tried Python 3.5, 2.7 and 3.4. I am seeing the signal completely ignored (at 
the Python level), not just ignored “for a short while”. Here is a sample 
output:

$ python3 example.py
Python handler called
Parent waiting for child
Got exit status 0x0000
===
Parent waiting for child
Child: 0
Child: 1
Child: 2
Child: 3
Child: 4
Child: 5
Got exit status 0x0100

David may be right that it is an OS thing, though it does not seem likely IMO. 
It needs more investigation or expert knowledge.

But I would like to point out that even if the bug of the signal being 
completely ignored is fixed, the code still has a race condition. The signal 
could arrive in the window between when Python checks for signals and when it 
calls sleep(). Then the signal will be ignored until sleep() has returned. If 
you need this code to be robust, I suggest looking at set_signal_fd() and 
select().

----------
nosy: +martin.panter
versions: +Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41089/example.py

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

Reply via email to