Commit d906255
fix(http): disable connection pooling to prevent stale connections in Lambda (#1094)
## Summary
Fixes a regression introduced in v93 where customers see a sharp
increase in "Max retries exceeded, returning request error" errors after
upgrading from v92.
- Disables HTTP connection pooling for the trace/stats flusher by
setting `pool_max_idle_per_host(0)`
- Prevents stale connections from being reused after Lambda
freeze/resume cycles
## Problem
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 - can be 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 (TLS session reuse,
configuration reuse, etc.).
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."
## Related
- Fixes [SVLS-8672](https://datadoghq.atlassian.net/browse/SVLS-8672)
- Fixes #1092
- Regression introduced in #1018
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: jordan gonzález <30836115+duncanista@users.noreply.github.com>1 parent bacfad2 commit d906255
1 file changed
+13
-2
lines changed| 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