carlos / platform Public

test: migrate guard-close's registry before the lock-order window

CI's internal_host@0 failed TestPlan14LaunchVerifierCallerOrder/guard-close
with "caller deadlocked" on ac5e4aa6 and 69d543bb. There is no deadlock.
After the release holder lets go, the guard-close and guard-rollback
callers reach freezeHolds, whose registry.Open created and migrated a
fresh registry inside the test's 2 s window: about 80 ms of SQLite work
locally, 75-90% of the caller's post-release time. Every modernc SQLite
allocation goes through modernc libc's one process-wide malloc mutex; a
goroutine dump of the shard's parallel phase shows other parallel tests
parked on it inside registry migrations. The merge of main moved this
test into shard 0 (the deal follows the test list and weights), and on
a loaded CI box the migration ran past 2 s; in CI the ten lock-only
subtests before it already took 2.1 s against 0.55 s locally.

The registry is now created and migrated in setup, as it is on a box,
so the window times lock order only. Post-release caller time drops
from ~90 ms to ~14 ms locally, and from ~220 ms to ~40 ms with the
shard's parallel tests pinned to 3 cores. Test-only; no census change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 649d0616cb0a6e219be7058e89327975c8894f9b parent 69d543b
1 file changed, +15 −0
  • internal/host/plan14_launch_verifier_test.go +15 −0

CI failed — run details

diff --git a/internal/host/plan14_launch_verifier_test.go b/internal/host/plan14_launch_verifier_test.go
index 36fe2e445..b53b62969 100644
--- a/internal/host/plan14_launch_verifier_test.go
+++ b/internal/host/plan14_launch_verifier_test.go
@@ -92,6 +92,21 @@ func TestPlan14LaunchVerifierCallerOrder(t *testing.T) {
a := &systemApplier{participation: l, optDir: t.TempDir(), dataDir: t.TempDir()}
if name == "guard-close" || name == "guard-rollback" {
armLocalFloor(t, a.dataDir, "v0.30.0")
+ // The registry exists and is migrated before the caller
+ // runs, as on a box. Otherwise freezeHolds' open creates
+ // and migrates it inside the 2 s window below: about 80 ms
+ // of SQLite work alone, all of it through modernc libc's
+ // one process-wide malloc mutex, which this shard's
+ // parallel tests' own registry opens contend for. A busy
+ // CI shard stretched that past 2 s and read it as a
+ // deadlock. The window is for lock order, not migration.
+ reg, err := registry.Open(filepath.Join(a.dataDir, "registry.db"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ if err := reg.Close(); err != nil {
+ t.Fatal(err)
+ }
a.openRegistry = func() (*registry.Registry, error) { return registry.Open(filepath.Join(a.dataDir, "registry.db")) }
}
run := func(ctx context.Context) error {