The test waits out the real ~45 s horizon; a 60 s budget left ~15 s for
the takeover, cut, detach and delete, which load and -race exceeded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A holder that exits never detaches or ACKs, so its live authority keeps
a volume delete refused. The existing path recovers it: after the lease
horizon plus skew a forced move grants epoch+1 on another host, which
claims HEAD, serves the last cut and writes past it, then detaches with
a clean ACK, after which the delete is admitted and later renewals and
moves are refused. Real master runtime and providers, in-memory remote.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The expiry case now waits until the host's own lease guard installed a new
deadline less than 1 s ahead (the 3 s grants install about 3 s ahead), read
under the guard's lock, before it stalls renewals; a blocked renewal then
follows. A completed renewal call is no longer taken as an accepted grant.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- g2Refused's probe uses a fixed lineage above every test epoch, so it is
always admissible (probes are refused only below the active epoch) and
its answer cannot depend on what the mutation did. The lineage argument
is dropped. New TestG1_ProbeHandshakeClassifiesByEffect: an accepted ship
is visible after the answer, a refused lower-epoch ship never is.
- Host lease expiry case: after a 300 ms grant was served and renewals were
stalled, wait until a renewal arrived blocked; serial renewals make that
the witness that the client accepted the 300 ms grant and is not renewed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TestWorkspaceHostLeaseExpiryAndRevokeCloseRealProvider ran every case under a
300 ms lease, so on a loaded runner the lease could expire before the write,
cut or detach steps (detach-then-revoke failed #248's CI). The setup now runs
under a 3 s lease; the expiry case shortens it to 300 ms, waits until one
300 ms grant was served, and only then stalls renewals.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- durable TestRestoreWaitsForFirstAssignment / TestRestoreDeferredAssignment
WaitEndsOnDeadlineAndClose: the 2 s test bounds become progress waits; the
40 ms ChunkAssignmentTimeout under test is unchanged; the limit poll fails
at once if the backend becomes operational without an assignment.
- TestWALStoreChunk_ExplicitCutRestartsTheTimer: the final wait for the
automatic cut is a progress wait; the early-cut window check (with its
slow-host skip) is the timing assertion and stays.
- storage TestChunkLayerV3_BASEBeginDrainsWholeCut: the held-upload, drain,
settlement and resume waits are progress waits (were 5 s).
- TestWALStoreV3FlusherWritesTheExtentButHoldsTheCheckpointUntilTheMap: stop
the automatic flusher before writes, as walstore_test does, so the
simulated crash cannot race its use of the descriptor ('volume locked').
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#227: g2Refused gave the listener 500 ms to close a refused connection; a
loaded machine can take longer and the refusal was misread as acceptance.
A probe at the same lineage now follows the frame on the same connection:
the listener handles frames in order, so it either closes (refused) or
answers after the frame's effect (accepted). g1Ship checks the bytes once
after that answer instead of polling for 2 s; g1Barrier drops its deadline.
New TestG1_SlowPersistFailureIsStillARefusal: a persist failure slowed past
the old window is still a refusal.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- master slow store: each held Put takes a generation; a renewal is credited
with the generation it read before its call, so a reply computed before
the hold never releases it. slow.release() runs as the first cleanup, so a
held Put cannot block the publisher/extender joins after a failure.
- authority WritersExtendersClose: only grants of calls that started after
the extension write was held count (flag set before the hold blocks).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- core/host/master TestWorkspaceLeaseGuardSurvivesSlowAuthorityStore: each
lease write is held until a renewal succeeded during the hold (slowness by
progress), three held writes must complete, a sampler records any fence;
replaces the 2.5 s sleeps and the 10 s watch. A renewal that waited for the
store would let the guard lapse and fail the test at once.
- TestWorkspaceHeldRenewalBoundary, TestWorkspaceMoveRestoresLazilyAndFencesOldHost:
the test context has no wall-clock bound (3 s / 10 s); each step completes
or the go test timeout reports the hang. The guard's own RPC timeout stays.
- core/authority TestWorkspaceLeaseConcurrentRenewalsWritersExtendersClose:
wait for the held extension write and for renewals under it by progress
(were 5 s / 2 s bounds); joins after release unchanged.
- waitExtenders joins the finite extenders without a 10 s bound.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The no-host-validity refusal in RenewWorkspaceLease formatted its error
from lv.d.horizon after releasing leaseMu, while the extender
(refreshLeaseViewLocked) rewrites the view under leaseMu: a data race.
The horizon is now read before the unlock.
Test: TestWorkspaceLeaseRefusalReadsTheViewUnderTheLock drives the
refusal while the view is republished concurrently; under -race it fails
on main (workspace_lease_view.go:174) and passes here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Test-only hooks: DetachVolume's StopIO can be replaced (the repeat and
retry tests now force and observe the failed-drain branch instead of
racing a cancelled context against a finished drain); the detach's cut
and settlement deadlines are traced (the budget test checks 3/4 of the
freeze, then the bound); the backend signals an I/O passing its
readiness check right before the I/O lock (the drain test's arrival
handshake replaces a 100 ms non-completion window, with bounded
receives).
- The delayed detach CAS worker is joined, bounded, also on failure.
- chunkErrorCode: the detach sentinels decide before a catalog-error
cause; the table rows now discriminate that order (no storage CAS
sentinel behind them).
- Invariants: INV-WS-DETACH-ABORT-001 and INV-WS-DETACH-FREEZE-001, and
the M4 transition Holder (detaching) -> Holder.
- Mutants (declared, 10/10): plus a catalog cause deciding before the
sentinels; the whole-budget cut is now caught by the deadline check too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- P1: every failed detach is settled before anything resumes, a failed
drain included. A repeated detach after a successful one (or with a
cancelled context) returns the first result and stays stopped, and a
retry over an unresolved detach CAS stays stopped while the outcome is
unknown. The StopIO failure path used to resume unconditionally.
- P1: one freeze budget covers the drain, the final cut and the
settlement (the cut gets three quarters, the settlement the rest); the
settlement no longer adds 10 s of its own. The bound is cooperative
(contexts), as documented.
- P2: the resume does not restart the periodic cuts after a concurrent
Close (or a replaced layer); ErrDetachOutcomeUnknown maps to
outcome_unknown explicitly, before its cause.
- Tests: the two P1 cases and the budget case (red on 26426dd5: resumed a
detached volume, resumed over an unknown CAS, 10.4 s for a 400 ms bound);
a detach CAS genuinely delayed until after the cancel then fails its
precondition; the drain test now checks that the resumed write queues
behind the admitted one and that recovery succeeds.
- Mutants (declared, 9/9): plus a failed StopIO resuming without the
settle, the settlement with time of its own, the cut taking the whole
budget.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DetachVolume stopped guest I/O, then ran the whole final cut; on any
error I/O stayed stopped for the process, even when nothing was
published, and the only bound was the caller's context (up to 5 min).
Now:
- The freeze (drain + final cut) is bounded by DetachFreezeTimeout
(default 20 s, below the host's 30 s I/O timeout); a freeze past the
5 s target is logged as an ALARM.
- A detach that provably did not publish (the drain or the cut failed
before its CAS, the CAS was refused, or an unresolved detach CAS was
cancelled) resumes serving: periodic cuts restart, the stop is lifted,
and ErrDetachAborted (HTTP detach_aborted, 409, retryable) is returned.
The dirty set stays dirty, so the next cut publishes it.
- The new ChunkLayer.SettleDetach decides an unresolved detach CAS: if
HEAD is still that CAS's base, a CAS at the same base to the
non-detached base image (this holder, this epoch) cancels it, so the
detach can never land afterwards; HEAD carrying the detach means it
applied (the detached result is returned, I/O stays stopped); a newer
holder means fenced (stays stopped); HEAD unreadable leaves it
undecided: ErrDetachOutcomeUnknown, I/O stays stopped. Never resume on
top of a possibly detached HEAD.
Tests: failed upload, refused CAS, lost unapplied CAS (cancelled, HEAD one
generation on, not detached) resume and the next cut publishes the dirty
blocks; an applied CAS whose reply was lost (found by the cut's re-read or
only by the settle) stays detached; undecidable and fenced stay stopped; a
hung CAS ends at the freeze bound, is settled and resumes; the old
drain-timeout test flips (it asserted I/O stays stopped). Six declared
mutants each turn exactly their declared tests red.
Known limit: after an abort whose drain is still pending (an admitted I/O
stuck), new I/O queues behind that admitted I/O (the drain holds a pending
ioMu.Lock); serving resumes once it completes, not instantly.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Past the 64 MiB in-memory budget a copy window spills saved chunks to a
sparse side file next to the volume, with no byte limit: under a long copy
and steady writes it could fill the filesystem under the WAL/extent.
New chunkLayerConfig.COWSpillLimit (bytes; 0 defaults to 1 GiB, negative
refused at attach). A save that would take the side file past it aborts the
window (errCutCOWAborted, the caller retries the cut) instead of writing;
the guest write still completes.
Tests: a save past the cap aborts the cut, the write completes and no side
file is written; a spill within the cap is accounted (one chunk) and the cut
completes; the default applies and a negative cap is refused. Four declared
mutants (no cap, no accounting, no default, negative accepted) each turn
exactly their declared tests red.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A test-only hook right before the capture barrier's Lock request; the
pause tests hold the barrier shared for 300 ms after that handshake (not
after admission plus a sleep), so the cut provably waited at its Lock and
pre-barrier time is excluded.
- The helper releases the shared hold on every path (also on a failed
assertion) and joins the cut within a bound.
- Design docs: barrierPauseNs runs from the Lock request and includes
lockWaitNs.
Mutants (declared, 4/4): pause timed after the Lock, lock wait unset, body
drops the field, the hook fired after the Lock (no handshake).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Tests: the copier's HEAD fill (after it released the entry) is
cancelled by an aborted cut and the window drains; a held fill is
bounded by ReadMissTimeout and aborts the cut; a lazily-absent saved
chunk that spills keeps its missing list and the image is exact.
- C3 waits for an actual writer-entry handshake (the writer parked on the
copy entry) instead of a 200 ms non-completion window.
- Comments: the happens-before of e.missing (published by finish), and
the lazy-HEAD saver test describes the local-only save.
Mutants (declared): fill ignores the window's end, fill without
ReadMissTimeout, missing list kept only for in-memory saves; the earlier
five now also turn the new fill/spill tests red where they should.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BarrierPauseNs started after captureMu.Lock returned, so the wait for
writers already holding the capture barrier shared (e.g. parked in WAL
admission) was not counted, although a pending Lock already blocks new
writers: the reported guest pause understated it.
The pause is now timed from the Lock request, and LockWaitNs reports the
wait for the shared holders on its own (also in the /chunk/cut body).
Tests: a cut whose barrier is held shared for 300 ms reports a pause that
includes the wait (red on main: about 24 ms) and a LockWaitNs of about the
hold, inside the pause before the sync. Three declared mutants (pause timed
after the Lock, lock wait unset, body drops the field) each turn exactly
their declared tests red.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A cut candidate chunk that is lazily absent but has local writes stays a
candidate. Its first writer inside the copy window saved the chunk
synchronously through Read, so every non-local block became a remote fetch
bounded only by ReadMissTimeout (30 s), and every writer queued behind that
chunk waited on it; an abort did not cancel the fetch. The in-window copier
had the same shape: writers to a chunk it was copying waited on its fetch.
The COW save and the in-window copy now read LOCAL blocks only (dirty
map/WAL, the extent of present or locally written blocks, zeros for a chunk
HEAD stores as ZERO) and never call the miss hook. A lazily-absent block's
image at H is HEAD's by definition: it is listed as missing, and the copier
fills it from the cut's base HEAD after it has released the entry, off the
write path (bounded by ReadMissTimeout and the window's end).
Tests: the lazy-HEAD saver test now holds every remote fetch once the window
is open and requires the saving write to finish without one (it asserted the
blocking fetch before); C3 holds the in-window local copy instead of a fetch
and requires the write to complete with the remote held, the copier's HEAD
fetch coming afterwards. Five declared mutants (blocking read, absent block
read as local, no fill, saver drops the missing list, fill under the entry)
each turn exactly their declared tests red.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>