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.

Error: connect ETIMEDOUT ----use bluebird

See original GitHub issue

I use bluebird replace native promise, error happened!

ioredis:redis status[172.31.15.99:5818]: [empty] -> connecting +0ms
  ioredis:redis queue command[172.31.15.99:5818]: 2 -> set([ 'aaa', '1' ]) +5ms
  ioredis:connection error: Error: connect ETIMEDOUT +0ms
redisClient connect to db error: { Error: connect ETIMEDOUT
    at Socket.<anonymous> (/opt/project/umichat/umichat_manage/node_modules/_ioredis@4.14.1@ioredis/built/redis/index.js:282:31)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:106:13)
    at Socket.emit (events.js:208:7)
    at Socket._onTimeout (net.js:422:8)
    at ontimeout (timers.js:498:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:290:5) errorno: 'ETIMEDOUT', code: 'ETIMEDOUT', syscall: 'connect' }
  ioredis:redis status[172.31.15.99:5818]: connecting -> close +10s
  ioredis:connection reconnect in 50ms +3ms
  ioredis:redis status[172.31.15.99:5818]: close -> reconnecting +1ms
  ioredis:redis status[172.31.15.99:5818]: reconnecting -> connecting +50ms

envriment:

node: v8.16.0
redis server: 5.0.5
ioredis: 4.14.1
bluebird: 3.5.5

my test code

const bluebird = require('bluebird');
global.Promise = bluebird;
const Redis = require('ioredis');

const instance = new Redis({
  port: 6379,
  host: 'localhost',
  db: 2,
});

instance.on('error', e => {
  console.error(`redisClient connect to db error:`, e);
});

instance.set("aaa", 1)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:19 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
luincommented, Apr 4, 2020

@alavers I’d think we can check if stream has already connected before attaching the listener to connect event (https://github.com/luin/ioredis/blob/master/lib/redis/index.ts#L307) so can be:

if (isConnected(stream)) {
  process.nextTick(eventHandler.connectHandler(_this))
} else {
  stream.once(CONNECT_EVENT, eventHandler.connectHandler(_this));
}

Not sure if Node.js provides enough APIs for the isConnected method.

1reaction
imatlopezcommented, Apr 3, 2020

you can tell whether a function wants a callback by the length of that function, no need to break the promise contract now

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: connect ETIMEDOUT ----use bluebird - Bountysource
I use bluebird replace native promise, error happened! ioredis:redis status[172.31.15.99:5818]: [empty] -> connecting +0ms ioredis:redis ...
Read more >
Error: connect ETIMEDOUT when scraping - node.js
Well ETIMEDOUT means something couldn't keep up with the pace you were throwing at it. You will have to slow down the number...
Read more >
Unexpected error timeout, after running serverless
I have some issues with serverless & sequelize. After I'm running serverless offline on my local computer, I always get error like below....
Read more >
trouble with npm dependencies, doesn't seem to use Nexus ...
trouble with npm dependencies, doesn't seem to use Nexus for deps. 756 views ... npm WARN retry will retry, error on last attempt:...
Read more >
[Solved]-Error: connect ETIMEDOUT when scraping-mongodb
As discussed in comments, if you want to control the max number of requests that are in-flight at the same time, you can...
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