You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Python 3.12 it's not possible to spawn new threads on interpreter shutdown. We patched our background worker that's responsible for sending events in an atexit hook to not attempt to send any pending events if it doesn't have an active thread in #2468.
Solution Brainstorm
Make the background worker aware that the interpreter is shutting down and if it doesn't have its own thread, make it use the main thread for sending any pending events. (Might not be possible.)
Or: Make the background worker always have a thread active?
Based on my tests this solves a basically non existent problem. The worker creates a thread on demand. If there's any exception (transaction, etc.) happening, the thread will be created and can be reused during the atexit hook. The only scenario where I could see a potential issue is a program that runs event-free and then crashes -- we want that exception in Sentry --, but we also handle this case correctly as the thread is created before the atexit hook. Will close this.
Activity
[-]Send pending events in main thread on shutdown in 3.12[/-][+]Send pending events on shutdown in 3.12[/+]sentrivana commentedon Dec 14, 2023
Based on my tests this solves a basically non existent problem. The worker creates a thread on demand. If there's any exception (transaction, etc.) happening, the thread will be created and can be reused during the atexit hook. The only scenario where I could see a potential issue is a program that runs event-free and then crashes -- we want that exception in Sentry --, but we also handle this case correctly as the thread is created before the
atexithook. Will close this.