Skip to content

"Implementing Reconnect on Error" example in README causes a connection leak #255

@koby08

Description

@koby08

Hi,

It seems that the "Implementing Reconnect on Error" section in the official docs for this client contains a bad example. If someone runs this example, each time it reconnects, the old connection will remain open. This will cause a connection leak to redis server.

The reason for this leak is that in each reconnect attempt Redis.createClient() is called, but without closing the old one. Please notice that calling client.close() won't help as well, because it is an instance of a connection from the connection pool.

In order to fix this, you need to call close() on the instance returned from Redis.createClient() - which will close the connection pool.

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