redis / redis/node-redis

Redis could not be reconnected on Linux, but could work on Mac.

Open
#1,417 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Pending Author Input
Dominant language
TypeScript
Stars
17.6k
Forks
2k
Avg merge
2d 3h
Merged PRs (30d)
40

Description

Version: 2.7.1
Code:

       redis.createClient(redisUrl, {
        connect_timeout: 60 * 1000,
        retry_strategy: function (options) {
          if (options.error && options.error.code === 'ECONNREFUSED') {
            return new Error('The server refused the connection');
          }
          if (options.total_retry_time > 1000 * 60) {
            return new Error('Retry time exhausted');
          }
          if (options.attempt > 10) {
            return undefined;
          }
          return 60000;
        }
      })

I just expect that the node redis could detect the disconnection in 1 mins and reconnect to redis server in given time successfully when the redis server is ready, but this code dose not work on my Linux env (Ubuntu 18.04), it could work on my Mac env, so could any experts give some help?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the redis.createClient call and its retry_strategy on Ubuntu 18.04, then reproduce the Redis disconnection and compare the Linux behavior with the reported Mac behavior. Trace whether the client detects the failure and retries as configured; done means reconnecting successfully when the Redis server becomes available again.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, redis
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.