Commit 1452e67
fix(http): disable connection pooling to prevent stale connections in Lambda
## Problem
After upgrading from extension v92 to v93, customers reported a sharp
increase in "Max retries exceeded, returning request error" errors
(SVLS-8672, GitHub issue #1092).
## Root Cause
PR #1018 introduced HTTP client caching for performance improvements.
However, the cached client maintains a connection pool that doesn't work
well with Lambda's freeze/resume execution model:
1. Lambda executes, HTTP client created with connection pool
2. Extension flushes traces, connections remain open in pool
3. Lambda freezes (paused between invocations - seconds to minutes)
4. Lambda resumes, cached client reuses stale connections
5. TCP errors → "Max retries exceeded"
In v92, a new HTTP client was created per-flush, so there were never
stale connections to reuse.
## Solution
Disable connection pooling by setting `pool_max_idle_per_host(0)`. This
ensures each request gets a fresh connection, avoiding stale connection
issues while still benefiting from client caching.
This matches the pattern used in libdatadog's `new_client_periodic()`
which explicitly disables pooling with the comment: "This client does
not keep connections because otherwise we would get a pipe closed every
second connection because of low keep alive in the agent."
Fixes: SVLS-8672
Fixes: #1092
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent 06947f1 commit 1452e67
1 file changed
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
177 | 184 | | |
178 | 185 | | |
179 | 186 | | |
180 | 187 | | |
181 | 188 | | |
182 | 189 | | |
183 | 190 | | |
184 | | - | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
185 | 196 | | |
186 | 197 | | |
0 commit comments