Skip to content

Redis connection timeouts causing protocol errors #127

Closed

Description

@jhurliman

I have an issue where node_redis is auto-reconnecting to redis and all queries hang indefinitely afterward. This is a related issue to that, where occasionally I will see one of the hung connections terminate with these kind of errors:

9 Aug 19:04:26 - error: Redis error: Error: Redis reply parser error: Error: Protocol error, got "\n" as reply type byte
    at HiredisReplyParser.execute (.../node_modules/redis/lib/parser/hiredis.js:31:37)
    at RedisClient.on_data (.../node_modules/redis/index.js:358:27)
    at Socket.<anonymous> (.../node_modules/redis/index.js:93:14)
    at Socket.emit (events.js:64:17)
    at Socket._onReadable (net.js:678:14)
    at IOWatcher.onReadable [as callback] (net.js:177:10)

9 Aug 19:14:27 - error: Redis error: Error: Redis reply parser error: Error: Protocol error, got "r" as reply type byte
    at HiredisReplyParser.execute (.../node_modules/redis/lib/parser/hiredis.js:31:37)
    at RedisClient.on_data (.../node_modules/redis/index.js:358:27)
    at Socket.<anonymous> (.../node_modules/redis/index.js:93:14)
    at Socket.emit (events.js:64:17)
    at Socket._onReadable (net.js:678:14)
    at IOWatcher.onReadable [as callback] (net.js:177:10)

Activity

  1. pietern commented on Aug 11, 2011

    @pietern
    Contributor

    @mranney: This can be fixed by moving the initializer for this.reply_parser to the on_connect function or the "connect" callback on the socket. This also fixes #126 since it prevents more data to be pushed to a parser in an erroneous state.

  2. added a commit that references this issue on Aug 11, 2011
  3. mranney commented on Aug 11, 2011

    @mranney
    Contributor

    @jhurliman: can you please try this change and see if it fixes your issue?

  4. jhurliman commented on Aug 11, 2011

    @jhurliman
    Author

    Upgraded to the new version just now, I'll let you know how it goes.

  5. jhurliman commented on Aug 12, 2011

    @jhurliman
    Author

    Everything looks good so far, thanks!

  6. mranney commented on Aug 12, 2011

    @mranney
    Contributor

    Awesome, thanks guys. I'll roll a new version for npm with this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions