Hey :slightly_smiling_face: I am getting `java.io....
# ktor
s
Hey 🙂 I am getting
java.io.IOException: Connection reset by peer
from Netty for all my requests that were answered with a 200. I understand that the client closed the connection, but why is then an exception thrown? Did somebody experience this before ?
s
I think the exception is thrown because there was an IO problem. It's possible that the client closed connection on purpose. It's also possible that many different things happened, including unplugging a cable or losing electricity. I had all the cases and then I saw this exception. So I think it's perfectly fine that it's there. On production servers when I don't control all the clients, I have no idea if they closed the client, refreshed the page, or we have a huge network problem.
s
What happened on client's side? Could it be a case when response with 200 does NOT contain a body and perhaps some REST-like client tried to read body - just because client's author expects that responses without body should have 204 status. In general, 'reset by peer' means that client dropped connection (e.g. via shutdown syscall) instead of graceful closing. It could be also a kind of TCP optimization if client needs to operate with huge number of connections (because gracefully closed connection holds local port busy longer that 'dropped' one).
s
hey, thanks guys for your explainations. So actually between the client and the ktor application is HAProxy that seems to close the connection after the „timeout connect 20s“. The client sets the header: Connection: keep-alive. That would explain the behavior. I still need to figure out what is the most performant setting (maybe „connection: close“ )