Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught ECONNREFUSED exception with Bluebird #1157

Closed
ArenSH opened this issue Jun 29, 2020 · 2 comments
Closed

Uncaught ECONNREFUSED exception with Bluebird #1157

ArenSH opened this issue Jun 29, 2020 · 2 comments

Comments

@ArenSH
Copy link

ArenSH commented Jun 29, 2020

Hi, we performed some tests with cluster failover under load and got uncaught exception.

Error: connect ECONNREFUSED 172.28.1.1:6379
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
Emitted 'error' event on Socket instance at:
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '172.28.1.1',
  port: 6379
}

The problem seems to be that in some cases Redis::connect attaches error handler to stream too late after StandaloneConnector created stream.

I've reproduced this issue on Node.JS 12 with Bluebird 3.5.x. With built-in promise it seems to work, but i cannot say for sure.

In any case, current scheme with connectors and promises keeps possibility of such errors: Stream::destroy already triggers error in nextTick to give users opportunity to attach error listener. If because of promises error is attached later - we get uncaught exception.

One solution would be to attach "error" event handler in StandaloneConnector. Another would be to make stream instantiation synchronous.

@luin
Copy link
Collaborator

luin commented Jul 4, 2020

Hi @ArenSH , This should be fixed in v4.16.2 with #1095. What was the ioredis version?

@marcbachmann
Copy link
Collaborator

Let's close this. In version 5 the support for custom promise libraries also got dropped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants