Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#16982 closed Bug (duplicate)

Child processes are kept alive when parent dies (with autoreload on)

Reported by: fabiofz@… Owned by: nobody
Component: Core (Other) Version: 1.3
Severity: Normal Keywords: autoreload
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: 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: 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/ 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 7 years ago by anonymous

Note: for those with this problem, a workaround (i.e.: always allocating a new console) is available at: (while this bug isn't properly fixed).

comment:2 Changed 7 years ago by Aymeric Augustin

Triage Stage: UnreviewedDesign decision needed

I'd prefer to avoid adding another thread to solve a threading problem.

comment:3 Changed 7 years ago by Julien Phalip

One big issue with process polling is that os.getppid() isn't supported on Windows in Python < 3.2 (see

comment:4 Changed 6 years ago by Ramiro Morales

Resolution: duplicate
Status: newclosed

Although #19137 is newer, I'm going to close this one as duplicate because that ticket has an actual patch that looks like a better strategy to solve the issue.

comment:5 Changed 6 years ago by fabiofz@…

Just to note, if getppid is a problem, take a look at: on a way to get the parent process id on windows in older versions of python.

Note: See TracTickets for help on using tickets.
Back to Top