-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.28.1, but 5 is the same
Plugin version
No response
Node.js version
20.15.1
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
debian-slim
Description
We had slight downtime when we are trying to restart our prod server. After checking source code and documentation I found a mismatch. Fastify calls server.close() only, but it is not enough according to Node.js docs:
server.close([callback])#
...Stops the server from establishing new sessions. This does not prevent new request streams from being created due to the persistent nature of HTTP/2 sessions. To gracefully shut down the server, call http2session.close() on all active session
Link to code that reproduces the bug
Stackblitz does not work well with http2 streams, so it runs only locally:
https://stackblitz.com/edit/stackblitz-starters-gmr7aj?file=index.js
Expected Behavior
Fastify needs to list all active sessions and close them as well