1

I am running multiple services in which communicate with each other using rest API. From time to time "connection reset by peer" is returned by a service (a few times a day, not that much). If it is relevant the services are written in go using gin framework.

I had tried to read a few guides on troubleshooting this kind of issue, but most of them are targeted towards always getting this kind of errors, and I am getting them only sometimes. The services has enough resources, there should not be any kind of problems with firewall. I have also tried to "remove" the nginx reverse proxy through which these services were calling each other so that they call each other directly.

Also the only reason I know about this errors is logs from the client side. Is there a way how to log "connection reset by peer" is happening on the server side / on nginx? This would also help to me to see how many clients which are not mine are having there errors returned too.

Solution: I created a middleware that always reads and closes the request body. Apparently when the request body is not read and closed then a connection cannot be reused.

0 Answers0