question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with Connection resets and Time outs.

See original GitHub issue
var http = require('http'),
    Redis = require('ioredis'),
    redis = new Redis({host: '<Snipe>', password: '<Snipe>'});

http.createServer(function(request, response) {
     response.writeHead(200, {'Content-Type': 'text/plain'});
     redis.hget('player:3064ce58-a05d-4783-86aa-c700b3e9fc66', 'Rank', function (err, result) { response.end(result); });
}).listen(4546);

process.on('uncaughtException', function(ex) {console.log(ex.stack());});
console.log('SERVER IS NOW ON! :3');

Node logs:

1|server | SERVER IS NOW ON! :3

[STREAMING] Now streaming realtime logs for [all] processes 1|server | [ioredis] Unhandled error event: Error: read ECONNRESET 1|server | at exports._errnoException (util.js:1036:11) 1|server | at TCP.onread (net.js:564:26) 3|server | [ioredis] Unhandled error event: Error: read ECONNRESET 3|server | at exports._errnoException (util.js:1036:11) 3|server | at TCP.onread (net.js:564:26) 2|server | [ioredis] Unhandled error event: Error: read ECONNRESET 2|server | at exports._errnoException (util.js:1036:11) 2|server | at TCP.onread (net.js:564:26) 1|server | [ioredis] Unhandled error event: Error: read ETIMEDOUT 1|server | at exports._errnoException (util.js:1036:11) 1|server | at TCP.onread (net.js:564:26) 3|server | [ioredis] Unhandled error event: Error: read ETIMEDOUT 3|server | at exports._errnoException (util.js:1036:11) 3|server | at TCP.onread (net.js:564:26)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
vhung92commented, Oct 31, 2016

I also recently stumbled upon this issue when trying to connect to remote redis instances, here are the logs from node:

DEBUG=ioredis:* node test.js
ioredis:redis status[localhost:6379]: [empty] -> connecting +0ms
ioredis:redis status[<sentinel-host-1>:26379]: [empty] -> connecting +4ms
ioredis:redis queue command[0] -> sentinel(get-master-addr-by-name,redis) +4ms
ioredis:redis queue command[0] -> set(cache:documents:hello,world) +1ms
ioredis:redis status[<sentinel-host-1>:26379]: connecting -> connect +64ms
ioredis:redis status[<sentinel-host-1>:26379]: connect -> ready +1ms
ioredis:connection send 1 commands in offline queue +0ms
ioredis:redis write command[0] -> sentinel(get-master-addr-by-name,redis) +1ms
ioredis:redis write command[0] -> sentinel(sentinels,redis-staging) +61ms
ioredis:SentinelConnector adding sentinel <sentinel-internal-ip-1>:26379 +64ms
ioredis:SentinelConnector adding sentinel <sentinel-internal-ip-2>:26379 +0ms
ioredis:SentinelConnector sentinels +0ms [ { host: '<host>'26379 port: 26379 },
{ host: <sentinel-host-2>, port: 26379 },
{ host: <sentinel-host-3>, port: 26379 },
{ host: '<sentinel-internal-ip-1>', port: 26379 },
{ host: '<sentinel-internal-ip-2>', port: 26379 } ]
ioredis:redis status[<host>:26379]: ready -> close +77ms
ioredis:connection skip reconnecting since the connection is manually closed. +0ms
ioredis:redis status[<host>:26379]: close -> end +0ms
ioredis:connection error: Error: connect ETIMEDOUT +3s
[ioredis] Unhandled error event: Error: connect ETIMEDOUT
  at Socket.<anonymous> (<path>/node_modules/ioredis/lib/redis.js:287:21)
  at Socket.g (events.js:260:16)
  at emitNone (events.js:67:13)
  at Socket.emit (events.js:166:7)
  at Socket._onTimeout (net.js:332:8)
  at _runOnTimeout (timers.js:524:11)
  at _makeTimerTimeout (timers.js:515:3)
  at Timer.unrefTimeout (timers.js:584:5)

I am able to connect to a single instance (with port 6379 ) and execute commands using ioredis but not the sentinels, although I can connect to the sentinels using medis, any idea what the problem could be?

1reaction
luincommented, Oct 7, 2016

It seems to be a network problem. Are you able to connect to your redis instance via redis-cli?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Article: Connection Timeout/Connection Reset
Connection Timeouts / Resets happen when a message from a sending endpoint fails to get to the destination server.
Read more >
How To Fix “Connection Reset By Peer” Error
The “Connection reset by peer” error occurs during a network connection when the other end or server ... Low timeout period for connection....
Read more >
11 Ways to Fix the ERR_CONNECTION_TIMED_OUT Error
When your internet connection times out and you can't access a specific webpage, it's one of the most annoying errors.
Read more >
How to Get to the Bottom of Network Timeout Issues
Based on the basic idea, first check the ECS instance and link for packet loss from the monitoring. The result shows that no...
Read more >
The Connection Has Timed Out How To Fix It Tutorial - YouTube
The Connection Has Timed Out -- How To Fix It [Tutorial].A server connection timeout means that a server is taking too long to...
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