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 sourcejedi
Recipients asvetlov, sourcejedi, yselivanov
Date 2020-10-22.15:09:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1603379354.86.0.775958990646.issue42110@roundup.psfhosted.org>
In-reply-to
Content
Put the other way, if you wanted to fix this bug in ThreadedChildWatcher, and go as far as allowing cancelling Process.wait(), followed by kill() / send_signal(), then I think you need -

* siginterrupt(SIGCHLD, 1)
* not to mind about any random C code that doesn't really handle being interrupted.  Like printf(), ho hum.  https://groups.google.com/g/comp.unix.programmer/c/QZmFw1VytYs/m/BSBXBHTI1REJ
* add & use a new call like os.waitpid_interruptible(), which doesn't restart on EINTR, as a workaround for PEP-475.
* set a "stop" flag for the watcher thread
* use threading.pthread_kill() (available on *most* python platforms) to interrupt the watcher thread.  Spoof SIGCHLD, this will avoid conflicts with a python handler for any other signal.
* wait for the watcher thread to finish using Thread.join()
* now you can safely find out whether the child process has been reaped, or whether it's safe to kill it.
History
Date User Action Args
2020-10-22 15:09:14sourcejedisetrecipients: + sourcejedi, asvetlov, yselivanov
2020-10-22 15:09:14sourcejedisetmessageid: <1603379354.86.0.775958990646.issue42110@roundup.psfhosted.org>
2020-10-22 15:09:14sourcejedilinkissue42110 messages
2020-10-22 15:09:14sourcejedicreate