STINNER Victor <vstin...@redhat.com> added the comment:

> * 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)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33966>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to