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

run_sync raises TimeoutError on explicit event-loop stop #3435

Open
minrk opened this issue Oct 28, 2024 · 0 comments · May be fixed by #3436
Open

run_sync raises TimeoutError on explicit event-loop stop #3435

minrk opened this issue Oct 28, 2024 · 0 comments · May be fixed by #3436

Comments

@minrk
Copy link
Contributor

minrk commented Oct 28, 2024

When a coroutine passed to run_sync doesn't finish because the event loop is stopped explicitly, the error raised is a somewhat confusing:

TimeoutError: Operation timed out after None seconds

Repro:

import asyncio
from tornado.ioloop import IOLoop

async def main():
    await asyncio.sleep(1)
    # ask the loop to stop
    IOLoop.current().stop()
    # coroutine doesn't finish
    await asyncio.sleep(10)

if __name__ == "__main__":
    IOLoop.current().run_sync(main)

I'm not even sure it needs to not be a TimeoutError, but the message should probably at least distinguish between the timeout having triggered and the loop stopping for other reasons. Right now, this bit assumes a timeout is the only way the loop might stop before the given coroutine exits.

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

Successfully merging a pull request may close this issue.

1 participant