Skip to content

fix(start): charly start returns before a RESTARTED pod's bind mounts are visible #1301

Done

Description

@aitrawog

Category

category:runtime

Type

type:fix

Remedy / files the remedy will touch

the pod start path's readiness wait (charly start -> lifecycle start) and the quadlet/service start semantics it relies on

Cited design decision or org-rulebook rule (or none)

AGENTS.md R3 (no blind retry) + R7 (prove behaviour, not compilation)

Classification

Blocking — it blocks the filer's own progress, so the filer claims it at filing and fixes it.

Evidence (verified: commands with output, file:line, measurements)

Measured 2026-11-27 on the plugin-deploy-pod CDI bed (kind:local deploy over a pod
unit, CDI GPU + a bind at /data), three consecutive runs of the same script:

run 2026.331.1108 (a RESTARTED unit):
== start
== charly start rc=0
== write the bind from INSIDE the container
touch: cannot touch '/data/probe': No such file or directory
== charly cmd rc=1

run 2026.331.1109 (again a restart): identical failure, 11.3s into the phase.

the SAME command a minute later, same container:
$ charly cmd pod-cdi-keepid-bind "sh -c 'ls -la / | grep data'"
drwxr-xr-x 0 user user 40 Nov 27 11:08 data # the mount IS there

the FIRST run of the day (a FRESH create of that unit) passed the identical cmd.

the unit is correct:
$ grep -E '^(Volume|UserNS)=' ~/.config/containers/systemd/charly-pod-cdi-keepid-bind.container
Volume=/tmp/charly-cdi-keepid-bind:/data
Volume=/usr/lib/libcuda.so.1:/usr/lib/libcuda.so.1:ro (… 105 read-only lib binds)
UserNS=keep-id:uid=1000,gid=1000

Mechanism

After charly start returns 0 for an ALREADY-EXISTING pod unit, the container's bind mounts are not yet visible: a charly cmd issued immediately fails with '/data: No such file or directory', while the same cmd a minute later sees the mount and a FRESH create of the same unit passes. So the waiter covers creation but not a restart, and any script that does start -> act-on-a-mounted-path races it.

Missed control

The bed that found it assumed start => ready, and the first run (a create) passed, so the restart path had never been exercised by that assertion.

Blast radius

every deploy script, bed step or agent action that starts a unit and immediately touches a bind-mounted path: intermittent 'No such file or directory' with an exit 0 from start.

Root fix

Make charly start wait until the container is actually up and its mounts are present (the same bounded readiness the create path has), or return a distinct 'started but not ready' state so callers can poll instead of racing.

Spike (its result, or none with the reason)

none yet: measured three times on the real unit (two restarts failed, one create passed, a later cmd saw the mount)

Found while re-proving opencharly/plugin-deploy-pod#103's bed against the keep-id contract.

Agent: cdi-audit · Claude Code session f760307f-53b4-4f48-87da-00f95e5300ed
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)

Activity

  1. aitrawog commented on Nov 27, 2026

    @aitrawog
    ContributorAuthor

    CLAIM

    Filed as blocking: it blocks this session's own progress, so this session claims it at filing and fixes it.

    Agent: cdi-audit · Claude Code session f760307f-53b4-4f48-87da-00f95e5300ed
    Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)

  2. added
    category:runtime
    type:fix
    on Nov 27, 2026
  3. self-assigned this
    on Nov 27, 2026
  4. aitrawog commented on Nov 27, 2026

    @aitrawog
    ContributorAuthor

    STATUS

    STATUS — implementing this now, and one ownership correction to record.

    The remedy's code is in opencharly/plugin-deploy-pod, not this repo. The measurement is exact: charly start resolves a pod plan and the plugin runs it — podStart (candy/plugin-deploy-pod/lifecycle.go) → podContainerStart → systemctl --user start <svc>, which returns as soon as the job is queued; nothing polls the container after it. So the fix lands as a plugin-deploy-pod PR that closes this issue, and the issue stays here because the failing VERB (charly start) and its diagnosis belong to this repo's user-facing surface.

    Reproduced today, twice, on the real unit (pod-cdi-keepid-bind, keep-id + CDI + a bind at /data):

    fresh create:  charly start rc=0 → charly cmd "test -e /data" rc=0, DATA-PRESENT
    restart #1:    charly start rc=0 (1778ms) → /data absent at +0ms, PRESENT at +1645ms
    restart #2:    charly start rc=0 (1748ms) → /data PRESENT at +1ms   (the race did not fire)
    

    So the window is real and INTERMITTENT (1.6s here, ~11s in the filing), which is exactly why the fix must be a bounded wait on the engine's own state and not a sleep.

    The spike's discriminating fact: a container that is not yet running has an EMPTY mount namespace — podman exec into a created-but-not-started container succeeds and sees no mounts, which is the touch: cannot touch '/data/probe' symptom. The engine's State.Status is therefore the signal, and the fix polls it, bounded, after start (candidates and their measurements will be pasted in the PR body).

    Agent: cdi-audit · Claude Code session f760307f-53b4-4f48-87da-00f95e5300ed
    Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)

    Agent: cdi-audit · Claude Code session f760307f-53b4-4f48-87da-00f95e5300ed
    Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)

  5. aitrawog commented on Nov 27, 2026

    @aitrawog
    ContributorAuthor

    RESOLVED — fixed in opencharly/plugin-deploy-pod#107 (70368953aa45c05488ae0dbe9080f6c998ce01e3).

    podStart now waits for the container the start command created to report running before returning, so the mount-namespace window is gone:

    • start_ready.go — waitContainerRunning / pollContainerRunning: inspect {{.State.Status}} until running, 1 s cadence, 10 s per attempt, 60 s deadline, over the shared poll.PollUntil primitive (no new mechanism, no sleep).
    • readiness.go — startEngineBin is now the ONE engine-binary resolution, used by both post-start waits (the declared-readiness wait's inline copy is deleted).
    • lifecycle.go — the wait runs immediately after podContainerStart, before the declared readiness probe, the tunnel and the caller.

    Why this signal and not a delay: a container that is not yet running has an EMPTY mount namespace — podman exec into a created-but-not-started container succeeds and sees none of its mounts, which is exactly the touch: cannot touch '/data/probe' symptom. The window was measured at 1.6 s in one run and ~11 s in the filing, so a fixed delay would be both wrong and forbidden (R3).

    Proof on the merged head: four new tests, the discriminator being created, created, running — the poll must inspect at least three times, and a single read is exactly the defect; plus charly check run check-pod-cdi-userns PASS (steps=6, 0 skipped) and three stop/start cycles each leaving /data present at the first charly cmd after start returned.

    One correction recorded for honesty: the first bed run FAILED at the bind write, and the cause was a leftover deploy of the same name from the pre-fix spike still running — not the fix. It was removed, the host confirmed clean, and the bed then passed; that RCA is in the PR body.

    Agent: cdi-audit · Claude Code session f760307f-53b4-4f48-87da-00f95e5300ed
    Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

category:runtimetype:fix

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions