SwapOff

Python hacking, redux. 
« Back to blog

Python "multiprocessing" and sockets

It seems obvious in retrospect (doesn't it always), but using the multiprocessing module doesn't exempt you from the fundamental laws of UNIX. Laws such as "forks duplicate file descriptors". Consequently, when you launch a multiprocessing.Process() and pass it a socket, ensure that you close the socket in the parent. If you don't, it will stay open after the child has closed it, resulting in leaking badness.

Comments (0)

Leave a comment...

 
To leave a comment on this posterous, please login by clicking one of the following.
Posterous-login     Connect     twitter