In Gatling, we have a retry mechanism. This mechanism is intended to deal with situations where Gatling tries to write a request on a socket while at the other end of the wire (network is not instant, so both sides are not aware of what the other is doing), the server closes the socket. The typical use case is keep-alive timeout.
In Gatling 2, this mechanism was not very sound and could kick in while the client has already partially received the response, hence masking some server issues.
In Gatling 3 (that has a new HTTP client), we only trigger retry when we haven't received a partial response. You get a "Premature close":
- either when we've received a partial response, then the connection was closed
- or we've reach the maximum number of retries (2 by default)
I've ran some tests again and wasn't able to find an issue in our implementation.
So I suggest you use Wireshark to get some TCP dumps and check if your server indeed sends partial responses and then closes the socket.