net/http: remote end of long POST request randomly closes when using http2 #65426
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Go version
go1.20.5
Output of
go env
in your module/workspace:What did you do?
I have two applications where the client application makes a HTTP/2 POST request to a server application.
The request is kept open permanently, effectively creating a bidirectional socket. In our case the client application continuously reads JSONL from the response body.
The server application receives the request and occasionally (just a couple times per day) writes some JSONL to the response body.
Equivalent code for the client application:
Equivalent code for the server application:
What did you see happen?
The two applications are able to communicate fine for hours/days/weeks but every now and then the response body becomes closed on the server for unknown reasons, resulting in
short write
errors.I've tried to debug the issue by logging reads with
io.TeeReader
and writes withio.MultiWriter
. The logs show that writes are attempted. JSONL is in fact sent over the wire as confirmed withtcpdump
(even with SSL encryption, large blobs of data are easy to spot) despiteshort write
errors. My guess is that only part of the JSONL is written, explaining the errors I am seeing.However, none of the bytes appearing on the wire are read by the client, nothing shows up in the log and reads never return EOF. This means the client will patiently wait forever, oblivious of the fact that something is wrong.
Is there some built-in timeout I'm not aware of?
What did you expect to see?
For the applications to continue talking to each other.
The text was updated successfully, but these errors were encountered: