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 gvanrossum, python-dev, sbt, steve.dower, tim.golden, vstinner, yselivanov, zach.ware
Date 2015-01-26.16:58:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1422291532.56.0.851062876946.issue23095@psf.upfronthosting.co.za>
In-reply-to
Content
Pseudo-code:
---
handle = ...
fut = proactor.wait_for_handle(handle)
fut.cancel()
loop.close()
---

Windows functions called in this code:

- A: call RegisterWaitForSingleObject() on an handle
- A: call UnregisterWaitEx() with an event
- B: call RegisterWaitForSingleObject() on this event
- B: the wait on this event completes: the completion is signaled with PostToQueueCallback() (our internal callback passed to RegisterWaitForSingleObject())
- A: _unregister_wait_cb() is called on the future A
- (but the wait on the object A is never signaled by PostToQueueCallback())

In short, UnregisterWaitEx() is called before the callback passed to RegisterWaitForSingleObject() is called. In this case, the callback is never called, and so the completion of the wait is never signaled.

Internally, RegisterWaitForSingleObject() is implemented as a pool of threads calling WaitForMultipleObjects(). The default limit for the pool is 500 threads. WaitForMultipleObjects() is limited to 64 objects. Each thread uses a timer and computes a timeout. The timer is awaken to cancel a wait.
History
Date User Action Args
2015-01-26 16:58:52vstinnersetrecipients: + vstinner, gvanrossum, tim.golden, python-dev, sbt, zach.ware, yselivanov, steve.dower
2015-01-26 16:58:52vstinnersetmessageid: <1422291532.56.0.851062876946.issue23095@psf.upfronthosting.co.za>
2015-01-26 16:58:52vstinnerlinkissue23095 messages
2015-01-26 16:58:51vstinnercreate