Fix CI state leakage and CC request lifetime races - #543
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughRedis flushing is centralized for single-node and cluster test workflows, failures now stop those workflows, external-server tests clear Redis during setup, and the ChangesRedis reset behavior
Substrate revision
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 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 |
Context
This PR addresses the two issues found while debugging the failing
mainCI run29401455092.scripting.tclsee stale keyspace state instead of a clean Redis database.data_substratelifetime race in stack-owned CC requests. The submodule update points at Fix stack CC request lifetime races tx_service#529.The CC crash root cause is that
CcShard::ProcessRequests()still owns a raw request pointer afterExecute()signals the result waiter. For stack-owned requests, the waiter can reuse or destroy the stack object beforeProcessRequests()gets back to its finalreq->Free()call.Behavior before and after
Before:
flushallafter startup, so state could leak across phases.KickoutCcEntryCcrequest owners waited only for logical completion, not for the CC scheduler's final access to the request object.After:
KickoutCcEntryCccallers wait until scheduler-sideFree()has completed before resetting the stack request.trueto the scheduler or callingFree().Compatibility: runtime behavior should be unchanged outside the cleanup boundary and the corrected stack-request lifetime paths.
Implementation
flush_redis_data()in.github/scripts/common.shand call it before the affected single-node and cluster Tcl test phases.data_substratefromf7e62c5to2ef3762:LocalCcShards::PurgeDeletedData()andKickoutDataForTest()now use the existingUse()/InUse()request flag as a stack-object lifetime fence.UploadRangeSlicesCcandUploadBatchSlicesCcstack-owned error paths returnfalse/ avoidFree()after waking their waiter.Design decisions and alternatives
The CC fix is local to the unsafe stack-owned requests rather than changing the generic scheduler contract. It reuses the existing request
in_use_flag and waits outsideExecute()withbthread_usleep()backoff, so it does not add blocking or yield behavior to the CC execution path.The CI cleanup is centralized in one shell helper so each phase fails fast if
flushallcannot be applied to the expected port set.Test plan
Commands and results:
Full Tcl/CI tests were not run locally.
Risk assessment
The CI script now depends on
redis-cli flushallsucceeding on all listed ports before Tcl execution. That is intentional; a failed flush should fail the job rather than hiding stale state.For the CC change, the main risk is a stack
KickoutCcEntryCccaller waiting slightly longer after logical completion. The wait only covers the scheduler gap between result notification andProcessRequests()callingFree().This PR should remain draft until eloqdata/tx_service#529 is reviewed and landed or the submodule pointer is otherwise updated to the landed commit.
Rollback plan
Revert this PR. If only the CI cleanup needs rollback, revert the
.github/scripts/common.shchanges while keeping the submodule update.Reviewer guide
.github/scripts/common.sh:flush_redis_data()and Tcl phase call sites.data_substratesubmodule diff: Fix stack CC request lifetime races tx_service#529.Follow-up work
Run the full GitHub Actions matrix after the submodule PR lands and this pointer is updated if needed.
Summary by CodeRabbit