You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After the server receives a signal from Shutdown(), some connections are closed and do not notify the fasthttp client about it (Do not receive the 'Connection: close' header). As a result, an error like this occurs on the client: "the server closed connection before returning the first response byte. Make sure the server returns 'Connection: close' response header before closing the connection".
Shouldn't this control the CloseOnShutdown field of fasthttp.Server?
The text was updated successfully, but these errors were encountered:
When shutting down idle connections are just closed. This is normal. Since there is no request there is also nothing to respond with Connection: close to.
The error you are getting in the client is because the client has no way of knowing if a connection is closed than trying to send something on it. In theory the fasthttp client should ignore this error when re-using an idle connection. But this hasn't been implemented yet.
Why can't the server wait until all connections are closed?
I thought this problem could be solved by implementing a Shutdown method, a piece of code that will wait until all connections are closed. If requests come through this connection (during a shutdown), it will send the “Connection: close” header. Thus: connections that are actively used will be closed by the server itself, and inactive ones will simply be closed by timeout (the server closes in the amount of time that we have allocated for the lifetime of the keep-alive connection)
Having the idle connections be closes right away or with a timeout will just give the same results. Http clients should always be able to handle idle connections being closed by the server.
CloseOnShutdown doesn't work
I have the following code
After the server receives a signal from Shutdown(), some connections are closed and do not notify the fasthttp client about it (Do not receive the 'Connection: close' header). As a result, an error like this occurs on the client: "the server closed connection before returning the first response byte. Make sure the server returns 'Connection: close' response header before closing the connection".
Shouldn't this control the CloseOnShutdown field of fasthttp.Server?
The text was updated successfully, but these errors were encountered: