Richard Rossel wrote: > Hi Fellows, > I have a problem with process termination. I have a python code that > apache runs through a django interface. > The code is very simple, first, it creates a process with the > subprocess.Popen call, and afterwards, (using a web request) the > python code uses the PID of the previously created process(stored in a > db) and kills it with an os.kill call using the SIGKILL signal. > > The creation of the process is ok, apache calls the python code, this > code creates the process and exits leaving the process up and > running :) > But when the python code is called to kill the created process, the > process is left in a zombie state. > > The kill code that I'm using is: > os.kill(pid, signal.SIGKILL) > > and I also tried: > kill_proc = Popen("kill -9 " + pid, shell=true) > but with no success. > > I suppose that the reason maybe that the python code exits before the > kill call has finished, > so I tried with a while loop until kill_proc.poll() != None, but > without success too :( > > do you know what is what I'm doing wrong? > > thanks very much.- > Wouldn't it be better to make the process that you start respond gracefully to some signal? Either a command over a socket or some other signal?
-Larry -- http://mail.python.org/mailman/listinfo/python-list