test: Add standalone reproduction for cache lock client disconnect bug #798
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a standalone reproduction tool that demonstrates a bug where Pingora doesn't detect client disconnects while waiting on a cache lock, causing servers to hold connections for the full lock timeout (up to 60 seconds) even after clients have disconnected.
The Bug
When multiple requests hit the same uncached URL with cache lock enabled:
This causes:
The Reproduction
The
cache-lock-bug-repro/directory contains:slow_origin.rs: Pure Rust slow origin server (no OpenResty dependency)proxy.rs: Minimal Pingora proxy with caching and cache lock enabledtest_client.rs: Test client that measures server disconnect detection timeTo run:
cd cache-lock-bug-repro ./run_test.shTest Results
Proposed Fix
A proposed fix is available in a separate branch:
skidder/cache-lock-client-disconnect-v1The fix uses
tokio::select!to race the cache lock wait against client disconnect detection viasession.downstream_session.read_body_or_idle(true).Test plan
🤖 Generated with Claude Code