From ffb22e368b5cfd1ad74760184387b2e52b9f2d30 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 19 Oct 2026 14:15:47 +0200 Subject: [PATCH] Cut c2b: the post-fencing abort stops its candidate before revoking the lifetime-held lease ruling c2b-abort-stops-before-revoke; fixes follow-up ghostlight-abort-lease-before-stop. Mirrors advance_fencing. Co-Authored-By: Claude Opus 5.5 --- src/control_plane.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/control_plane.rs b/src/control_plane.rs index 947a031..e745693 100644 --- a/src/control_plane.rs +++ b/src/control_plane.rs @@ -9355,8 +9355,9 @@ impl Engine { } /// Withdraw the candidate in the one order that never leaves two writers: - /// take away its route, then its write lease, then the process itself, and - /// only then reconcile the projection. + /// take away its route, then stop the process and withdraw its write lease + /// (the lease is lifetime-held, so the holder stops first), then clean up, + /// and only then reconcile the projection. fn advance_post_fencing_abort(&self, current: &Stored) -> Result<()> { let abort = required( ¤t.value.post_fencing_abort, @@ -9396,6 +9397,15 @@ impl Engine { .process_write_lease .context("leased target has no write-lease binding")? .record_path; + // The candidate holds its lifetime write lease; revoking it under + // a live holder fails on the shared lock forever. A stopped + // process writes nothing, so stop first (as advance_fencing does). + if let Some(workload) = ¤t.value.workload { + let plan = required(¤t.value.plan, "abandoned candidate plan")?; + self.workload_for(plan)?.stop(workload).context( + "stopping the abandoned candidate before revoking its lifetime-held write lease", + )?; + } let driver = CultCacheWriteLeaseDriver::new(¤t.value.target, lease_path); driver .revoke_exact(Some(lease))