ECONNRESET nodejs kubernetes

12/17/2019

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
kubernetes
node.js

1 Answer

12/17/2019

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
Source: StackOverflow