Redis connection to xxxxxx failed - read ECONNRESET

See original GitHub issue

Please advise what info and how to obtain it, to help

Running on OpenShift Node Version: v4.2.3 Redis Server: 2.18.24 Node_Redis: 2.4.2

events.js:141
      throw er; // Unhandled 'error' event
      ^
Error: Redis connection to xxxxx.com:50681 failed - read ECONNRESET
    at exports._errnoException (util.js:874:11)
    at TCP.onread (net.js:544:26)
DEBUG: Program node build/server.js exited with code 1
DEBUG: Starting child process with 'node build/server.js'
Server is running: http://ex-std-node496.prod.rhcloud.com:8080
events.js:141
      throw er; // Unhandled 'error' event
      ^
Error: Redis connection to xxxxx.rhcloud.com:50681 failed - connect ECONNREFUSED 172.16.2.86:50681
    at Object.exports._errnoException (util.js:874:11)
    at exports._exceptionWithHostPort (util.js:897:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1063:14)
DEBUG: Program node build/server.js exited with code 1
DEBUG: Starting child process with 'node build/server.js'
Server is running: http://ex-std-node496.prod.rhcloud.com:8080
events.js:141
      throw er; // Unhandled 'error' event

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
kernellpaniccommented, Jan 27, 2021

I’m having same issue:

CLIENT: 3.0.2 REDIS: 5.0.3

  • Running within Docker / node:14.15.4-alpine3.12
  • Running Inside GCLOUD ( latency ~10ms )
  • After started, the app starts PINGING the redis server every 30 seconds
  • Server crashes after 4 minutes (usually), just after PING #8 ( PING timestamp === ERROR timestamp )
  • not a single event es registered in the log ( end, error, uncaughtException, reconnecting )
  • I’ve tried ECHO instead of PING but I got same results.
var redis__create_ping = ( client ) => {
        client.ping = setInterval(( )=>{
                let timestamp = ( new Date() ).getTime();
                client.instance.ping(  (error, pong ) => {
                        if( error ){
                                console.error( '\n<PING ERROR>', client.name, client.index );
                                console.error( error );
                        }
                        else {
                                if( __.DEBUG ){
                                        console.log( '\n<PING>', client.name, client.index, (new Date()).getTime() - timestamp );
                                }
                        };
                });
        },  30000);
};

var redis__connect = ( args , success, fail ) => {
        let { index, name } = args;
        let client = { name, index };
        let host = ___.REDIS.HOST;
        let port = ___.REDIS.PORT;
        let cli = redis.createClient({ host, port, db: index, socket_keepalive: true });
        cli.on('connect',  ready => {
                if( __.DEBUG ) console.info('\n<CONNECT>', name, index  );
                client.instance = cli;
                redis__create_ping( client );
                CLIENTS[name] = client;
                success( true );
        });

        cli.on('ready', () => {
                if( __.DEBUG ) console.info( '\n<READY>', name, index );
        });

        cli.on('reconnecting', () => {
                if( __.DEBUG ) console.info( '\n<RECONNECTING>', name, index );
        });

        cli.on('end', () => {
                if( __.DEBUG ) console.info('\n<END>', name, index  );
        });

        cli.on('uncaughtException',  error  => {
                console.error('\n<UNCAUGHT-EXCEPTION>', name, index  );
                console.error( error  );
        });

        cli.on('error', error => {
                console.error('\n<ERROR>', name, index  );
                console.error( error );
        });
};

LOG

...
2021-01-27 15:59:42.472 EST<PING> REDIS_CLIENT_BLOCKED_NUMBERS_WRITE 11 4
Default
2021-01-27 15:59:42.480 ESTevents.js:292
Default
2021-01-27 15:59:42.480 EST throw er; // Unhandled 'error' event
Default
2021-01-27 15:59:42.480 EST ^
Default
2021-01-27 15:59:42.480 EST
Default
2021-01-27 15:59:42.480 ESTError: read ECONNRESET at TCP.onStreamRead (internal/stream_base_commons.js:209:20)
Default
2021-01-27 15:59:42.480 ESTEmitted 'error' event on RedisClient instance at:
Default
2021-01-27 15:59:42.480 EST at RedisClient.on_error (/opt/app/node_modules/redis/index.js:341:14)
Default
2021-01-27 15:59:42.480 EST at Socket.<anonymous> (/opt/app/node_modules/redis/index.js:222:14)
Default
2021-01-27 15:59:42.480 EST at Socket.emit (events.js:315:20)
Default
2021-01-27 15:59:42.480 EST at emitErrorNT (internal/streams/destroy.js:106:8)
Default
2021-01-27 15:59:42.480 EST at emitErrorCloseNT (internal/streams/destroy.js:74:3)
Default
2021-01-27 15:59:42.480 EST at processTicksAndRejections (internal/process/task_queues.js:80:21) {
Default
2021-01-27 15:59:42.480 EST errno: -104,
Default
2021-01-27 15:59:42.480 EST code: 'ECONNRESET',
Default
2021-01-27 15:59:42.480 EST syscall: 'read'
Default
2021-01-27 15:59:42.480 EST}
Warning
2021-01-27 15:59:46.579 ESTContainer called exit(1).
2reactions
jalfcolombiacommented, Feb 26, 2016

Hello, I have the same problem and I have no idea how to fix it

Read more comments on GitHub >

github_iconTop Results From Across the Web

Redis connection to xxxxxx failed - read ECONNRESET #980
The first and the third error is still not handled. Are you using different client instances? And please check why you get ECONNREFUSED...
Read more >
Redis connection to x.x.x.x:6379 failed - write ECONNRESET ...
From the looks of it, ECONNRESET indicates the connection is closed by redis instance. There is no surge of traffic of any sort....
Read more >
Nodejs To Redis Econnreset Error - ADocLib
js this error ECONNRESET is when the remote connection to Node.js closes the socket unexpectedly. Are you using a proxy between Node and....
Read more >
Redis - ECONNRESET - DigitalOcean
I get this error locally after connecting to the server and doing nothing ... Redis connection to xxx:xxx failed - read ECONNRESET at...
Read more >
redis connection lost and command aborted. it might have ...
The error appears as the result of a broken connection (Your software somehow lost connection with the Redis server). It can be one...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found