Child processes are kept alive when parent dies (with autoreload on)
|Reported by:||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
|Patch needs improvement:||unset|