-
Notifications
You must be signed in to change notification settings - Fork 28.8k
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
http.server.close()
closes idle connections since 18.19.0
#51677
Comments
The commit in main branch is correct, but the backport is not. |
http.server.close()
closes open connections since 18.19.0http.server.close()
closes idle connections since 18.19.0
seems like it's same as. #52330 |
CC: @bnoordhuis |
Correcting the nodejs#50194 backporting mistake. server.closeIdleConnections shouldn't be called while server.close in node v18. This behavior is for node v19 and above. fixes: nodejs#52330, nodejs#51677,
Correcting the nodejs#50194 backporting mistake. closeIdleConnections shouldn't be called while server.close in node v18. This behavior is for node v19 and above. fixes: nodejs#52330, nodejs#51677,
….\n Correcting the nodejs#50194 backporting mistake.\n closeIdleConnections shouldnot be called while server.close in node v18.\n This behavior is for node v19 and above.\n fixes: nodejs#52330, nodejs#51677
Correcting the nodejs#50194 backporting mistake. closeIdleConnections shouldnot be called while server.close in node v18. This behavior is for node v19 and above. fixes: nodejs#52330, nodejs#51677
Correcting the nodejs#50194 backporting mistake. closeIdleConnections shouldnot be called while server.close in node v18. This behavior is for node v19 and above. fixes: nodejs#52330, nodejs#51677
Correcting the nodejs#50194 backporting mistake. closeIdleConnections shouldnot be called while server.close in node v18. This behavior is for node v19 and above. fixes: nodejs#52330, nodejs#51677
Awesome, thanks for the fix that will presumably be released with the next Node 18 version. 🎉 Does anyone know if/how one can implement a robust graceful shutdown with Node 19+? Right now we're doing something like: const server = new http.Server(...);
server.closeIdleConnections = () => undefined; to avoid |
This should be fixed in Node.js 18.20.3. |
Version
18.19.0
Platform
Linux, Mac, Windows
Subsystem
No response
What steps will reproduce the bug?
Works as expected with Node 18.18.2:
Second request fails on Node 18.19.0 because all idle connections are closed:
How often does it reproduce? Is there a required condition?
We upgraded to Node 18.19.0 (from 18.18.2) and saw our test fail that tests graceful shutdown. This tests sends a request before (with keepalive set) and after the
http.Server
is closed to ensure that all requests will be answered and there will be no HTTP or socket errors.In the docs it is also explicitly stated that the
http.server.close()
only stops the server from accepting new connections but not terminating open ones.What is the expected behavior? Why is that the expected behavior?
The expected behavior ist that calling
http.server.close()
does not terminate idle connections. Maybe closing (idle) connections should be configurable via an options parameter.What do you see instead?
http.server.close()
callshttp.server.closeIdleConnections()
which will terminate all idle connections.Additional information
We think we found the commit that introduced this behavior.
Commit on main: bd7a808 (only extracts a function)
Commit on tag 18.19.0: 2969722 (adds the
.closeIdleConnections()
call)The text was updated successfully, but these errors were encountered: