-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
Add ability to force close persistent connections #41578
Labels
feature request
Issues that request new features to be added to Node.js.
http
Issues or PRs related to the http subsystem.
Comments
jsumners
added
the
feature request
Issues that request new features to be added to Node.js.
label
Jan 18, 2022
cc: @mcollina |
cc @nodejs/http |
This was referenced Jan 18, 2022
Merged
RafaelGSS
pushed a commit
that referenced
this issue
May 10, 2022
Fixes: #41578 PR-URL: #42812 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
feature request
Issues that request new features to be added to Node.js.
http
Issues or PRs related to the http subsystem.
What is the problem this feature will solve?
As noted in https://nodejs.org/dist/latest-v16.x/docs/api/net.html#serverclosecallback, a
net.Server
will not fully close until all persistent (keep-alive) connections have reached the end of their timeout. In other languages/frameworks, e.g. Java, C#, or PHP, this is not a problem because applications written with them are typically hosted within a dedicated HTTP server that will deal with this on the application's behalf. However, if we look at another language in which applications are typically written to provide a direct HTTP server we can see that this problem showed up there and has been solved -- golang/go#4674 (comment) (final resolution https://go.dev/doc/go1.8#http_shutdown):What is the feature you are proposing to solve the problem?
I propose that Node.js internally track persistent connections and provide a method to forcefully close them.
What alternatives have you considered?
We have implemented a, what I would call hacky, solution for this in Fastify -- fastify/fastify#3619
The hope is that if Node.js internalizes it, it can be more performant.
The text was updated successfully, but these errors were encountered: