Repository navigation
Description
Describe the bug
Now and then, the proxy aborts a response of the settings service halfway through, after it has sent the status and the first ~4 KB of the body. The proxy logs:
httputil: ReverseProxy read error during body copy: read tcp 127.0.0.1:…->127.0.0.1:9190: use of closed network connection
127.0.0.1:9190 is the HTTP address of the settings service. "use of closed network connection" means that the proxy itself closed its connection to the settings service while it was still reading the response from it: it isn't the settings service hanging up (that would be EOF or a connection reset), and it isn't a cancelled request (that would be "context canceled"). What closes the connection is still unknown.
The proxy then aborts the response to the client, as it should: the client gets the status and the first part of the body, then the connection is closed without the end of the chunked body.
Where it shows up
In the CI, as unstable API tests that fail with Control character error, possibly incorrectly encoded (JsonException): 28 failures in the last 300 pipelines, in apiAntivirus/antivirus.feature, apiNotification/*, apiSettings/notificationSetting.feature, apiSharingNg1/*, apiSharingNgAdditionalShareRole/*, apiOcm/share.feature and cliCommands/sharesCleanup.feature.
All of them fail the same way: before listing notifications or shares, the step looks up the user's language with POST /api/v0/settings/values-list. That response is a bit larger than 4 KB. In the failing runs, it has status 201 and a body cut off after 3763 bytes, in the middle of a string, and the proxy logs the error above at the same moment.
Checked in pipelines 5351, 5326, 5309, 5297 and 5212: each failure matches one proxy error, and the proxy logs no other.
The test helper hides that the transfer was aborted: HttpRequestHelper::sendRequestOnce catches the transfer error and goes on with the partial response, so the test fails later, when it decodes the cut-off JSON. A separate PR makes the helper fail on such transfer errors, so that the CI reports them as what they are.
Steps to reproduce
Not reproduced locally yet. These ran without a single cut-off response or proxy error, against a local server with basic auth:
- ~7,500 requests to
values-listfrom 20 parallel clients, with and without reusing connections - 3,000 requests with a chunked request body
- ~6,000 requests from 40 parallel clients with the CPU fully loaded
Expected behavior
The proxy passes on the complete response of the settings service.
Actual behavior
Now and then the response is aborted after the first ~4 KB, because the proxy closes its connection to the settings service while reading the response.
Additional context
- Clients don't get a silently truncated response: the transfer fails for them. Clients that don't retry fail the action, though, e.g. the web UI loading the settings.
- It is unclear whether only the settings service is affected: it is the backend of all failures found so far, but
values-listis also one of the larger responses in these tests, and only responses larger than the ~4 KB that got through can be cut off visibly. - A next step could be to log, in the CI, which code closes the proxy's backend connections, e.g. by wrapping the connections of the proxy's transport and logging a stack trace on
Close().
AI assistance: Claude Code (claude-opus-5-5) analysed the CI logs and the code, tried to reproduce it, and wrote the first draft of this issue.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsPrio <= 3
Activity
test(acceptance): fail on responses that are cut off after their headers
test(acceptance): fail on responses that are cut off after their headers
[stable-9.1] prepare stable for tests (#3977)
pbleser-oc commentedon Nov 25, 2026
Possibly the same problem with a Graph response:
apiOcm/share.feature:999failed in #5772 (PR #4120) when user "Brian" lists the shares shared with him using the Graph API, withcURL error 18: transfer closed with outstanding read data remaining. The same scenario also failed in the main cron pipeline #5765.