Read TCP error - request failed


do someone know what this error means? On the server side, we can see that the hardware resources are not even close to fully utilized. As it states, the connection was closed by the remote host.

WARN[0569] Request Failed error=“Get https://baseURL/endpoint: read tcp ClientIP:Port->ServerIP:443: wsarecv: An existing connection was forcibly closed by the remote host.”

Hi niklasbae,

Are you using docker on windows, because another user reported this and this was the only explanation I could come up … although you should know that

  1. I haven’t used windows in years
  2. The other user didn’t report back whether they actually managed to fix it or even if they truly used docker :smiley:

So please if this is the problem and you managed to fix it somehow, tell us :smiley:

1 Like

I saw that, but unfortunately I’m not using Docker :frowning_face:

I think priority 1 is to figure out if this is a client issue, which is caused by setup, k6 or some other thing not related to the system/host under test. I am running all the load from the same server right now, it has a lot of resources:)

Hi @niklasbae,

I went on a bit of an adventure trying to figure out if this is something that k6 is at fault with and - I dunno … I don’t have a windows machine and Golang (the language in which k6 is written) has windows support which was contributed and so AFAIK no of the main developers/contributers really uses it. But even so we have a lot of users using it on windows and even I have tried it in a VM - it works …

This particular error has been discussed some amount of times because they would have test under windows failing for no reason. And given this blog post the specific thing in some of the cases where their tests fail is really just a reality of how TCP works and how they use it, or so it seems - this looks really hairy.

So I did try to reproduce something similar under Linux, as it shouldn’t really matter, but unfortunately(or not), I haven’t been able (although I got some cool numbers testing out).
In my particular example between two different systems I do manage to saturate my 1gbps network connection between them with 0 errors, if I increase http2_max_requests to something above 1000, as otherwise I hit it pretty easy. If I move my nginx on the same machine I do get 10gbps+ of traffic with thousands 10-37k RPS, depending on the file size being served.

But in all of the above cases you should be seeing some … very small percentage of errors. Like the thing that I tried to reproduce is somekind of racy behaviour and the limit on http2 request over a given connection is generally pretty big.

From everything I have found so far if you are seing more then 1 error in thousand requests you are dealing with some firewall/ network misconfiguration that either blocks or limits the amount of connections/traffic between the load generator and the system under test.
There were a couple of reports of antivirus programs getting in the way as well, but what exactly happens in your case - I have no clue.
I guess you can use wireshark to try and debug the connections? Although I don’t know what you really want to be looking for … maybe sending data after a close frame on an http2 connection?

1 Like

Hi @niklasbae,

When did you encounter this error in the load testing (at start of the load test or during constant duration)? 

Even, I encountered the same error ( “wsarecv: An existing connection was forcibly closed by the remote host.”) and I have resolved it


how was this resolved?

1 Like