Deploy compose: identify the cause of the ~10 s StartDeployment stall seen in the #923 gate #955
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up to #949 (
88c9766ab). #949 fixed the caller-facing symptom (202 OutcomeUnknown + pre-allocated DeploymentId) but the cause of the >10 s ask was not established. CreatedAtUtc is stamped just before SaveChanges, so the time went into the compose phases under the Serializable transaction (scope-state write lock + range-locked snapshot read) — lock contention with a concurrent config writer is the leading hypothesis, unconfirmed.88c9766abadds a Warning with per-phase timings (serializable-begin+scope-lock / snapshot-read / validate / compose / save+commit) for any compose > 3 s. Next time it reproduces (e.g. on the gRPC data rig), read that log line and fix the named phase. Evidence: docs/plans/evidence/grpc-data-ext/H4.md.Findings (branch
worktree-agent-ab520ca395f60bbb8, commit0a9719c86, not merged; evidencedocs/plans/evidence/followups/955.md).Mechanism reproduced and fixed. The compose's SERIALIZABLE transaction (from
47960a6d5) also swallowedDraftSnapshotFactory's read (it reads inside an existing transaction instead of opening its SNAPSHOT one), so ~22 config tables were range-locked through validate + compose + gzip. Against the central SQL Server (throwaway DB, real actor):Fix: the compose runs SNAPSHOT (no shared locks; neither waits on nor blocks edits), with composes serialised by a transaction-owned
sp_getapplocktaken before any data access (row-lock-first under SNAPSHOT fails a queued compose with 3960). After: cross-table writer max 946 ms / 0 deadlocks; a 2 s lock holder no longer delays the deploy (p50 210 ms). Regression testsDeployComposeIsolationSqlServerTests(3, SQL Server) are red on revert. The #949 timer now starts at the singleton's receipt and addsdispatch(thread-pool hand-off) andin-flight-check.Not established for the #923 instance. No concurrent config writer was running then: the seeder's
docker compose run --rmexits before the deploy is triggered, and CONTROL's in-process writers (coordinator, retention, audit, fused-node ack) touch only the bookkeeping tables in sub-second SaveChanges; system_health showed no deadlock; the run's logs are gone. Untimed then, still candidates: ask delivery through the singleton proxy (CONTROL-1 <-> CONTROL-2), thread-pool queueing (now timed), the in-flight check (now timed), a SQL/container stall. A repeat now names the phase from receipt; a slow ask with a fast breakdown points at delivery.Leaving open for the coordinator to decide.
Closing: a real cause of multi-second deploy stalls was found, reproduced and fixed in
0a9719c86(merged to master, not yet pushed) — the compose's Serializable transaction range-locked the whole config snapshot, so concurrent edits blocked it or deadlocked it (5 s detection each; 9/10 deploys were deadlock victims in the repro). Now Snapshot isolation + sp_getapplock serialisation; evidence docs/plans/evidence/followups/955.md. Caveat: no concurrent writer is known to have run during the #923 gate, so that exact 10.5 s instance is not proven to be this; phase timing now starts at actor receipt (incl. dispatch / in-flight-check), so a recurrence names its phase — reopen with that log line. ControlPlane.Tests 497/497.