util/async: avoid blocking Append on Exec cancellation (#2034) - #2095
Conversation
fix tikv#2033 Signed-off-by: zyguan <zhongyangguan@gmail.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughExec now handles the pending notification when cancellation races with Append. Tests cover this race and concurrent Exec calls. ChangesRunLoop synchronization
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The cancellation fix is mergeable after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change addresses a cancellation race without changing who may submit or execute callbacks. The main remaining uncertainty is the behavior of callers outside the inspected code. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
|
@wfxr: 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, lcwangchao, wfxr, you06 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 |
|
/retest |
7ee0b27
into
tikv:release-nextgen-202603
This is an automated cherry-pick of #2034
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