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

http: guard invalid timeout values in checkConnections#64506
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 or PRs related to the http subsystem. needs-ci PRs that need a full CI run. labels Jul 14, 2026
Comment thread test/parallel/test-http-server-invalid-headers-timeout-no-abort.js Outdated

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!

@pimterry pimterry 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));

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.

@Ethan-Arrowood Ethan-Arrowood 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

@gurgunday gurgunday 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>

@gurgunday gurgunday 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

codecov Bot 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. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Jul 27, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 27, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@bjohansebas bjohansebas added commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. and removed commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Jul 27, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@pimterry pimterry added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Jul 30, 2026
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 30, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 0012a77 into nodejs:main Jul 30, 2026
82 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 0012a77

aduh95 pushed a commit that referenced this pull request Aug 3, 2026
Signed-off-by: Efe Karasakal <hi@efe.dev>
PR-URL: #64506
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Tim Perry <pimterry@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 4, 2026
Signed-off-by: Efe Karasakal <hi@efe.dev>
PR-URL: #64506
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Tim Perry <pimterry@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. http Issues or 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