Commit d2d30fc
authored
## Overview
Fixes the remaining cases of
[#1092](#1092)
— customers continuing to see `Max retries exceeded, returning request
error` and `TRACES | Request failed: No requests sent` after the v94
patch in #1094.
PR #1094 disabled connection pooling on the **hyper** `HttpClient` used
by the trace flusher and stats flusher. It did not touch the **reqwest**
`Client` in `bottlecap/src/http.rs`, which is used by:
- the trace proxy (`proxy_flusher`) — the path AppSec and many tracer
configurations route through
- the metrics flusher
- the logs flusher
That client was still configured with `pool_idle_timeout(270s)` and
`tcp_keepalive(120s)`, leaving idle connections in the pool across
Lambda freeze/resume cycles. Connections go stale during a freeze (the
OS tears down the remote side while the local kernel still considers
them established), and the next request after resume fails with broken
pipe / RST → retries exhaust → the user-visible errors.
## Change
`bottlecap/src/http.rs`: replace `pool_idle_timeout(270s) +
tcp_keepalive(120s)` with `pool_max_idle_per_host(0)`. Mirrors the fix
in `bottlecap/src/traces/http_client.rs` and the pattern in libdatadog's
`new_client_periodic`. Each request opens a fresh connection; TLS
session resumption inside the client still amortizes the handshake.
Trade-off: one extra TLS handshake per flush. Matches the pre-v93
behavior that customers had no complaints about.
## Testing
- New unit test `shared_client_does_not_pool_connections` in
`bottlecap/src/http.rs`:
- Spawns a minimal HTTP/1.1 keep-alive server that counts accepted TCP
connections.
- Issues two sequential GETs through `get_client(...)`.
- Asserts the server saw **2** connections.
- Verified the test **fails** against the unpatched code (`opened=1`,
connection reused from pool) — proves it catches the regression.
- Verified the test **passes** against the patched code (`opened=2`,
fresh connection each time).
- `cargo test --lib` — 547 tests pass.
- `cargo clippy --lib --tests -- -D warnings` — clean.
- `cargo fmt --check` — clean.
## Other clients (unchanged)
| Client | File | Pooling | Notes |
|---|---|---|---|
| hyper `HttpClient` | `traces/http_client.rs` | already disabled
(#1094) | trace + stats flushers |
| reqwest `Client` (shared) | `bottlecap/src/http.rs` | **disabled
here** | trace proxy, metrics, logs |
| reqwest `Client` (Lambda Extensions API) | `bin/bottlecap/main.rs` |
unchanged | localhost-only; pooling irrelevant |
1 parent 1c181be commit d2d30fc
1 file changed
Lines changed: 104 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
31 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| |||
145 | 148 | | |
146 | 149 | | |
147 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
0 commit comments