Skip to content

http: guard invalid timeout values in checkConnections - #64506

Merged
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
efekrskl:fix/invalid-headers-timeout-abort
Jul 30, 2026
Merged

nodejs-github-bot merged 2 commits into
nodejs:mainfrom
efekrskl:fix/invalid-headers-timeout-abort

Conversation

@efekrskl

Copy link
Copy Markdown
Member

Fixes #49324

Signed-off-by: Efe Karasakal <hi@efe.dev>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added http Issues and PRs related to the http subsystem. needs-ci PRs that need a full CI run. labels Jul 14, 2026

server.listen(0, '127.0.0.1', () => {
setTimeout(() => {
server.close(() => process.exit(0));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not just check whether .close() has been called? And that way we avoid the child part

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Because the buggy behaviour crashes the whole process at native level, so the JS assertion wouldn't run

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree with @bjohansebas, I don't think we need this extra dance. This could just make normal assertions - if it crashes that will be a clear failure anyway. The example below is a test that is supposed to crash (god knows why, I'm not going to dig there) which needs the wrapper to turn the crash into success.

For things that shouldn't crash at all, we can just keep it simple and the test harness will handle & report non-zero exits as test failures for us. It won't fail the whole run, every test runs in a separate process.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok, all reviewers disagree with me and I'm not willing to die on this hill 😅

Jokes aside, fair points, I've updated the test. Thanks both!

ghost left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Actual fix looks perfectly reasonable, but I do think the test is doing a bunch of work it doesn't need to.


server.listen(0, '127.0.0.1', () => {
setTimeout(() => {
server.close(() => process.exit(0));

ghost Jul 21, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree with @bjohansebas, I don't think we need this extra dance. This could just make normal assertions - if it crashes that will be a clear failure anyway. The example below is a test that is supposed to crash (god knows why, I'm not going to dig there) which needs the wrapper to turn the crash into success.

For things that shouldn't crash at all, we can just keep it simple and the test harness will handle & report non-zero exits as test failures for us. It won't fail the whole run, every test runs in a separate process.

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

agree with other reviews. nice fix

ghost left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fix lgtm

Signed-off-by: Efe Karasakal <hi@efe.dev>

ghost left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@codecov

ghost commented Jul 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.14%. Comparing base (3ac95f2) to head (13f9c80).
⚠️ Report is 160 commits behind head on main.

Files with missing lines Patch % Lines
lib/_http_server.js 77.77% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64506      +/-   ##
==========================================
- Coverage   90.23%   90.14%   -0.10%     
==========================================
  Files         741      743       +2     
  Lines      241692   242415     +723     
  Branches    45541    45656     +115     
==========================================
+ Hits       218097   218521     +424     
- Misses      15113    15393     +280     
- Partials     8482     8501      +19     
Files with missing lines Coverage Δ
lib/_http_server.js 96.65% <77.77%> (+0.15%) ⬆️

... and 127 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gurgunday gurgunday added request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. author ready PRs with CI started, the required approvals, and no outstanding review comments. labels Jul 27, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Jul 27, 2026
@nodejs-github-bot

ghost commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

@bjohansebas bjohansebas added commit-queue-squash PRs the Commit Queue should land as one squashed commit. and removed commit-queue-squash PRs the Commit Queue should land as one squashed commit. labels Jul 27, 2026
@nodejs-github-bot

ghost commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

@pimterry pimterry added commit-queue PRs queued for automated landing through the Commit Queue. commit-queue-squash PRs the Commit Queue should land as one squashed commit. labels Jul 30, 2026
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Jul 30, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 0012a77 into nodejs:main Jul 30, 2026
@nodejs-github-bot

ghost commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Landed in 0012a77

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

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue-squash PRs the Commit Queue should land as one squashed commit. http Issues and PRs related to the http subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node_http_parser.cc:1096:static void node::{anonymous}::ConnectionsList::Expired with NodeJS v18.17.0

8 participants