1

I am getting a lot ECONNRESET

Error: socket hang up
    at connResetException (internal/errors.js:570:14)
    at Socket.socketOnEnd (_http_client.js:440:23)
    at Socket.emit (events.js:215:7)
    at endReadableNT (_stream_readable.js:1183:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)

In one of my application sending request to my microservice. Both are running into my kubernetes and calling via the internal endpoint, for example my-service.production:3026

It happens when we are sending a lot of requests from the app to the service which is performing request into mongodb.

The problem is that on the app side I only have the ECONNRESET error and nothing on the service.

Can the issue comes from the kubernetes network ? And how can I debug it ?

Ajouve
  • 9,735
  • 26
  • 90
  • 137

1 Answers1

0

With the looks of it, you are getting ECONNRESET because TCP/IP connection limit is breaching.

By default each server/machine allow 1000 TCP/IP connections. Maximum limit of connections is 65,535. You can increase these connections by following answer on this thread mongodb : Increasing max connections in mongodb

You need to increase connections limit on every server involved.

Nabeel Javed
  • 89
  • 1
  • 3
  • Thanks, but I only have around 150 connections on my mongo and this number is stable – Ajouve Dec 17 '19 at 11:02
  • `ECONNRESET` occurs when source system close connection abruptly due to unavailability of resources. – Nabeel Javed Dec 17 '19 at 11:05
  • Yes, the error is between the application and the service which are both nodejs express applications. I do not know if it comes from my service where I have no logs or the kubernetes network which is not stable – Ajouve Dec 17 '19 at 11:19
  • Kindly enable and tail logs on both applications and test with live traffic. When you start facing `ECONNREST` then run command `netstat -ant | awk '{print $6}' | sort | uniq -c | sort -n` on the source machine to see how many connections are open. This will help you debug. – Nabeel Javed Dec 17 '19 at 17:55