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: _coro_creating_hub_and_span #2908
Comments
Hey @cnicodeme, thank you for reporting this! Are the errors thrown when something specific happens (worker restarting, app shutdown, etc.) or just at random? |
Yes! When I restart the app, I get a ton of these |
Thanks for confirming, I expected as much. The SDK being responsible for the errors being created is one thing, but we're even reporting them to Sentry, which is doubly wrong. If you want to get rid of them before we fix this, one workaround would be to filter them out in a custom |
Thank you! I can implement a |
You could do something like this: def my_before_send(event, hint):
if "_coro_creating_hub_and_span()" in event["message"]:
return None # this event will be dropped
return event # send everything else
sentry_sdk.init(
# your usual stuff
before_send=my_before_send,
) To see what you can filter on, you can click on the |
Thank you! Will do that! Can you tell me which version of Sentry SDK will have the fix incorporated? So that I can remove my fix once it's resolved? Thanks! |
No target release yet, but I'll try to remember to come back to update this issue once I know. In general, as soon as an issue gets closed, the fix is scheduled for the upcoming release, which usually takes at most a couple weeks from then. |
Thank you :) |
Hi, I'm re-opening this ticket because I realized a few things:
I've removed the Thanks! |
Hey @cnicodeme, this is still open, no fix for it yet. The def my_before_send(event, hint):
if "_coro_creating_hub_and_span()" in (event.get("message") or ""):
return None # this event will be dropped
return event # send everything else If it still doesn't work, please try initializing the SDK with |
How do you use Sentry?
Sentry Saas (sentry.io)
Version
1.34.0
Steps to Reproduce
Hey team,
I'm having a lot of "Task was destroyed but it is pending!" issues reported at Sentry.
I'm running Sanic (v23.6.0) and here's a sample of the errors:
Task was destroyed but it is pending!
task: <Task pending name='Task-532' coro=<patch_asyncio.._sentry_task_factory.._coro_creating_hub_and_span() running at /var/www/fernand/env/lib/python3.9/site-packages/sentry_sdk/integrations/asyncio.py:52> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7f7af084d2b0>()]>>
Here's a sample:
https://cyril-nicodeme.sentry.io/issues/5081979263/events/6a88812f7d1d4c269d792b5f4b010541/
(Hopefully, you can also access more details about the issue via the UUID internally).
Expected Result
Should not have a "Task was destroyed but it is pending!" issue but properly send any issues
Actual Result
Fails with "Task was destroyed but it is pending"
The text was updated successfully, but these errors were encountered: