Skip to content

CLDSRV-1119: Test connection release after a data backend error during an upload - #6418

Draft
fredmnl wants to merge 1 commit into
development/9.4from
bugfix/CLDSRV-1119/test-connection-release-after-data-error
Draft

fredmnl wants to merge 1 commit into
development/9.4from
bugfix/CLDSRV-1119/test-connection-release-after-data-error

Conversation

@fredmnl

@fredmnl fredmnl commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Fixes CLDSRV-1119, part of S3C-11764.

When the data backend fails mid-upload (for example sproxyd closing a reused connection), cloudserver sends the error response with the request body only partially read. On node before 22.18.0 / 24.3.0, the body data parsed after the response cancels the keep-alive timer, and nothing ever closes the connection (nodejs/node#58178). The sockets then pile up until cloudserver restarts.

This branch already runs node 22.23.4, which has the fix. This PR adds a unit test, so that a regression, or an image back on an older node, is caught:

  • a real HTTP server from S3Server._startServer, with a short keepAliveTimeout to keep the test fast;
  • the data backend put stubbed to fail with EPIPE on the first write;
  • the client sends 1 KB of a 1 MB body; the test checks that the server closes the connection within 5 s, that the client got the 500, and that the data backend was called.

It passes on node 22.23.4 (about 1.1 s) and fails on node 22.14.0 ("connection still open after 5000ms").

…g an upload

When the data backend fails mid-upload, cloudserver sends the error response
with the request body only partially read. Node before 22.18.0 / 24.3.0 then
never closes the connection (nodejs/node#58178). Cover that the connection is
closed after the error response is sent.
@bert-e

bert-e commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Hello fredmnl,

My role is to assist you with the merge of this
pull request. Please type @bert-e help to get information
on this process, or consult the user documentation.

Available options
name description privileged authored
/after_pull_request Wait for the given pull request id to be merged before continuing with the current one.
/bypass_author_approval Bypass the pull request author's approval ⭐
/bypass_build_status Bypass the build and test status ⭐
/bypass_commit_size Bypass the check on the size of the changeset TBA ⭐
/bypass_incompatible_branch Bypass the check on the source branch prefix ⭐
/bypass_jira_check Bypass the Jira issue check ⭐
/bypass_peer_approval Bypass the pull request peers' approval ⭐
/bypass_leader_approval Bypass the pull request leaders' approval ⭐
/bypass_source_branch_lineage Bypass the cross-branch contamination check ⭐
/approve Instruct Bert-E that the author has approved the pull request. ✍️
/create_pull_requests Allow the creation of integration pull requests.
/create_integration_branches Allow the creation of integration branches.
/no_octopus Prevent Wall-E from doing any octopus merge and use multiple consecutive merge instead
/unanimity Change review acceptance criteria from one reviewer at least to all reviewers
/wait Instruct Bert-E not to run until further notice.
Available commands
name description privileged
/help Print Bert-E's manual in the pull request.
/status Print Bert-E's current status in the pull request.
/clear Remove all comments from Bert-E from the history TBA
/retry Re-start a fresh build TBA
/build Re-start a fresh build TBA
/force_reset Delete integration branches & pull requests, and restart merge process from the beginning.
/reset Try to remove integration branches unless there are commits on them which do not appear on the source branch.

Status report is not available.

@bert-e

bert-e commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Incorrect fix version

The Fix Version/s in issue CLDSRV-1119 contains:

  • None

Considering where you are trying to merge, I ignored possible hotfix versions and I expected to find:

  • 9.4.24

  • 9.5.14

  • 9.6.4

  • 9.7.0

Please check the Fix Version/s of CLDSRV-1119, or the target
branch of this pull request.

await new Promise(resolve => req.once('close', resolve));
clearTimeout(deadline);

assert(Date.now() - start < closeDeadlineMs, `connection still open after ${closeDeadlineMs}ms`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check depends on timer accuracy. When the deadline timer is what closes the connection, Date.now() - start is about 5000 and can read as 4999: start is taken before req.write, and setTimeout and Date.now() use different clocks. The test would then pass in exactly the regression it is meant to catch. Set a flag in the deadline callback and assert on that instead, e.g. const deadline = setTimeout(() => { timedOut = true; req.destroy(); }, closeDeadlineMs);, then:

Suggested change
assert(Date.now() - start < closeDeadlineMs, `connection still open after ${closeDeadlineMs}ms`);
assert(!timedOut, `connection still open after ${closeDeadlineMs}ms`);

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants