Repository navigation
http: add timeout option to server.close() - #67851
Conversation
server.close() waits indefinitely for connections that are sending a request or waiting for a response, so a single slow or stuck request keeps the server from closing. Add an optional `options` argument with a `timeout` in milliseconds to `http.Server` and `https.Server`. Connections that are still open when it elapses are destroyed with `closeAllConnections()`. Assisted-by: Claude Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
|
Review requested:
|
Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #67851 +/- ##
==========================================
+ Coverage 90.53% 90.58% +0.04%
==========================================
Files 805 802 -3
Lines 285842 286792 +950
Branches 55187 55407 +220
==========================================
+ Hits 258793 259786 +993
+ Misses 17167 17099 -68
- Partials 9882 9907 +25
🚀 New features to boost your workflow:
|
Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
Ethan-Arrowood
left a comment
There was a problem hiding this comment.
in favor of this. FYI it complements #66000 and will probably result in a conflict once that merges. Just something to be aware of.
One thing to consider is what happens when close is called twice with different timeouts?
close({ timeout: 200 });
close({ timeout: 1000 });Should this close at 200ms or at the updated 1000ms? Or should there be a different behavior?
Lastly, the commit mentions "Claude"; per our guidelines, this should be anonymized: https://github.com/nodejs/node/blob/main/doc/contributing/ai-guidelines.md#naming-ai-tools-in-disclosures
Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
I made the earliest timeout win, so your example closes at 200ms. Added a test and a line in the docs. |
In the slot run for nodejs/node#67851, the session couldn't write its probe to the slot's .claude/tmp/, though its allow rule covers the whole checkout. In dontAsk mode, Claude Code refuses writes under any .claude/ directory. A headless run confirmed it: the same write to a folder beside it worked. slot acquire now creates .review-tmp/ in the slot and adds it to the clone's info/exclude, which its worktrees share, so the folder never makes a slot dirty. The run recipes and the session rules use it. The copied-test recipe's require rewrite changes to ../test/ to match the new depth. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In the slot run for nodejs/node#67851, the session couldn't write its probe to the slot's .claude/tmp/, though its allow rule covers the whole checkout. In dontAsk mode, Claude Code refuses writes under any .claude/ directory. A headless run confirmed it: the same write to a folder beside it worked. slot acquire now creates .review-tmp/ in the slot and adds it to the clone's info/exclude, which its worktrees share, so the folder never makes a slot dirty. The run recipes and the session rules use it. The copied-test recipe's require rewrite changes to ../test/ to match the new depth. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| end. If `options.timeout` is set, connections that are still open when it | ||
| elapses are destroyed with [`server.closeAllConnections()`][], which interrupts | ||
| any request in progress. Sockets upgraded to a different protocol, such as | ||
| WebSocket or HTTP/2, are not destroyed. Calling [`server.listen()`][] again |
There was a problem hiding this comment.
Not for this PR, but this is interesting, I didn't realise that closeAllConnections doesn't close all connections!
If we're changing things, that might also be worth exploring. I find it hard to imagine a use case where you want to close the server, but not those other sockets. Would be a separate semver-major PR anyway and this can stay consistent in the meantime.
In the slot run for nodejs/node#67851, the session couldn't write its probe to the slot's .claude/tmp/, though its allow rule covers the whole checkout. In dontAsk mode, Claude Code refuses writes under any .claude/ directory. A headless run confirmed it: the same write to a folder beside it worked. slot acquire now creates .review-tmp/ in the slot and adds it to the clone's info/exclude, which its worktrees share, so the folder never makes a slot dirty. The run recipes and the session rules use it. The copied-test recipe's require rewrite changes to ../test/ to match the new depth. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In the slot run for nodejs/node#67851, the session couldn't write its probe to the slot's .claude/tmp/, though its allow rule covers the whole checkout. In dontAsk mode, Claude Code refuses writes under any .claude/ directory. A headless run confirmed it: the same write to a folder beside it worked. slot acquire now creates .review-tmp/ in the slot and adds it to the clone's info/exclude, which its worktrees share, so the folder never makes a slot dirty. The run recipes and the session rules use it. The copied-test recipe's require rewrite changes to ../test/ to match the new depth. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…46) * nodejs-review-bank: add bank.ts sweep and retire nodejs-review-queue The cleanup sweep was the last thing only the queue skill had. bank.ts sweep lists open networking PRs one label at a time, takes the oldest batch not swept yet, and splits those whose authors went quiet for 6 months into stalled targets (external authors) and collaborator-parked PRs. It measures the author's own last commit or comment, never updatedAt. sweep mark records what the user did in <bank>/sweep.json, so a PR stays out until its author pushes and then comes back as REVIVED. The judgment steps move into SKILL.md's Cleanup sweep. With that, nodejs-review-queue goes. The bank's description takes over its triggers. README, agents/claude/README.md, and nodejs-contribute point at the bank instead. The installer's prune_broken removes the dangling ~/.claude/skills/nodejs-review-queue link on the next sync. Closes #38. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * nodejs-review-bank: don't hold an approval the commit queue will land On 2026-12-02, approving nodejs/node#65343 and adding commit-queue put its entry on hold for green CI, though its dossier showed CI=SUCCESS at the head. Two causes, both in sync's landing gates: - The CI gate read only cache/ci.json, which covers cq candidates. A fresh or re-review entry never has a row there, so its CI always counted as not green. It now falls back to the dossier's ci.txt, through the same parser the tick uses. - An approval on a PR that already has commit-queue was held for the landing wait and CI. The commit queue lands it, so the entry is done. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * nodejs-review-bank: give sessions a scratch folder outside .claude In the slot run for nodejs/node#67851, the session couldn't write its probe to the slot's .claude/tmp/, though its allow rule covers the whole checkout. In dontAsk mode, Claude Code refuses writes under any .claude/ directory. A headless run confirmed it: the same write to a folder beside it worked. slot acquire now creates .review-tmp/ in the slot and adds it to the clone's info/exclude, which its worktrees share, so the folder never makes a slot dirty. The run recipes and the session rules use it. The copied-test recipe's require rewrite changes to ../test/ to match the new depth. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * nodejs-review-bank: show PRs whose stalled label the automation removed On 2026-12-02 the first sweep target was nodejs/node#52176, which I'd labeled stalled in July. github-actions removed the label about 10 hours later, so the PR stayed open, and the sweep, knowing only its own empty ledger, listed it as new. Of the 19 PRs from that pass, 4 lost the label: 2 because their authors came back, and #52176 and #56287 with no author activity at all. sweep now reads each PR's stalled label events. A PR the user labeled whose label was removed since, with the author still silent, is listed first as "re-label or close", with when and by whom. To find those anywhere in the set, it fetches details for every due PR (three GraphQL calls for 88 PRs), and --batch now limits only how many quiet PRs it shows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * nodejs-review-bank: let the sweep record a close On 2026-12-02 I closed nodejs/node#52176 from the sweep instead of labeling it stalled, and sweep mark had no way to record that. Closing is often the right call: collaborators may close PRs that aren't moving, and it's quicker for a PR whose stalled label the automation already removed once, or for spam. sweep mark <pr> closed records it. The sweep lists only open PRs, so a closed one drops out, and comes back as REOPENED if it's reopened. SKILL.md says closing is a valid outcome, and that in a review a close needs no command, since sync reads it from GitHub. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
Landed in 42a47ba |
server.close()waits forever for active connections, so one slow or stuck request keeps the server from closing.This adds a
timeoutoption, in milliseconds, toclose()onhttp.Serverandhttps.Server. Connections still open when it elapses are destroyed withcloseAllConnections().HTTP/2 servers are not covered.