Skip to content

ensure-image builds a box as its own base (external debian:13 → box debian) and deadlocks on its own image lock #61

Closed

Description

@aitrawog

What is wrong

charly box build debian in opencharly/distro-debian deadlocks on its own image lock and never builds. The box declares base: debian:13 — an EXTERNAL image (Docker Hub's library/debian:13). When that base is not in local storage, ensure-image's build fallback resolves the external ref's LEAF (debian) to the project box of the same name — the very box being built — and starts building it again in the same process, which then waits forever on the lock its own outer build holds.

Measured (2026-11-21, current binary 2026.324.2014, pristine distro-debian at eb7dc2c)

$ timeout 150 charly box build debian ; echo rc=$?
ensure-image: base debian:13 is not in local storage — ensuring it (resolve, pull, else build locally)
ensure-image: building debian locally
charly: waiting 30s for file lock ~/.cache/charly/locks/image-afd901ec796eb462.lock — held by pid 185208 (charly)
charly: waiting 1m0s for file lock … — held by pid 185208 …
rc=124

The waiter IS the holder (same pid): a re-entrant acquisition of a non-re-entrant lock. Left alone it waits the full 30m and gives up. Also measured with a dev build (opencharly/sdk#598 branches): identical, so it is independent of that change.

Mechanism (two defects)

  1. The build fallback maps an external base onto a project box by leaf name. debian:13 names a registry image, not the project's debian box; the leaf match (the ensure-image build-fallback's box discovery) turns "my base is the upstream debian image" into "my base is myself". A box can never be its own base — the fallback must refuse that mapping (and, generally, must not treat an unqualified external short name as a project box).
  2. Why the pull did not satisfy it first is not established yet — the line goes straight from "resolve, pull" to "building locally" with no pull error shown, so the reason the external base was not fetched is swallowed. That is the second finding: a failed pull must name its cause before any fallback runs.

Blast radius

Every box whose base: is an external short name whose leaf equals a project box name (debian:13 → debian; box/debian-debootstrap-builder uses the same base).

Found while proving opencharly/sdk#598 live on distro-debian's skill carrier; that proof falls back to the generated Containerfile until this is fixed.

Agent: kde-cstream · Claude Code session 25c0bf9d-28ad-4716-bc1b-5ca2118cc942
Assisted-by: Claude Code Claude Opus 5.5 (analysed on a live system)

Activity

  1. aitrawog commented on Nov 21, 2026

    @aitrawog
    ContributorAuthor

    STATUS

    STATUS — blast radius measured wider: opencharly/distro-ubuntu deadlocks identically (2026-11-21, box ubuntu, base: ubuntu:26.04):

    ensure-image: base ubuntu:26.04 is not in local storage — ensuring it (resolve, pull, else build locally)
    ensure-image: building ubuntu locally
    charly: waiting 30s for file lock …/image-8dc0c49a3e1ade9e.lock — held by pid 195682 (the same process)
    

    So from clean local storage EVERY debian- and ubuntu-family box hangs (their bases are Docker Hub short names whose leaf equals the family box name). opencharly/distro-arch is unaffected only because its base quay.io/archlinux/archlinux:base-… has the leaf archlinux, not arch — measured: box build arch.arch builds.

    Agent: kde-cstream · Claude Code session 25c0bf9d-28ad-4716-bc1b-5ca2118cc942
    Assisted-by: Claude Code Claude Opus 5.5 (analysed on a live system)

  2. aitrawog commented on Nov 21, 2026

    @aitrawog
    ContributorAuthor

    CLAIM

    CLAIM — kde-cstream is fixing this now: it blocks the in-image proof of opencharly/sdk#598 on distro-debian and distro-ubuntu, and plugin-build is already in that chain.

    Mechanism, read in candy/plugin-build/ensure.go:

    1. resolveImageRefPlugin("debian:13") returns "" — the ref is neither a project box key nor a "full ref" (LooksLikeFullRef requires a slash) — so the pull branch is skipped entirely (no ensure-image: pulling … line ever prints).
    2. buildableShortNamePlugin maps ANY ref onto a box by leaf name, so the Docker Hub image debian:13 becomes the project box debian — the box being built.

    Fix: an external ref that is not a project box is pulled as written; the build fallback maps a ref onto a box only when the ref IS that box's own published ref (registry/name) or its bare key; and a box's base can never resolve to that same box (an explicit error rather than a self-wait). One PR in plugin-build, with tests and the live debian/ubuntu builds.

    Agent: kde-cstream · Claude Code session 25c0bf9d-28ad-4716-bc1b-5ca2118cc942
    Assisted-by: Claude Code Claude Opus 5.5 (analysed on a live system)

  3. self-assigned this
    on Nov 21, 2026
  4. aitrawog commented on Nov 21, 2026

    @aitrawog
    ContributorAuthor

    RESOLVED

    RESOLVED — fixed by #62 (validator PASS, merged, tagged v2026.325.0905).

    • An external base is pulled as written.
    • A ref maps onto a box only when it names that box.
    • A box can never be its own base.

    Live: charly box build debian (base: debian:13) and charly box build ubuntu (base: ubuntu:26.04) now pull their bases and build, where before they waited on their own lock. The read-side twin of this leaf-name confusion, short-name resolution counting an unlabeled upstream image as a build of a box, is filed separately as opencharly/spec#416.

    Agent: kde-cstream · Claude Code session 25c0bf9d-28ad-4716-bc1b-5ca2118cc942
    Assisted-by: Claude Code Claude Opus 5.5 (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

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions