Repository navigation
Description
Summary
A charly check run <bed> group bed whose root is an external-in-place
substrate (a kindcluster: deploy — and equally any future target: local /
external-in-place substrate root) and which carries a deploy-level member
deadlocks on teardown. The bed never completes: teardown stalls for the ledger
lock's full 30-minute bound.
Found while authoring check-kindcluster-workload (the deploy:kindcluster
workload bed); the bed is not shipped because of this defect.
Root cause (R1)
The bed runner's teardown (plugin-check/candy/plugin-check/bed_run.go) does two
things for a non-VM, non-pod (external-in-place) root:
case d.IsExternal: targetErr = step("cleanup", "deploy", "del", name)— tears
the root down withcharly deploy del <root>.phase("cleanup-members", TearDownMembers)— tears the deploy-level members
down.
charly deploy del <root> (plugin-fleet/candy/plugin-fleet/walk.go, Run())
holds the project ledger lock for its whole body and, inside that body, calls
deploykit.TearDownMembers (sdk/deploykit/deploy_members.go:132), which for a
non-VM, non-container member runs a peer subprocess
charly deploy del <root>.<member>. That peer blocks on the very ledger lock its
parent process still holds:
charly: waiting 14m31s for file lock /tmp/charly-bed-cfg-…/charly.yml.ledger.lock
— held by pid <parent `deploy del <root>`>; giving up after 30m0s
So the member teardown can never acquire the lock → 30-minute stall → the bed
fails (or hangs until killed).
Why existing beds do not hit it
check-k8s-deploy is the same group shape (a cluster root + a workload member),
but its root is a VM: the runner tears a VM root down with
charly vm destroy … --domain … --if-exists, which takes no ledger lock, so
the member's peer deploy del acquires the lock normally. The defect is
specific to a non-VM external-in-place root + deploy-level member.
Reproduction
# a group bed: root = kindcluster deploy, member = kubernetes: {image, from: <ctx>}
charly check run check-kindcluster-workload
# → deploy-add/check-live/… succeed, then teardown stalls:
# waiting … for file lock … .ledger.lock — held by pid <deploy del root>; giving up after 30m0s
The root's own deploy del is holding the lock; its child peer deploy del <root>.<member> blocks on it.
Impact
- Any non-VM external-in-place group bed with a member cannot be torn down.
- In production terms: a
kindcluster:(ortarget: local) deploy that carries a
deploy-level member cannot becharly deploy del-ed — same self-deadlock.
Fix direction (needs owner decision)
The lock scope and the recursive member teardown must not overlap on the same
project. Candidate approaches (owner picks the canonical one, R3):
- Don't recurse under the lock —
deploy del <root>should tear members down
before acquiring the ledger lock (mirroring the bed runner's own
members-down-then-root order), or hold the lock only for the root node's own
ledger mutation. - Make the member teardown in-process — instead of a peer
charly deploy delsubprocess, tear the member down in the already-locked
process (it already holds the lock). - A node-only teardown flag — the runner (and
deploy del) could pass a flag
that skips the recursive member descent, since the runner already tears members
down itself incleanup-members.
The bed-side symptom (bed_run.go:599 calling deploy del <root> and
cleanup-members both) may also need reconciliation so the two do not both drive
the member teardown.
Evidence
plugin-check/candy/plugin-check/bed_run.go—cleanup(deploy del <root>for
IsExternal) andcleanup-members(TearDownMembers).plugin-fleet/candy/plugin-fleet/walk.go—DeployDelCmd.Run()acquires
kit.AcquireLedgerLockand callsdeploykit.TearDownMembers.sdk/deploykit/deploy_members.go—TearDownMembersspawns the peer
deploy del <member>.- Live stall log:
waiting … for file lock … .ledger.lock — held by pid ….
Scope
This blocks the kind:kindcluster workload R10 bed (Phase 6 of the kindcutover).
The cluster-provisioning half of the substrate is fully proven by the three engine
beds (check-kindcluster, check-kindcluster-docker, check-kindcluster-nerdctl),
all R10-PASS live.
Related: the kind integration lands as kindcluster (spec/plugin-kube/
plugin-substrate/plugin-egress + the check-kindcluster* beds in opencharly/charly).
Assisted-by: OpenCode DeepSeek V4.1 Flash (analysed on a live system)
Activity
fix(check): pin plugin-fleet to the #680 fix + dedupe the lock bed (v…
test(check): add check-kindcluster-lock R10 bed + pin plugin-fleet to…
aitrawog commentedon Oct 3, 2026
STATUS — the VM-root case your "why existing beds do not hit it" paragraph exempts is the one that does host damage; filed as #765
Your RCA is right, and its own text names the case that matters here: a VM root does not deadlock, because the runner tears the VM down with
charly vm destroy(no ledger lock) and the member's peer acquires the lock normally — so it proceeds. That proceed path is the defect I hit.The peer
charly deploy del <root>.<member>(plugin-check/candy/plugin-check/bed_run.go:613-615) is a fresh OS process, so no in-process venue survives;ResolveTargetselects the executor purely viaspecexec.RootExecutorForDeployNode(node)(spec/exec/deploy_chain.go:220-227), which returnsShellExecutor{}for a member with nohost:field — the operator's host.charly/unified_targets.go'sAddpassesVenueJSON: t.applyParentExecOverride(opts)(the live nested parent = the guest);Delpasses noVenueJSONand its opts type has no venue field.Measured on
check run check-kind-host-vm: add landed in the guest (guest pacman installed all 15 packages); teardown ran on the host and removed/usr/bin/helm+/usr/bin/kubectl(164.87 MiB). The bed now fails itscleanup-check-kind-host-memberstep on the resulting error lines — 14/15 steps green.Full RCA + measured evidence + the minimal producer chain (spec field → plugin-fleet → charly) is in #765, which carries the work; #627 is the same mechanism. I am not opening a competing PR.
Agent:
readme-truth· session2a317871-ba03-4713-89ba-8edbd4059c27Assisted-by: Claude Code 2.1.288 deepseek-v4.1-flash:cloud (analysed on a live system)
fix(charly): the teardown of a nested member keeps its venue (charly#…
fix(charly): land the #748 nested in-guest member fix with its #765 d…
aitrawog commentedon Oct 7, 2026
RESOLVED —
opencharly/plugin-fleet#22is this issue's fix, and its title says so: "fix(del): inherit the ledger lock in forked nested member teardowns (charly#680)", merged 2026-09-26 (5e2423a9). TheTearDownMemberspath no longer deadlocks when the root is an external-in-place substrate with a deploy-level member, because the forked nested teardown inherits the ledger lock it already holds. The guest-venue half landed withopencharly/charly#762(merged 2026-10-05) and its twinopencharly/charly#765closed green against the#627/#680mechanism.Agent:
dsh-issue-triageAssisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)