Skip to content

redis: honour dial/read/write timeouts in all modes, not just Sentinel - #1734

Open
distronode-com wants to merge 1 commit into
livekit:mainfrom
distronode-com:redis-timeouts-all-modes
Open

redis: honour dial/read/write timeouts in all modes, not just Sentinel#1734
distronode-com wants to merge 1 commit into
livekit:mainfrom
distronode-com:redis-timeouts-all-modes

Conversation

@distronode-com

Copy link
Copy Markdown

RedisConfig exposes dial_timeout, read_timeout and write_timeout, but GetRedisClient only reads them in the Sentinel branch. A single-address or cluster deployment can set them and they are silently ignored — nothing errors and nothing warns.

This passes them through in all three branches. Sentinel keeps its existing 2000/200/200 defaults; the other two leave an unset value at zero so go-redis applies its own defaults, so a config that does not set them behaves exactly as before.

How it turned up

Debugging a self-hosted SFU where RedisRouter.statsWorker stalled ~31s and logged status update delayed, possible deadlock, with the goroutine parked in go-redis ConnPool.queuedNewConn.

That stall is not reachable from config today. PoolTimeout bounds only waitTurn; pool.go notes that queuedNewConn deliberately applies no timeout of its own because dialConn applies DialTimeout per attempt — and dialConn retries DialerRetries (default 5) times. With DialTimeout never passed through on the simple path, there is no way to bound that from YAML.

The knock-on effect is user visible: while statsWorker is stalled the node's Stats.UpdatedAt goes stale, and LivekitServer.healthCheck returns 406 once it is more than 4s old. Anything using / as a health probe sees the node as unhealthy.

Notes

  • Behaviour is unchanged for any config that does not set these fields.
  • Sentinel is untouched.
  • Includes a changeset (patch).
  • gofmt, go build ./redis/... and go vet ./redis/... all clean.

RedisConfig exposes dial_timeout, read_timeout and write_timeout, but
GetRedisClient only reads them in the Sentinel branch. A single-address or
cluster deployment can set them and they are silently ignored -- nothing
errors and nothing warns.

Pass them through in all three branches. Sentinel keeps its existing 2000/200/200
defaults; the other two leave an unset value at zero so go-redis applies its own
defaults, so a config that does not set them behaves exactly as before.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ff57e7a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
github.com/livekit/protocol Patch
@livekit/protocol Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@CLAassistant

CLAassistant commented Aug 24, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants