-
Notifications
You must be signed in to change notification settings - Fork 55
Description
Hi!
I've been hitting a problem on Windows with IocpProactor not closing.
Firstly, it seems to be solved in recent commits - when using master code the problem does not seem to appear anymore, thanks! It seems additional locking has solved it (#87).
I've asked my debugging question and described details on python forums: https://discuss.python.org/t/asyncio-iocpproactor-does-not-close/35206
Mind you, all my thoughts at the end seem to be completely wrong.
But I wonder if overridden _IocpProactor._poll is missing this code from upstream _poll?
# Remove unregistered futures
for ov in self._unregistered:
self._cache.pop(ov.address, None)
self._unregistered.clear()Because after some more debugging I expected that's the problem - items from _cache do not get evicted, they are unregistered, but hang in _cache.
Unless _unregister does not get called at all with the overridden proactor? But I think it can be called from run_forever:
https://github.com/python/cpython/blob/43a6e4fa4934fcc0cbd83f7f3dc1b23a5f79f24b/Lib/asyncio/windows_events.py#L332-L334