Message263288
> One potential problem is how to provide for people who really want to let the child continue to run in the background or as a daemon without waiting for it, even if the parent exits. Perhaps a special method proc.detach() or whatever?
Maybe my heuristic to decide if ResourceWarning must be emitted is wrong.
If stdout and/or stderr is redirected to a pipe and the process is still alive when the destructor is called, it sounds more likely like a bug, because it's better to explicitly close these pipes.
If no stream is redirected, yeah, it's ok to pass the pid to a different function which will handle the child process. The risk here is not never called waitpid() to read the child exit status and so create zombi processes.
For daemons, I disagree: the daemon must use double fork, so the parent will quickly see its direct child process to exit. Ignoring the status of the first child status is a bug (we must call waitpid().
I have to think about the detach() idea and check if some applications use it, or even some parts of the stdlib.
Note: The ResourceWarning idea comes from asyncio.subprocess transport which also raises a ResourceWarning. I also had the idea when I read the issue #25942 and the old issue #12494. |
|
Date |
User |
Action |
Args |
2016-04-13 00:29:44 | vstinner | set | recipients:
+ vstinner, pitrou, martin.panter, serhiy.storchaka |
2016-04-13 00:29:44 | vstinner | set | messageid: <1460507384.81.0.344155913686.issue26741@psf.upfronthosting.co.za> |
2016-04-13 00:29:44 | vstinner | link | issue26741 messages |
2016-04-13 00:29:43 | vstinner | create | |
|