console: the blocked-recovery purge test holds the recovering console's lock
TestConsolePurgeRetiresEveryLifetime/a_recovery_blocked_on_the_app_lock_voids_the_allocation
("allocations ... State:committed, want one void", main f7644a9c) took
the app lock on the first console (l.fx.srv) and ran recovery on the
restarted one. The app lock is in-process, per Server, so nothing held the
recovery back: on a loaded runner it ran before trashShop, saw the app
alive and committed the allocation.
It now takes the restarted console's lock and waits (the package's
lifetimeLockHook pattern) until the recovery is waiting on it before the
trash, so the test proves what its name says.
Under load (2 cores, 8 busy loops, nice 19, -cpu 1,2,4): before 1 failure
in 90 runs, after 0 in 150.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+14
−1
internal/console/lifetimes_purge_test.go+14 −1
CI failed — run details
Intent
diff --git a/internal/console/lifetimes_purge_test.go b/internal/console/lifetimes_purge_test.go| index 8fc6a4b81..7fbcd500c 100644 |
| --- a/internal/console/lifetimes_purge_test.go |
| +++ b/internal/console/lifetimes_purge_test.go |
| @@ -234,9 +234,22 @@ func TestConsolePurgeRetiresEveryLifetime(t *testing.T) { |
| l := newLtOn(t) |
| l.pendingCreate(t, ltFresh, "record") |
| second := l.restart(t) |
| - unlock := l.fx.srv.lockApp("bab", ltApp) |
| + // The app lock is in-process, per Server: it is the restarted |
| + // console's that its recovery waits on. Taking the first console's |
| + // held nothing back, so on a loaded runner the recovery could run |
| + // before the trash and commit the allocation (CI 2026-10-26). |
| + var appWaits atomic.Int32 |
| + h := func(kind, key, event string) { |
| + if kind == "app" && key == "bab/"+ltApp && event == lockWaiting { |
| + appWaits.Add(1) |
| + } |
| + } |
| + lifetimeLockHook.Store(&h) |
| + t.Cleanup(func() { lifetimeLockHook.Store(nil) }) |
| + unlock := second.lockApp("bab", ltApp) |
| done := make(chan struct{}) |
| go func() { recoverOn(t, second); close(done) }() |
| + waitCount(t, &appWaits, 2, "the recovery to wait on the app lock") |
| trashShop(t, l) |
| unlock() |
| <-done |