#πŸ”’ Task warnings with Uvicorn and Asyncio

4 messages Β· Page 1 of 1 (latest)

chrome nebula
#

I've written a chat app that uses Quart, socketio, and uvicorn, along with some external frameworks like firestore. My dev environment is Replit. In some parts of my app, I get vague warning messages that I interpret as meaning that something is blocking an async function:

WARNING
Executing <Task pending name='Task-32' coro=<AsyncServer._handle_event_internal() running at /home/runner/MyApp/.pythonlibs/lib/python3.11/site-packages/socketio/async_server.py:610> wait_for=<Task pending name='Task-33' coro=<UnaryStreamCall._send_unary_request() running at /home/runner/MyApp/.pythonlibs/lib/python3.11/site-packages/grpc/aio/_call.py:634> cb=[Task.task_wakeup()] created at /home/runner/MyApp/.pythonlibs/lib/python3.11/site-packages/grpc/aio/_call.py:629> cb=[set.discard()] created at /nix/store/f98g7xbckgqbkagdvpzc2r6lv3h1p9ki-python3-3.11.9/lib/python3.11/asyncio/tasks.py:680> took 0.109 seconds

I can find the offending code block by uncommenting code until the warning goes away, but surely there is a better way to identify the offending caller? I'm wondering if there's a deeper problem like some kind of conflict with asyncio and uvicorn? Or am I just expected to wrap a bunch of potentially slow blocks in asyncio.to_thread()?

cosmic sinewBOT
#

@chrome nebula

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

cosmic sinewBOT
#

@chrome nebula

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.