Skip to content

fix(producer): keep a cancel across a retried cluster submit pipeline - #589

Open
vmanvs wants to merge 2 commits into
llm-d:mainfrom
vmanvs:fix/cluster-submit-cancel-marker
Open

vmanvs wants to merge 2 commits into
llm-d:mainfrom
vmanvs:fix/cluster-submit-cancel-marker

Conversation

@vmanvs

@vmanvs vmanvs commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Removes the DEL request-cancel:<id> from the pipeline that enqueueCluster sends before the enqueue script. A cancellation marker left by an earlier generation of the ID stays until its TTL expires or a later cancel overwrites it. Standalone and Sentinel go through submitRequestScript and are unchanged.

Why is this change needed?

go-redis retries a pipeline whose reply was lost. If the first attempt ran and CancelRequests ran before the retry, the marker held this submit's token and the retried DEL removed it, so the cancelled request was dispatched. The #522 guard cannot cover the DEL, because the marker and the queue are in different slots.

The delete is not needed for a resubmitted ID. IsCancelled treats a request as cancelled only when the marker equals the request's token, and cleanupRequestStateByIDAndToken deletes the marker only when it holds the finished request's token. Every submit gets a fresh token, so a stale marker never cancels a later generation.

A conditional delete (delete the marker unless it holds this submit's token) also fixes the race in #533, but it still lets an older submit's retry remove a newer generation's cancel: if submit A loses its pipeline reply, and the ID is resubmitted as B and cancelled before A retries, A's retry deletes the marker holding B's token and B is dispatched. Without the delete there is nothing to retry.

How was this tested?

  • Unit tests added/updated

  • Integration/e2e tests added/updated

  • Manual testing performed

  • In cluster mode, a cancel issued between two attempts of the submit pipeline survives the retry. It fails on main with ERR no such key on the marker read.

  • Resubmitting a cancelled ID in cluster mode leaves the old marker holding the old token.

The lost-reply helper takes the write whose reply it drops, following chethanuk#4; the existing callers still drop the enqueue script's reply.

Checklist

  • Commits are signed off (git commit -s) per DCO
  • Code follows project contributing guidelines
  • Tests pass locally (make test)
  • Linters pass (make lint)
  • Documentation updated (if applicable)

Related Issues

Fixes #533

Release note

Producer: in Redis Cluster mode, cancelling a request while its submit is being retried by go-redis no longer loses the cancellation.

Signed-off-by: vmanvs <manvendravsvats@gmail.com>
Signed-off-by: vmanvs <manvendravsvats@gmail.com>
@vmanvs

vmanvs commented Nov 30, 2026

Copy link
Copy Markdown
Contributor Author

Hi @jtechapps, could you take a look at this when you have time, and approve the workflow runs? It follows #522 and fixes #533: in cluster mode the submit pipeline deleted the cancellation marker before the enqueue script, so a go-redis retry of that pipeline could remove a cancel issued between the attempts. The fix drops the delete, since IsCancelled and the result cleanup only act on a marker that holds the request's own token. The PR description covers why a conditional delete would still leave a race across generations. Thanks!

cc: @shimib

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.

[Bug]: producer: in cluster mode a retried submit pipeline can clear a cancellation

1 participant