0

I'm using Spring Boot RestTemplate to call REST API.

On PROD, I'm getting below exception:

org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://<host>/v2/graphql": Connection reset; nested exception is java.net.SocketException: Connection reset
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:785)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:711)
    at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:602)

The request from client is reached to gateway and gateway also forwarded it to the server. Server has successfully processed the request, but the connection was reset in less than 5 secs.

These are the http configs for the RestTemplate:

connectionRequestTimeoutMs: 3000
connectTimeoutMs: 3000
readTimeoutMs: 3000
maxConnectionsTotal: 100
maxConnectionsPerRoute: 100

In total 2300 requests, only 8 requests are failed with connection reset error, but I want to understand why this is happening.

Any help would really be appreciated. Thanks in advance!

  • Hard to answer, many things could be killing your connection on the gateway end. If you are saying some requests are failing, maybe look at the different in those requests vs the other ones. Are those ones taking longer than the others that pass? – JCompetence Jun 30 '23 at 07:38
  • and you do realize the values you put for connectTimeoutMS and others are in milliseconds? So basically it means 3 seconds..... – JCompetence Jun 30 '23 at 07:40
  • Yeah, that's true - those in milliseconds. Couldn't get a way through. Added a retry and it's working so far. – Shivshankar Nagarsoge Aug 03 '23 at 13:36

0 Answers0