How to kill Zombie process?

Chris Gonnerman chris.gonnerman at newcenturycomputers.net
Sun Dec 16 23:50:13 EST 2001


You need os.wait() or an equivalent.  Unixoid OS's will keep a process in the process
table to retain it's return status until you retrieve it with the wait(2) syscall.
  ----- Original Message ----- 
  From: 张少驰 
  To: python-list 
  Sent: Sunday, December 16, 2001 8:34 PM
  Subject: How to kill Zombie process?


    When I use ret=os.fork(),it will create a parent process and child process,when child process exists,it will creaet a Zombie process,How to kill it in parent's process? For example:

  udpSerSock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
  while 1:
    message=recvfrom(BUFSIZ)
    ret=os.fork()
    if ret==0:
       udpSerSock.close()
       ip=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
       #something deal
       ....
       ip.close() 
       break

  #ps -a
  I will find a Zombie process  
  5463 pts/3    00:00:01 python
  5465 pts/3    00:00:00 python <defunct>  #Zombie process

  How to kill it? Any ideas will be appreciated,Thanks!
                    Edward
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20011216/3ffbe2f3/attachment.html>


More information about the Python-list mailing list