Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate asyncio.wait_for for possible bug #6211

Open
mrocklin opened this issue Apr 26, 2022 · 5 comments
Open

Investigate asyncio.wait_for for possible bug #6211

mrocklin opened this issue Apr 26, 2022 · 5 comments
Labels

Comments

@mrocklin
Copy link
Member

I've encountered situations that I think point to asyncio.wait_for not actually cancelling the underlying coroutine if the timeout is reached. I've had to work around this in a couple of situations:

See for a possible root cause: python/cpython#86296

We use asyncio.wait_for commonly throughout the codebase. If it genuinely sometimes misses then we should find a workaround, including possibly writing this ourselves.

cc @graingert do you have any thoughts on the CPython bug? Could it be causing what we're seeing? Do you see an easy solution here?

@graingert
Copy link
Member

and this is related too #6064

@graingert
Copy link
Member

one option is to wait for a backport of async with asyncio.timeout(delay): from python 3.11

python/cpython#90927

@mrocklin
Copy link
Member Author

mrocklin commented Apr 27, 2022 via email

@fjetter
Copy link
Member

fjetter commented Apr 27, 2022

We would wait for an official backport. This is likely a feature we can not just copy-paste. Depending on how long it takes for a backport (assuming it actually comes) we can invest more time into #6064 for the trivial situations where we are basically creating and waiting for the task in the same context (e.g. not nested tasks) this is a sufficient fix.

@mrocklin
Copy link
Member Author

we can invest more time into #6064 for the trivial situations where we are basically creating and waiting for the task in the same context (e.g. not nested tasks) this is a sufficient fix

I think that this is almost all cases that we use? I'm not sure what the less trivial case would look like.

To be clear, I would hope that this would be a function in utils.py that we could use throughout the codebase, not just in the case presented in that PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants