Repository navigation
Conversation
Signed-off-by: xinjun.jiang <[email protected]>
|
👋 Hi git-jxj! Thank you for contributing to ai-dynamo/dynamo. Just a reminder: The 🚀 |
| errContains string | ||
| }{ | ||
| {name: "success", status: http.StatusOK, body: metrics}, | ||
| {name: "HTTP error", status: http.StatusServiceUnavailable, body: metrics, errContains: "returned status 503"}, |
There was a problem hiding this comment.
The HTTP error row does not exercise the idle-connection leak this regression targets: ScrapeMetricsEndpoint returns before consuming the response body, so the existing deferred body close closes the non-reusable connection even without CloseIdleConnections. Status-error handling is already protected by TestScrapeMetricsEndpoint/404_response, while the close-idle behavior remains covered by rows that consume the body before returning.
🤖 AI Fix
Remove the HTTP error table row from TestScrapeMetricsEndpointClosesConnections.
There was a problem hiding this comment.
Confirmed by temporarily removing CloseIdleConnections: the HTTP-error row still passed, while success, invalid exposition, and missing GPU metrics each failed with open connections. Removed the HTTP-error row and its now-constant status field in cf637e0. All three retained cases fail without the fix and pass with it, including the GPU package race run. Status errors remain covered by the existing 404 test.
Signed-off-by: xinjun.jiang <[email protected]>
|
Current head |
Summary
Each DCGM scrape creates its own HTTP transport. After a response is read to EOF, its TCP connection remains idle in that unused transport with no idle timeout. Repeated discovery rounds can accumulate sockets and transport goroutines while exporters keep connections alive.
Close the client's idle connections when the scrape returns. The defer runs after the response body is closed and preserves the existing request timeouts.
Details
Add a real HTTP keep-alive regression that repeats scrapes and checks server-side TCP connection closure for successful responses, invalid Prometheus exposition, and missing GPU metrics. Successful scrapes and both metric parsing error paths fail before the fix.
Where should the reviewer start?
deploy/operator/internal/gpu/discovery.goanddiscovery_connection_test.go.Validation
go test ./internal/gpu -count=1 -vgo test -race ./internal/gpu -count=1go test -p 4 ./...with Kubernetes 1.30.0 envtest assets.golangci-lint run(v1.64.8)make checkRelated Issues
Closes #16097
Summary by CodeRabbit