SwapOff

Python hacking, redux. 
Filed under

processes

 

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.

Loading mentions Retweet
Filed under  //   multicore   network   processes   python  

Comments [0]