redis / redis/node-redis

total_retry_time is not "time since last connect"

Open
#1,421 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

  • Version: 2.8.0
  • Platform: NodeJS 11.12 on Windows 10
  • Description:
    total_retry_time is not "time since last connect", it's just total time of waiting for retry, time from connect to timeout was ignored.

Here is my log with real time and time passed to retry_strategy:

{"name":"App","hostname":"Desktop","pid":28432,"level":50,"msg":"[RedisClient] Redis losted connection, time since last connect: 0 { attempt: 1,\n  error:\n   { Error: Redis connection to redis:6379 failed - connect ETIMEDOUT 192.168.31.25:6379\n       at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1083:14)\n     errno: 'ETIMEDOUT',\n     code: 'ETIMEDOUT',\n     syscall: 'connect',\n     address: '192.168.31.25',\n     port: 6379 },\n  total_retry_time: 0,\n  times_connected: 0 }","time":"2019-03-18T08:25:38.402Z","v":0}
{"name":"App","hostname":"Desktop","pid":28432,"level":50,"msg":"[RedisClient] Redis losted connection, time since last connect: 10 { attempt: 2,\n  error:\n   { Error: Redis connection to redis:6379 failed - connect ETIMEDOUT 192.168.31.25:6379\n       at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1083:14)\n     errno: 'ETIMEDOUT',\n     code: 'ETIMEDOUT',\n     syscall: 'connect',\n     address: '192.168.31.25',\n     port: 6379 },\n  total_retry_time: 10,\n  times_connected: 0 }","time":"2019-03-18T08:25:59.424Z","v":0}
{"name":"App","hostname":"Desktop","pid":28432,"level":50,"msg":"[RedisClient] Redis losted connection, time since last connect: 20 { attempt: 3,\n  error:\n   { Error: Redis connection to redis:6379 failed - connect ETIMEDOUT 192.168.31.25:6379\n       at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1083:14)\n     errno: 'ETIMEDOUT',\n     code: 'ETIMEDOUT',\n     syscall: 'connect',\n     address: '192.168.31.25',\n     port: 6379 },\n  total_retry_time: 20,\n  times_connected: 0 }","time":"2019-03-18T08:26:20.448Z","v":0}
{"name":"App","hostname":"Desktop","pid":28432,"level":50,"msg":"[RedisClient] Redis losted connection, time since last connect: 30 { attempt: 4,\n  error:\n   { Error: Redis connection to redis:6379 failed - connect ETIMEDOUT 192.168.31.25:6379\n       at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1083:14)\n     errno: 'ETIMEDOUT',\n     code: 'ETIMEDOUT',\n     syscall: 'connect',\n     address: '192.168.31.25',\n     port: 6379 },\n  total_retry_time: 30,\n  times_connected: 0 }","time":"2019-03-18T08:26:41.469Z","v":0}

The documents says it's milliseconds since last connect, but when the callback called with "total_retry_time: 30", 1 minutes was passed...

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 at the retry_strategy callback and trace how total_retry_time is calculated during the connection timeout shown in the report. Reproduce the logged timing sequence on NodeJS, then verify that the reported value includes the elapsed connect-to-timeout period as well as retry waits.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.