Closed stat1c-void closed 1 year ago
Hi, thanks for bringing this up.
Reading the comment for cpython run_forever
, it does suggest that the IocpProactor.close
will wait forever, qasync also calls this method. So without popping futures from cache (even though they are marked as unregistered), the while self._cache
in the IocpProactor.close
will never close itself.
I this this should be added to the _poll
override.
Alright, should I do a PR?
I'll submit it later on today, cheers
Awesome, thanks!
Hi!
I've been hitting a problem on Windows with
IocpProactor
not closing. Firstly, it seems to be solved in recent commits - when usingmaster
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
?https://github.com/python/cpython/blob/43a6e4fa4934fcc0cbd83f7f3dc1b23a5f79f24b/Lib/asyncio/windows_events.py#L825-L828
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 fromrun_forever
: https://github.com/python/cpython/blob/43a6e4fa4934fcc0cbd83f7f3dc1b23a5f79f24b/Lib/asyncio/windows_events.py#L332-L334