-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
In my under standing, the gRPC Server closes a connection at sending the 2nd GOAWAY frame if there is no active streams.
https://github.com/grpc/grpc-go/blob/v1.53.0/internal/transport/http2_server.go#L1346-L1350
https://github.com/grpc/grpc-go/blob/v1.53.0/internal/transport/http2_server.go#L336-L342
But is there a data race between Flush() and Close() ?
Because I sometimes find the error connection rest by peer around the 2nd GOAWAY.
If some data (e.g. PING frame) is received between Flush() and Close(), the server close the connection by sending the RST packet instead of FIN packet isn't it? and an error occur at client side.
As described at
Lines 900 to 906 in 3151e83
| // 1. If the call to ss.S.Stop() causes the server's sockets to close while | |
| // there's still in-fight data from the client on the TCP connection, then | |
| // the kernel can send an RST back to the client (also see | |
| // https://stackoverflow.com/questions/33053507/econnreset-in-send-linux-c). | |
| // Note that while this condition is expected to be rare due to the | |
| // test httpServer start synchronization, in theory it should be possible, | |
| // e.g. if the client sends a BDP ping at the right time. |
I would like to know the reason that the connection is closed from the server instead of waiting for the client to close the connection after the 2nd GOAWAY.
On the other hand, the same process is followed in the case of Too Many Pings, but I do not consider that to be a problem.