Skip to content

Document bounded pool waits for cluster pipelines - #4564

Merged
ggivo merged 2 commits into
redis:masterfrom
lh0156:fix-4557-cluster-pipeline-deadlock
Jul 29, 2026
Merged

ggivo merged 2 commits into
redis:masterfrom
lh0156:fix-4557-cluster-pipeline-deadlock

Conversation

@lh0156

@lh0156 lh0156 commented Jun 14, 2026 •

Copy link
Copy Markdown
Contributor

Documents how ClusterPipeline retains per-node connections until sync() or close(), and how concurrent multi-node pipelines can wait indefinitely when the pool uses its default unbounded wait. The guide now recommends a dedicated cluster client with a pool sized for expected concurrency and a finite maxWait, plus single-shard pipelines where possible.

This follows the maintainer guidance on #4557 without changing cluster pipeline acquisition semantics.

Refs #4557.


Note

Low Risk
Documentation-only change with no code or configuration defaults modified.

Overview
Adds a Pipelining subsection, Avoiding pool waits with cluster pipelines, to docs/advanced-usage.md.

It documents that ClusterPipeline holds a borrowed connection on each targeted node until sync() or close(), and that overlapping multi-node pipelines with small per-node pools and default unbounded pool wait can deadlock or hang indefinitely.

The guide recommends a dedicated RedisClusterClient with ConnectionPoolConfig sized for expected concurrent pipelines and a finite maxWait, includes a try-with-resources example, and advises single-shard pipelines when possible. No runtime or API changes.

Reviewed by Cursor Bugbot for commit 7838c26. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit c0e7984. Configure here.

@ggivo

ggivo commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

@lh0156
Thanks for the PR. The team is a bit stretched at the moment, and I’ll be away for a few days this week. We’ll get to it as soon as we can.

@lh0156
lh0156 force-pushed the fix-4557-cluster-pipeline-deadlock branch from b812409 to b0120ce Compare June 28, 2026 06:23
@ggivo

ggivo commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Not sure there is a reliable way of detecting a deadlock.
With the suggested "fail-fast approach implementation," we are changing ClusterPipeline behaviour to discard pool-level configured maxWait. Means that now, in the case of a loaded pool, we can close pipelines preemptively.

I think having a dedicated client with a configured maxWait can cover this scenario without the need for a code change.

@lh0156
lh0156 force-pushed the fix-4557-cluster-pipeline-deadlock branch from b0120ce to c49c001 Compare July 26, 2026 07:22
@lh0156 lh0156 changed the title Fix cluster pipeline deadlock on connection acquisition Document bounded pool waits for cluster pipelines Jul 26, 2026
@lh0156

lh0156 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the guidance. I reworked this PR into a documentation-only change. It now explains that ClusterPipeline retains per-node connections until sync or close, recommends a dedicated client with an appropriately sized pool and a finite maxWait, and suggests single-shard pipelines where possible. There is no runtime behavior or pool-semantics change anymore. @ggivo, could you take another look when you have a chance?

@ggivo ggivo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ggivo
ggivo merged commit ad47003 into redis:master Jul 29, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants