Closed becheran closed 1 year ago
Interesting. Don't have access to a computer right now. Will have a deeper look next week.
@erikdubbelboer I did fix the TestAllocationClient
but for the next run the TestStreamBodyRequestContentLength
test failed. Though, I can't reproduce this locally and am also not sure how I could have possibly broken this? It is in the server side which I did not touch with the PR. Is this some test that is known to be flaky?
Thanks! Some tests can be flaky, especially on windows. It all looks good now.
We do use fasthttp for our project as a proxy between an uplink connection and a target. We discovered the following scenario where we run into an issue that we can't solve without a minor change to the fasthttp client.
The scenario that we have is the following:
From the upsteam connection we get a request which is replied with a steam of data from the target. All works fine using fasthttp and the customStream body. We simply copy from the target reader to the upstream writer. Now the upstream suddenly closes the TCP connection and we get an error while trying to copy our data from the target.
Now we definitelly want to close the still open connection to the target. The only thing we can do from within the handler is set
fastRequest.SetConnectionClose()
andfastResponse.SetConnectionClose()
. Though, the TCP connection will not be closed since it is too late when we set those values. The TCP connection is released and eventually re-used by the next upstream connection which would then result into an unexpected error.If the closeConn check is done again in the newCloseReader wrapper function we could set the ConnectionClose() property from the outside and the connection will be closed once we release our request handler.