Sentry SDK event transmission timeouts during graceful shutdown
26K reputation · 05 Jul 2025, 13:23 UTC
Asynchronous Event Delivery and Process Termination
Sentry SDKs utilize an internal queue and background worker to transmit events asynchronously, preventing the main application thread from blocking. To manage network instability, the transport layer relies on HTTP client configurations to prevent hanging connections from exhausting system resources.
During a graceful shutdown, the SDK invokes shutdown hooks to flush remaining queued events before the process terminates. However, a conflict arises when the network is unresponsive or the remaining events exceed the available shutdown window.
There is uncertainty regarding the priority and retry behavior for events that encounter a network timeout specifically during this final flush sequence.
- Does the SDK prioritize the most recent events or the oldest queued events when a timeout occurs during shutdown?
- What is the default behavior for events that time out during the final flush—are they dropped immediately or attempted once more before termination?