-
-
Notifications
You must be signed in to change notification settings - Fork 34.7k
http2: initialize keepAliveTimeout and keepAliveTimeoutBuffer when allowHTTP1 is true #61713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Review requested:
|
56e86bb to
0efefc1
Compare
Codecov Report❌ Patch coverage is
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
🚀 New features to boost your workflow:
|
|
@ronag the PR is ready for review. |
|
@ronag kindly rerun the failing check and also run the internal jenkins ci so that changes are verified to merge |
|
@ronag is everything good?? all checks successfull kindly review, if any changes then let me know |
|
@ronag kindly run the internal jenkins ci once again |
pimterry
left a comment
There was a problem hiding this 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; | ||
| } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
@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. |
Qard
left a comment
There was a problem hiding this 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.
This PR fixes an issue where
keepAliveTimeoutand related timeout properties wereundefinedonHttp2SecureServerinstances, even whenallowHTTP1: truewas 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.Serverandhttps.Server), preventing inconsistent behavior during HTTP/1.1 fallback.Fixes: #59783