Repository navigation
fix: close HTTP response bodies to prevent OOM with many checks - #1058
Conversation
|
Hi! I fixed the integration test pipelines recently. Could you rebase or merge from master? I checked you integration test failures, and most if not all of them would be fixed by that. |
When running 100+ HTTP checks concurrently, response bodies were never closed if the check only validated status and headers (no body matcher). This caused unclosed TCP connections to accumulate, holding TLS state and transport buffers until the 10s client timeout expired, leading to OOM kills under memory limits. Changes: - Add Close() to system.HTTP interface and DefHTTP - Track whether Body() consumed the response body - Close() closes resp.Body if it wasn't consumed (i.e. status/headers-only checks) - resource/http.go Validate() defers sysHTTP.Close() for guaranteed cleanup Fixes OOM when goss is configured with many HTTP checks and limited RAM.
54592bc to
b13b130
Compare
|
Rebased this branch onto current I also tightened the cleanup path so Local validation run on Windows:
|
|
I took a look at the current failing Ubuntu check for this PR. Evidence:
Given that, this looks more like the branch being behind current I did not open a separate PR because changing the integration test golden package versions or image behavior would be broader than this PR's HTTP cleanup scope and may overlap with the ongoing release/pipeline work. AI assistance disclosure: I used Codex to help inspect logs and compare branches, then reviewed the evidence and local command results before posting. |
|
The problem is the lack is the .md5 file. That's used to determine if an image should be built from scratch. It's an easy fix, but annoying that I missed it when fixing the integration tests. |
|
I know what the issue is. @dukelion or @aelsabbahy, could one of you merge from master? The issue is that this PR is still using an older version of |
|
Merging based on discussion here: #1049 (comment) |
When running 100+ HTTP checks concurrently, response bodies were not always closed after validation. This caused unclosed TCP connections to accumulate, holding TLS state and transport buffers until the client timeout expired, leading to OOM kills under memory limits.
Checklist
make test-all(UNIX) passes. CI will also test thisDescription of change
Fixes OOM when goss is configured with many HTTP checks and limited RAM.
Close()to thesystem.HTTPinterface andDefHTTPsysHTTP.Close()from HTTP resource validation for guaranteed cleanupresp.BodywhenClose()is called, including after a body matcher reads it