Repository navigation
Closed
Milestone
Description
Problem Statement
Tried using sentry with python 3.12. Ran into newly implemented RuntimeError tests. Want to give a heads up for once there is 3.12 (hopefuly after 3.11 #1950 🤞 ) support that this is something that will probably need fixing(?)
Example traceback (source):
Exception ignored in atexit callback: <function AtexitIntegration.setup_once.<locals>._shutdown at 0x7fa77fa24e00>
Traceback (most recent call last):
File "/builds/4704997395/software/venv/lib64/python3.12/site-packages/sentry_sdk/integrations/atexit.py", line 61, in _shutdown
client.close(callback=integration.callback)
File "/builds/4704997395/software/venv/lib64/python3.12/site-packages/sentry_sdk/client.py", line 580, in close
self.flush(timeout=timeout, callback=callback)
File "/builds/4704997395/software/venv/lib64/python3.12/site-packages/sentry_sdk/client.py", line 604, in flush
self.transport.flush(timeout=timeout, callback=callback)
File "/builds/4704997395/software/venv/lib64/python3.12/site-packages/sentry_sdk/transport.py", line 525, in flush
self._worker.submit(lambda: self._flush_client_reports(force=True))
File "/builds/4704997395/software/venv/lib64/python3.12/site-packages/sentry_sdk/worker.py", line 117, in submit
self._ensure_thread()
File "/builds/4704997395/software/venv/lib64/python3.12/site-packages/sentry_sdk/worker.py", line 42, in _ensure_thread
self.start()
File "/builds/4704997395/software/venv/lib64/python3.12/site-packages/sentry_sdk/worker.py", line 70, in start
self._thread.start()
File "/builds/4704997395/software/venv/lib64/python3.12/site-packages/sentry_sdk/integrations/threading.py", line 56, in sentry_start
return old_start(self, *a, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.12/threading.py", line 971, in start
_start_new_thread(self._bootstrap, ())
RuntimeError: can't create new thread at interpreter shutdown
cpython commit adding this "detection": python/cpython@ce558e6
Solution Brainstorm
Some sort of "graceful shutdown" on exit perhaps?
Reacted by Jenthe Noordsij, Thomas Christlieb, Thomas Brox Røst, JuanCarlosV, Gonzalo Lescano, Patrick Hintermayer, Pasha and AI Genie
Metadata
Metadata
Assignees
Labels
No labels
Projects
- StatusShow more project fieldsNo status
Activity
Toaster192 commentedon Aug 8, 2023
We got to work around this by closing sentry manually at the end of our programs 🤷
sentrivana commentedon Aug 8, 2023
Thanks for the heads up @Toaster192!
jnoordsij commentedon Oct 3, 2023
Would be great to have this fixed now that Python 3.12 is officially released.
14 remaining items
ethrgeist commentedon Oct 20, 2023
This also occurs when running migrations in Django.
ThiefMaster commentedon Oct 20, 2023
Yes, I think it always happens when the Python interpreter exits while the sentry SDK is 'active'...
antonpirker commentedon Oct 23, 2023
Thanks for all the input! We will try to tackle this soon!
antonpirker commentedon Oct 31, 2023
Hey everybody,
we just released an update that should fix this problem: https://github.com/getsentry/sentry-python/releases/tag/1.33.0
Could you give it a try @Toaster192 @robd003 and @ethrgeist ?
ethrgeist commentedon Oct 31, 2023
Looks good, CLI and reload spam is gone, thank you very much!
shikharvaish28 commentedon Apr 1, 2024
Hi team, I am getting this error everytime a program has to exit:
I am using python 3.12 and sentry-sdk==1.14.0
ddelange commentedon Apr 1, 2024
the fix was released in 1.33.0