util/async: avoid blocking Append on Exec cancellation - #2034
Conversation
fix tikv#2033 Signed-off-by: zyguan <zhongyangguan@gmail.com>
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthrough
ChangesRunLoop cancellation
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
[LGTM Timeline notifier]Timeline:
|
|
@coderabbitai[bot]: adding LGTM is restricted to approvers and reviewers in OWNERS files. DetailsIn response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cfzjywxk, coderabbitai[bot], lcwangchao The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/cherry-pick release-nextgen-20251011 |
|
@lcwangchao: The label(s) DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
|
@lcwangchao: new pull request created to branch DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
|
/cherry-pick release-nextgen-202603 |
|
@lcwangchao: The label(s) DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
|
@lcwangchao: new pull request created to branch DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
Fix #2033
RunLoop.Appendcould block indefinitely when racing with cancellation of a waitingRunLoop.Exec.Appendchanges the state fromStateWaitingtoStateIdleunder the mutex, then sends a notification through theunbuffered
readychannel after releasing the mutex. IfExecselectedctx.Done()and returned before receiving thatnotification, the
Appendcaller was left blocked. When invoked from an async batch response callback, this could stopthe batch receive loop from retiring the request and processing later responses on the same stream.
Changes:
Appendhasalready committed to sending a notification.
Exec, ensuring the notifyingAppendcan complete.Execsafety invariant.Execbehavior.Exectest deterministic by synchronizing on the first executor enteringStateRunning.Summary by CodeRabbit
Bug Fixes
Tests