Skip to content
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.

observed HAProxy/Redis/Sentinel error on short timeouts or disconnect #490

Merged
merged 1 commit into from
Jun 15, 2016
Merged

observed HAProxy/Redis/Sentinel error on short timeouts or disconnect #490

merged 1 commit into from
Jun 15, 2016

Conversation

andrewwolverton
Copy link
Contributor

When HAProxy timeout is set to a very short value, or when connecting directly to Redis and Redis dies, observed the following exception:

Error: Callback was already called.
at /usr/src/thing-proxy/node_modules/ponte/node_modules/async/lib/async.js:43:36
at /usr/src/thing-proxy/node_modules/ponte/lib/ponte.js:42:7
at /usr/src/thing-proxy/node_modules/ponte/node_modules/mosca/lib/persistence/redis.js:161:11
at /usr/src/thing-proxy/node_modules/ponte/node_modules/async/lib/async.js:52:16
at Object.async.forEachOf.async.eachOf (/usr/src/thing-proxy/node_modules/ponte/node_modules/async/lib/async.js:236:30)
at Object.async.forEach.async.each (/usr/src/thing-proxy/node_modules/ponte/node_modules/async/lib/async.js:209:22)
[...]

When HAProxy timeout is set to a very short value, or when connecting directly to Redis and Redis dies, observed the following exception:

Error: Callback was already called.
at /usr/src/thing-proxy/node_modules/ponte/node_modules/async/lib/async.js:43:36
at /usr/src/thing-proxy/node_modules/ponte/lib/ponte.js:42:7
at /usr/src/thing-proxy/node_modules/ponte/node_modules/mosca/lib/persistence/redis.js:161:11
at /usr/src/thing-proxy/node_modules/ponte/node_modules/async/lib/async.js:52:16
at Object.async.forEachOf.async.eachOf (/usr/src/thing-proxy/node_modules/ponte/node_modules/async/lib/async.js:236:30)
at Object.async.forEach.async.each (/usr/src/thing-proxy/node_modules/ponte/node_modules/async/lib/async.js:209:22)
[...]
@mcollina
Copy link
Collaborator

@andrewwolverton
Copy link
Contributor Author

@mcollina This version appears to be failing tests regardless of the minor change I've made here. If i revert those changes, the tests still fail for me. Thoughts?

@mcollina
Copy link
Collaborator

how does that fails? with the same reason?

@andrewwolverton
Copy link
Contributor Author

Yes, unfortunately.

  1. mosca.persistence.Redis subscriptions should load the offline client subscriptions:
    Uncaught AssertionError: expected undefined to deeply equal {}
    at test/persistence/abstract.js:348:28
    at Multi.callback (lib/persistence/redis.js:343:7)
    at multi_callback (node_modules/redis/lib/multi.js:88:14)
    at Command.callback (node_modules/redis/lib/multi.js:115:9)
    at normal_reply (node_modules/redis/index.js:714:21)
    at RedisClient.return_reply (node_modules/redis/index.js:816:9)
    at JavascriptRedisParser.Parser.returnReply (node_modules/redis/index.js:188:18)
    at JavascriptRedisParser.execute (node_modules/redis/node_modules/redis-parser/lib/parser.js:408:12)
    at Socket. (node_modules/redis/index.js:267:27)
    at readableAddChunk (_stream_readable.js:153:18)
    at Socket.Readable.push (_stream_readable.js:111:10)
    at TCP.onread (net.js:531:20)

@andrewwolverton
Copy link
Contributor Author

BTW... the bit in the test file

      this.instance.lookupSubscriptions(client, function(err, results) {
        expect(results).to.eql({});
        done();
      });

During the failure results = undefined

@mcollina
Copy link
Collaborator

Then probably it's related to one of the dep changed. Can you update the PR to handle that?

@mcollina
Copy link
Collaborator

is err set?

@andrewwolverton
Copy link
Contributor Author

Nope. No err.

err: null, results: undefined

@mcollina
Copy link
Collaborator

results can't be null because of https://github.com/mcollina/mosca/blob/master/lib/persistence/abstract.js#L103-L109.

Can you please have a look and fix that as well?

@andrewwolverton
Copy link
Contributor Author

andrewwolverton commented Jun 13, 2016

The oddness here is that https://github.com/mcollina/mosca/blob/master/lib/persistence/redis.js#L338-L344 the multi.get doesn't seem to be executing, thus resulting in a non err with an undefined response. Any clue why this would be happening?

Has all of this redis code been reworked with the pull requests that use ioredis.js instead of redis.js?

And if I explicitly check for !responses in the cb(err, responses) call, subsequent tests involving the presence of objects like:

      + expected - actual

      -{}
      +{
      +  "hello": {
      +    "qos": 1
      +  }
      +}

... fail.

It seems to be that something fundamental the tests has recently changed and caused these failures.

@mcollina
Copy link
Collaborator

something changed in the dependency tree, not in Mosca or Ascoltatori :(.

That PR will be part of v2, because it's switching to ioredis, and that needs some time for me to solve issues there. You can definitely help (we need to revert a PR that was using a lua script, see #464).

@mcollina mcollina merged commit ef7be71 into moscajs:master Jun 15, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants