nmatravolgyi <nandor.ma...@gmail.com> added the comment:

I've also found this deficiency of asyncio.wait_for by debugging an obscure 
hang in an application. Back then I've quickly made an issue about it: 
https://bugs.python.org/issue43389

I've just closed it as duplicate, since this issue covers the same bug and has 
been around longer.

I'm surprised this issue has not got more attention. This definitely needs a 
fix. Ignoring a CancellationError is something that is heavily discouraged by 
the documentation in general. Silently ignoring/eating a cancellation makes 
this construct unreliable without good workarounds, aside from not using it.

For a specific application, this was so broken, that I had to come up with a 
fix in the short term. I made an asyncio.wait_for variant available as a 
library that fixes the problem: https://github.com/Traktormaster/wait-for2

The repository has a detailed description of the issue and the way it fixes it. 
It also has test cases to assert the behaviour of the builtin and the fixed 
wait_for construct from the library.

----------
nosy: +nmatravolgyi

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

Reply via email to