Skip to content

util/async: avoid blocking Append on Exec cancellation - #2093

Closed
lcwangchao wants to merge 1 commit into
tikv:release-nextgen-202603from
lcwangchao:cherry-pick-2034-to-release-nextgen-202603
Closed

lcwangchao wants to merge 1 commit into
tikv:release-nextgen-202603from
lcwangchao:cherry-pick-2034-to-release-nextgen-202603

Conversation

@lcwangchao

@lcwangchao lcwangchao commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

What

Backport #2034 to release-nextgen-202603.

This fixes the RunLoop cancellation race from #2033, where Append could block indefinitely if a waiting Exec returned on ctx.Done() after Append had already committed to notify through ready.

Why

The branch still has the pre-fix util/async/runloop.go implementation and is therefore still affected by the race.

Tests

  • go test ./util/async

Cherrypick

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability when a running task is canceled while new work is being queued. Cancellation now returns the appropriate error, queued work remains available for a subsequent run, and adding work does not remain blocked in this race condition. These changes also make concurrent execution behavior more consistent.

fix tikv#2033

Signed-off-by: zyguan <zhongyangguan@gmail.com>
(cherry picked from commit 392411f)
@ti-chi-bot ti-chi-bot Bot added the dco-signoff: yes Indicates the PR's author has signed the dco. label Sep 28, 2026
@ti-chi-bot

ti-chi-bot Bot commented Sep 28, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign brson for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Sep 28, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 65c3b7d9-43ed-45ce-a417-3df34b18a86f

📥 Commits

Reviewing files that changed from the base of the PR and between 6e3fd8a and d0826bd.

📒 Files selected for processing (2)
  • util/async/runloop.go
  • util/async/runloop_test.go
 _______________________________________________________________________________
< Why do we never have time to do it right, but always have time to do it over? >
 -------------------------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ti-chi-bot ti-chi-bot Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 28, 2026
@lcwangchao lcwangchao closed this Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the dco. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants