external process not terminating
Larry Martell
larry.martell at gmail.com
Wed Apr 12 09:51:12 EDT 2017
I have an app (using 2.7) that processes requests. When a request of
type "A" is received I need to start an external process.
When a request of type "B" is received I need to check and see if that
external process has completed or not and then do some stuff depending
on if it has or not.
The issue I am running into is that when the external process is done
is does not exit, it goes into a zombie state, e.g.:
1 Z root 13703 13644 0 80 0 - 0 exit 09:37 ?
00:00:00 [python] <defunct>
Initially I was starting the process with Popen like this:
DEVNULL = open(os.devnull, "wb")
subprocess.Popen(cmd+args, stdin=DEVNULL, stdout=DEVNULL,
stderr=DEVNULL, close_fds=True)
I tried using os.spawn:
os.spawnv(os.P_NOWAIT, 'python', cmd+args)
But still the process did not exit.
Anyone know how I can get the external process to terminate when done?
TIA!
More information about the Python-list
mailing list