os.fork leaving processes behind
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Fri Dec 28 02:11:22 EST 2007
More information about the Python-list mailing list
Fri Dec 28 02:11:22 EST 2007
- Previous message (by thread): os.fork leaving processes behind
- Next message (by thread): os.fork leaving processes behind
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
En Thu, 27 Dec 2007 21:36:36 -0300, Falcolas <garrickp at gmail.com> escribió: > This may be more of a Linux question, but it relates to how Python > forks... Yes; every book describing how to use fork tells about zombie processes and the wait/waitpid functions. Just do the same thing in Python. > Today, I implemented a pretty simple listener script using os.fork. > The script runs fine, and performs as expected, but the process table > is left with an odd entry for every fork called. A "zombie". > I'm running on Slackware 9, under the 2.4 kernel, Python 2.5.1. > > while True: > conn, addr = s.accept() > if os.fork(): > continue > else: > handle_connection(conn) > sys.exit(0) I'd try to use any of the existing server implementations in SocketServer.py, but if you insist on using your own, look at the ForkingMixin class as an example of using waitpid() to avoid having zombie processes. -- Gabriel Genellina
- Previous message (by thread): os.fork leaving processes behind
- Next message (by thread): os.fork leaving processes behind
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list