Skip to content

Duplicate concurrent socket reconnects after connection is lost #2186

Closed
@TVrijdag

Description

@TVrijdag

Hi there, I've encountered an issue with the reconnect behaviour whenever a client (with active subscription(s)) loses its connection with the server. For instance, when the server shuts down manually.

I've managed to trace it back to #onSocketError which may try to reconnect more than once if called again when #createSocket succeeded while reconnecting. Once the duplicate sockets successfully connect again the client becomes unstable and behaves unreliable.

Validating whether #isReady is true before calling #connect in onSocketError seems to fix the problem, but I'm not sure whether this is a proper change as I'm not familiar with the codebase.

Environment:

  • Node.js Version: v17.9.0
  • Redis Server Version: v7.0.2
  • Node Redis Version: v4.2.0
  • Platform: Windows 11

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