Author vstinner
Recipients davin, paul.moore, pitrou, steve.dower, tim.golden, vstinner, zach.ware
Date 2018-06-27.00:21:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> * dump() indirectly calls reduce_connection() (ex: for SimpleQueue._reader) of multiprocessing.connection
> * reduce_connection() duplicates the pipe handle

Sorry, it's reduce_pipe_connection(), not reduce_connection().

> It's unclear to me who is supposed to close the duplicated pipe handles? reduce_connection() creates a "ds = resource_sharer.DupSocket(s)" object, but this object doesn't seem to call CloseHandle()?

reduce_pipe_connection() creates a DupHandle object which duplicates the handle, and it's detach() method closes the handle.

The race condition is that sometimes the pool terminates a worker (worker() function of multiprocessing.pool) before the worker has time to close the duplicated handle.

The handle is closed by:
* rebuild_pipe_connection()
* dh.detach(), extract:

                return _winapi.DuplicateHandle(
                    proc, self._handle, _winapi.GetCurrentProcess(),
                    self._access, False, _winapi.DUPLICATE_CLOSE_SOURCE)
Date User Action Args
2018-06-27 00:21:58vstinnersetrecipients: + vstinner, paul.moore, pitrou, tim.golden, zach.ware, steve.dower, davin
2018-06-27 00:21:58vstinnersetmessageid: <>
2018-06-27 00:21:58vstinnerlinkissue33966 messages
2018-06-27 00:21:57vstinnercreate