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

Task was destroyed but it is pending #574

Closed
earonesty opened this issue Oct 25, 2023 · 2 comments · Fixed by #691
Closed

Task was destroyed but it is pending #574

earonesty opened this issue Oct 25, 2023 · 2 comments · Fixed by #691

Comments

@earonesty
Copy link

I get flooded with these when using janus

2023-10-25 17:32:45,185 - asyncio - ERROR - Task was destroyed but it is pending!
task: <Task pending name='Task-8498' coro=<Queue._notify_async_not_empty..f() running at /home/ubuntu/ai-worker/venv/lib/python3.11/site-packages/janus/init.py:238> cb=[set.discard()]>

@RobertSamoilescu
Copy link

The queue is probably destroyed without properly closing it. You can try this:

q.close()
await q.wait_closed()

@x42005e1f
Copy link
Contributor

Janus creates new tasks in its notification methods to further wake up tasks suspended on the get() and put() methods. You probably are closing the event loop before these tasks have time to complete, which is why you get such flooding. Like @RobertSamoilescu said, you need to close the queue and wait for these tasks to complete. It might be better to explicitly mention this implementation limitation in the README so people know that Janus queues should always be closed correctly.

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.

3 participants