Skip to content

Conversation

@amyssnippet
Copy link
Contributor

This PR fixes an issue where keepAliveTimeout and related timeout properties were undefined on Http2SecureServer instances, even when allowHTTP1: true was set.

When falling back to HTTP/1.1, the server should respect standard HTTP timeout behaviors. This change ensures these properties are initialized with their default values (matching http.Server and https.Server), preventing inconsistent behavior during HTTP/1.1 fallback.

Fixes: #59783

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/http2
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added http2 Issues or PRs related to the http2 subsystem. needs-ci PRs that need a full CI run. labels Feb 7, 2026
@codecov
Copy link

codecov bot commented Feb 7, 2026

Codecov Report

❌ Patch coverage is 64.28571% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.73%. Comparing base (3ab9dd8) to head (7adcd59).
⚠️ Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/http2/core.js 64.28% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #61713   +/-   ##
=======================================
  Coverage   89.73%   89.73%           
=======================================
  Files         675      675           
  Lines      204502   204543   +41     
  Branches    39304    39301    -3     
=======================================
+ Hits       183502   183548   +46     
+ Misses      13283    13280    -3     
+ Partials     7717     7715    -2     
Files with missing lines Coverage Δ
lib/internal/http2/core.js 95.19% <64.28%> (-0.04%) ⬇️

... and 33 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.

@amyssnippet
Copy link
Contributor Author

@ronag the PR is ready for review.
the failed macos test is flaky unrelated to my change, my changes are isolated to lib/internal/http2/core.js and test/parallel/test-http2-https-fallback-http-server-options.js, and the error comes out to be debugger related tests which is not introduced by this change.

@ronag ronag added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Feb 7, 2026
@amyssnippet
Copy link
Contributor Author

@ronag kindly rerun the failing check and also run the internal jenkins ci so that changes are verified to merge

@ronag ronag added the request-ci Add this label to start a Jenkins CI on a PR. label Feb 7, 2026
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Feb 7, 2026
@nodejs-github-bot
Copy link
Collaborator

@amyssnippet
Copy link
Contributor Author

@ronag is everything good?? all checks successfull

kindly review, if any changes then let me know

@amyssnippet amyssnippet requested a review from ronag February 8, 2026 07:25
@amyssnippet
Copy link
Contributor Author

@ronag kindly run the internal jenkins ci once again

Copy link
Member

@pimterry pimterry left a comment

Choose a reason for hiding this comment

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

I won't actively block this, but I think we should investigate more long-term general solutions to the problem, and it does look achievable to do so.

Would be interested in more opinions, especially if there's challenging edge cases I've missed.

this.keepAliveTimeoutBuffer = keepAliveTimeoutBuffer;
} else {
this.keepAliveTimeoutBuffer = 1000;
}
Copy link
Member

Choose a reason for hiding this comment

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

We've run into issues like this before with other new options like this, where they end up set only for normal HTTP/1 and not for HTTP/2 allowHttp1 (e.g. #59924).

What would happen if we called HTTP1's storeOptions here directly somehow? That would give us a single place to define the HTTP/1 options that affects both cases.

Right now we're duplicating the options logic, occasionally breaking things along the way, and creating slightly inconsistent behaviour throughout: for example this new code supports options.keepAliveTimeout if set, but we don't use options.headersTimeout in the equivalent options above - we just use a fixed default. It would be great to solve these kinds of issues permanently & consistently.

Imo: if allowHttp1 is set, we could just support all the HTTP/1 options here, in the same way as for an HTTP/1 server. Unless there's some specific case that we can't handle or that's incompatible? I can't see one.

If we want to be explicit & avoid any risk of conflicts in future, we could use separate http1Options option for this (only used with allowHttp1, so let's throw if it's used without that):

http2.createServer({
  // ...Http/2 options
  allowHttp1: true,
  http1Options: {
    keepAliveTimeout: 60_000,
    incomingMessage: ...
  }
});

We would then doc-deprecate things like options.http1IncomingMessage that mirrors HTTP/1's options.incomingMessage, as people could use options.http1Options.incomingMessage instead.

This is a bit more complicated and needs some thought & testing, but I think there's a reasonable solution that's reachable there and it would be great to stop patching the same problem over & over again.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to this. My comment above was to somehow get the two implementations closer, but in hindsight this is also tricky, because eventually another issue/PR would be raised for yet another option. Calling storeHTTPOptions would be great.

@pimterry
Copy link
Member

pimterry commented Feb 9, 2026

ronag kindly run the internal jenkins ci once again

@amyssnippet No need to individually chase people like this unless there's clearly been no progress for a week or more, please have a little patience with us! There's a minimum time before any code can be merged anyway, to leave time for people to look at it. Because the PR is marked 'author ready' everybody knows that it's already in a fairly good state, so CI will be rerun if it looks flaky, and there will be progress soon one way or the other 😃

In the meantime, if you have thoughts on my comment above that you want to share, or if you have time and energy to take a look & test whether that alternative approach works OK or causes any issues, please do.

Copy link
Member

@Qard Qard left a comment

Choose a reason for hiding this comment

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

Agreed with other comments that we should think on a way to pass through options more broadly rather than handling each individual case separately. But otherwise, LGTM.

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. http2 Issues or PRs related to the http2 subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

http2: http1 fallback missing keepAlive?

6 participants