This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients docs@python, jon orebro, martin.panter, r.david.murray
Date 2015-11-20.01:58:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1447984699.59.0.414435601246.issue25666@psf.upfronthosting.co.za>
In-reply-to
Content
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().
History
Date User Action Args
2015-11-20 01:58:19martin.pantersetrecipients: + martin.panter, r.david.murray, docs@python, jon orebro
2015-11-20 01:58:19martin.pantersetmessageid: <1447984699.59.0.414435601246.issue25666@psf.upfronthosting.co.za>
2015-11-20 01:58:19martin.panterlinkissue25666 messages
2015-11-20 01:58:18martin.pantercreate