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 gdr@garethrees.org
Recipients davin, gdr@garethrees.org, mickp, paul.moore, steve.dower, tim.golden, zach.ware
Date 2017-07-20.17:13:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1500570800.58.0.364811387228.issue30976@psf.upfronthosting.co.za>
In-reply-to
Content
This is a race condition — when os.kill returns, that means that the signal has been delivered, but it does not mean that the subprocess has exited yet. You can see this by inserting a sleep after the kill and before the liveness check:

    print(proc.is_alive())
    os.kill(proc.pid, signal.SIGTERM)
    time.sleep(1)
    print(proc.is_alive())

This (probably) gives the process time to exit. (Presumably the psutil.pid_exists() call has a similar effect.) Of course, waiting for 1 second (or any amount of time) might not be enough. The right thing to do is to join the process. Then when the join exits you know it died.
History
Date User Action Args
2017-07-20 17:13:20gdr@garethrees.orgsetrecipients: + gdr@garethrees.org, paul.moore, tim.golden, zach.ware, steve.dower, davin, mickp
2017-07-20 17:13:20gdr@garethrees.orgsetmessageid: <1500570800.58.0.364811387228.issue30976@psf.upfronthosting.co.za>
2017-07-20 17:13:20gdr@garethrees.orglinkissue30976 messages
2017-07-20 17:13:20gdr@garethrees.orgcreate