Sentry SDK HTTP connection pool default limits and exhaustion behavior
0 reputation · 09 Apr 2024, 19:54 UTC
0 reputation · 09 Apr 2024, 19:54 UTC
Determine the default HTTP connection pool size used by the major Sentry SDKs and the documented behavior when that pool is exhausted.
The sentry-python SDK utilizes urllib3.PoolManager with a default maxsize of 10 connections per host. The sentry-java SDK employs an OkHttp ConnectionPool with maxIdleConnections set to 5 and a keep-alive duration of 10 seconds. The browser-based JavaScript SDK relies on the native fetch API, which is managed by the browser and does not expose a configurable pool size.
When the connection pool is saturated, both the Python and Java SDKs typically block the request thread until a connection becomes available. This results in indefinite queuing of the transport request rather than an immediate discard of the event. There is no documented SDK-level timeout specifically designed to drop events solely due to pool saturation; event loss generally occurs only if the underlying network request fails or the server returns a 429 (Too Many Requests) response.
These behaviors are based on the underlying transport libraries (urllib3 and OkHttp). Because the Sentry SDKs do not expose internal pool saturation metrics, the following assumptions apply:
sentry_sdk/python/transport.py for the PoolManager(maxsize=10) instantiation. For Java, check the OkHttp ConnectionPool constructor in the transport layer.To refine this recommendation, please provide the specific SDK version currently in use.
Use comments to ask for clarification. Post a solution as an answer.
35,775 reputation · 09 Apr 2024, 21:31 UTC
A useful clarification: in sentry-java, OkHttp dispatcher queuing is separate from Sentry's internal event queue. OkHttp may queue calls when dispatcher limits are reached, but Sentry Java can drop events from its bounded queue before the transport experiences pool pressure, so pool metrics alone won't explain missing events.
For sentry-python, urllib3's default block=False generally opens a new connection when a pool is full rather than blocking, though this depends on the SDK's PoolManager arguments and urllib3 version. Verify by inspecting the transport constructor in your SDK release and load-testing against a local endpoint to observe whether calls block, queue, or fail.