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

Failed sentinel connection doesn't report Error #445

Closed
SamBergeron opened this issue Mar 31, 2017 · 1 comment
Closed

Failed sentinel connection doesn't report Error #445

SamBergeron opened this issue Mar 31, 2017 · 1 comment

Comments

@SamBergeron
Copy link
Contributor

Hi, if I start a new connection with an array of sentinels where none are valid, no error is reported in the error listener. This is not the same behavior as with a single server connection.

Here is what I see with an invalid redis connection (or a down server) with debug enabled:

  ioredis:redis status[192.168.56.1:6379]: connecting -> close +1ms
  ioredis:connection reconnect in 400ms +0ms
  ioredis:redis status[192.168.56.1:6379]: close -> reconnecting +0ms
  ioredis:redis status[192.168.56.1:6379]: reconnecting -> connecting +400ms
  ioredis:connection error: Error: connect ECONNREFUSED 192.168.56.1:6379 +2ms
2017-03-31T15:49:03.012Z - error: Redis client error: Error: connect ECONNREFUSED 192.168.56.1:6379

The last log message being the one printed by redis.on('error', ...

Here is what I see when I have invalid (or down) sentinels

  ioredis:redis status[192.168.56.1:26379]: [empty] -> connecting +219ms
  ioredis:redis queue command[0] -> sentinel(get-master-addr-by-name,nteredis) +0ms
  ioredis:connection error: Error: connect ECONNREFUSED 192.168.56.1:26379 +2ms
  ioredis:redis status[192.168.56.1:26379]: connecting -> close +0ms
  ioredis:redis status[192.168.56.1:26379]: close -> end +0ms
  ioredis:SentinelConnector failed to connect to sentinel 192.168.56.1:26379 because Error: Connection is closed. +1ms
  ioredis:redis status[192.168.56.1:26378]: [empty] -> connecting +0ms
  ioredis:redis queue command[0] -> sentinel(get-master-addr-by-name,nteredis) +0ms
  ioredis:connection error: Error: connect ECONNREFUSED 192.168.56.1:26378 +2ms
  ioredis:redis status[192.168.56.1:26378]: connecting -> close +0ms
  ioredis:redis status[192.168.56.1:26378]: close -> end +0ms
  ioredis:SentinelConnector failed to connect to sentinel 192.168.56.1:26378 because Error: Connection is closed. +0ms
  ioredis:SentinelConnector All sentinels are unreachable. Retrying from scratch after 230 +0ms
  ioredis:redis status[localhost:6379]: end -> end +1ms

As you can see there is no log message caught in redis.on('error', ....
The mechanism work fine, if I turn the sentinels back on they will reconnect, but there is no way of knowing what is happening if DEBUG=ioredis* isn't turned on.

@SamBergeron
Copy link
Contributor Author

Possible fix with #446

luin pushed a commit that referenced this issue Apr 16, 2017
* Report error on Sentinel connection refused

* Removed duplicate line, oops

* Errors emitted instead of called back

* Spacing

* Fixed error reporting to event reporting
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

1 participant