💬 Question here
I have implemented a graceful shutdown, which is waiting for fastify.close() to be executed gracefully.
Because close() does not terminate before a certain timeout when keep-alive connections were made before, my graceful shutdown is not working.
So I added forceCloseConnections: true to the config. Now close() does no longer wait and everything is fine.
HOWEVER my oAuth now breaks the browser session.
To reproduce to break the session:
The browser sends some 'keep-alive' requests to fastify, they all work fine.
The browser then does an oAuth, is redirected to Google for example.
At the end, the browser now comes back, and from that moment on, fastify alway sends no matter what route:
{
error: "Bad Request",
message: "Client Error",
statusCode: 400
}
Opening a second window does also not work. Opening a new window in incognito mode works.
So my assumption is the browser is still trying to use same the keep-alive connection, before it did the oAuth.
During the oAuth fastify is loosing then the reference to this connection, when browser now comes back, the connection is completely broken, and fastify is no longer able to handle ANY request for that connection, because it can no longer associate the request the right keep-alive connection...
I also tried to increase keepAliveTimeout but it did not affect anything...
Your Environment
- fastify version: >=3.29.0
💬 Question here
I have implemented a graceful shutdown, which is waiting for fastify.close() to be executed gracefully.
Because
close()does not terminate before a certain timeout when keep-alive connections were made before, my graceful shutdown is not working.So I added
forceCloseConnections: trueto the config. Nowclose()does no longer wait and everything is fine.HOWEVER my oAuth now breaks the browser session.
To reproduce to break the session:
The browser sends some 'keep-alive' requests to fastify, they all work fine.
The browser then does an oAuth, is redirected to Google for example.
At the end, the browser now comes back, and from that moment on, fastify alway sends no matter what route:
{ error: "Bad Request", message: "Client Error", statusCode: 400 }Opening a second window does also not work. Opening a new window in incognito mode works.
So my assumption is the browser is still trying to use same the keep-alive connection, before it did the oAuth.
During the oAuth fastify is loosing then the reference to this connection, when browser now comes back, the connection is completely broken, and fastify is no longer able to handle ANY request for that connection, because it can no longer associate the request the right keep-alive connection...
I also tried to increase
keepAliveTimeoutbut it did not affect anything...Your Environment