zombie question

Blair Lowe Blair.Lowe at compeng.net
Mon Jan 8 13:15:06 EST 2001


Hi,

Please also be aware that BSD and SYSV UNIX deal with zombies 
differently. It has to do with the sleeping properties of the parent.

You will need a switch to determine the operating system type, and 
deal with the processes differently depending on what it is.

Also, does conn.close cut off the child from the calling parent? Just 
a dumb guess.

Blair.

At 14:15 +0000 2001/01/08, jianchen at my-deja.com wrote:
>sure!
>
>the parent process looks like this£†
>------------------------------------------------------------
>serv=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
>
>try:
>	serv.bind((HOST,PORT))
>except:
>	print "Can't bind to local port %s" % PORT
>	sys.exit(-1)
>serv.listen(5)
>signal.signal(signal.SIGCHLD,handler)
>while 1:
>	conn,addr=serv.accept()
>	pid=os.fork()
>	if pid<0:	myerr('Can\'t fork new process')
>	if pid==0:	# the child process
>		serv.close(£©
>		proxy(conn,addr)	# the real proxy
>		sys.exit(0)
>	conn.close()
>------------------------------------------------------------
>
>The handler is :
>
>def handler(signum,frame):
>  	pid,excode=os.waitpid(-1,os.WNOHANG)
>	return
>
>------------------------------------------------------------
>
>the most strange thing is that the handler is never called!
>any advice. thanks!
>
>
>
>Sent via Deja.com
>http://www.deja.com/
>--
>http://www.python.org/mailman/listinfo/python-list

Computer Engineering Inc. http://www.compeng.net
Phone: 780 499 5687 (9 - 5 MST) Fax:   780 435 0693 (24 Hours)
All email advice that is provided for free is without warrantee: use 
at your own risk. 




More information about the Python-list mailing list