This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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 <1530058918.53.0.56676864532.issue33966@psf.upfronthosting.co.za>
In-reply-to
Content
> * 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)
History
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: <1530058918.53.0.56676864532.issue33966@psf.upfronthosting.co.za>
2018-06-27 00:21:58vstinnerlinkissue33966 messages
2018-06-27 00:21:57vstinnercreate