Skip to content

Fix cancelled subrequest finish losing Done - #1002

Open
pederbe wants to merge 1 commit into
cloudflare:mainfrom
pederbe:learn/pingora-933-finish-cancellation
Open

pederbe wants to merge 1 commit into
cloudflare:mainfrom
pederbe:learn/pingora-933-finish-cancellation

Conversation

@pederbe

@pederbe pederbe commented Sep 10, 2026

Copy link
Copy Markdown

Fix cancelled subrequest finish losing Done

Summary

A cancelled legacy subrequest finish can mark the body complete while its terminal Done task is still waiting for channel capacity. Retrying finish then becomes a no-op and loses that task.

Reserve channel capacity before completing the body, then send Done synchronously. Preserve the existing premature-body and closed-channel error behavior. Add deterministic coverage for cancellation and retry, upgraded sessions, repeated and empty completion, and terminal errors.

Fixes #933.

Testing

  • Reproduced both content-length and until-close regressions against the original implementation.
  • cargo test --locked -p pingora-core --lib protocols::http::subrequest -- --nocapture: 85 passed.
  • cargo test --locked -p pingora-core --lib: 591 passed, 2 ignored.
  • cargo fmt --all -- --check
  • cargo check --locked --workspace
  • cargo clippy --locked -p pingora-core --all-targets -- --allow=unknown-lints --deny=warnings

@pederbe
pederbe marked this pull request as ready for review September 10, 2026 06:48
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.

Subrequest response finish can lose the terminal Done task if cancelled under channel backpressure

1 participant