Child processes are kept alive when parent dies (with autoreload on)
|Reported by:||fabiofz@…||Owned by:||nobody|
|Cc:||Triage Stage:||Design decision needed|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Currently, when the parent process is killed, child processes are still kept alive. I think there should be an option where the child enters a poll mode to know whether the parent process is still alive (and if it's not, the child exits) See: http://stackoverflow.com/questions/284325/how-to-make-child-process-die-after-parent-exits for a reference.
This is especially annoying when working in IDEs that will kill the parent process by default (as opposed to working in the command line, where a ctrl+c is usually the default -- but even in that case, if the process is killed in the task manager instead of doing a ctrl+c, the child process will be kept alive).
After a quick look it seems related to django/utils/autoreload.py and the way it starts up things -- so, it'd be needed to start a thread that keeps seeing if the parent is alive and if it's not it kills the child process.
Or maybe starting the process with some other Popen variant could do the trick too...
Change History (5)
comment:1 Changed 5 years ago by anonymous
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 5 years ago by aaugustin
- Triage Stage changed from Unreviewed to Design decision needed
comment:4 Changed 4 years ago by ramiro
- Resolution set to duplicate
- Status changed from new to closed