Skip to content

Errors from the redis library are ignored #12

@olivierkaisin

Description

@olivierkaisin

Hi!

We are currently using the library and we experience critical issues with it. Sometimes , due to network errors, our redis server becomes unreachable for a small amount of time, creating errors such as:

17 Dec 15:44:57 - Error: Redis connection to redisx.mdx2mz.0001.use1.cache.amazonaws.com:6379 failed - connect ETIMEDOUT
    at RedisClient.on_error (/var/www/app/node_modules/redis/index.js:189:24)
    at Socket.<anonymous> (/var/www/app/node_modules/redis/index.js:95:14)
    at Socket.EventEmitter.emit (events.js:95:17)
    at net.js:441:14

After some investigation we realised that most errors from the redis library are ignored and that there's no handler for the default error event of both this._redis and this._subscriber.

Also, in most callbacks, the error event is ignored, being an open door to unhandled exceptions.

i.e. In the following, when error is defined, clients isn't:

var notify = function(error, clients) {
  clients.forEach(function(clientId) {
    var queue = self._ns + '/clients/' + clientId + '/messages';

    self._server.debug('Queueing for client ?: ?', clientId, message);
    self._redis.rpush(queue, jsonMessage);
    self._redis.publish(self._messageChannel, clientId);

    self.clientExists(clientId, function(exists) {
      if (!exists) self._redis.del(queue);
    });
  });
};

Throwing TypeError: Cannot call method 'forEach' of undefined.

Hope we can help to get this fixed. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions