Skip to content

check-roster lanes share one process, and concurrent plugin loads race (spurious 'dependency cycle', a 'concurrent map writes' crash) #160

Todo

Description

@aitrawog

Category

category:runtime

Type

type:fix

Remedy / files the remedy will touch

Run each roster lane's bed as its own charly check run process, so no two lanes share the loader, the provider registry or the CUE runtime

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

plugin-check roster.go runRosterBed/runCheckBed; charly plugin_loader.go loadProjectPlugins, recordScopedOutPlugin; plugin_requires.go registerPluginRequires

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)

The loader roster check-loader-roster (lanes: 2) on charly 2026.336.1219 logged, before any bed started:

$ sed -n 18p /tmp/cs/kc-roster.log | cut -c1-200
warning: plugin load: plugin dependency cycle: github.com/opencharly/plugin-example-require/candy/plugin-example-require and plugin-example-require both provide verb:examplerequire

Every project-resolve line before it is printed twice (charly: resolving project (first run — may take a moment)... x2, Resolved @github.com/opencharly/plugin-vm -> main x2): the two lanes loaded at once. The lanes are goroutines of one process (plugin-check roster.go: sem := make(chan struct{}, lanes) ... go func() ... runCheckBed), and each bed calls the host seams check-load-plugins, loader-threaded, cli and check-bed-gpu-prereq in-process (plugin-check bed_run.go).

A test that calls the check-load-plugins seam (hostBuildCheckLoadPlugins) from two goroutines for two roster beds, run on the #1340 branch:

$ go test -race -count=1 -run TestCheckLoadPluginsSeam_ConcurrentLanes . > /tmp/cs/seam-nofix.log 2>&1; echo "rc=$?"; grep -c 'WARNING: DATA RACE' /tmp/cs/seam-nofix.log
rc=1
79387

A sibling test calling loadProjectPlugins concurrently (no -race) crashed the process:

fatal error: concurrent map writes
github.com/opencharly/charly/charly.recordScopedOutPlugin(...)
github.com/opencharly/charly/charly.loadProjectPlugins(...)
github.com/opencharly/charly/charly.connectPluginByWordRef(...)
github.com/opencharly/charly/charly.registerPluginRequires(...)

Under -race the reports are almost all inside the shared CUE evaluator (cuelang.org/go/internal/core/adt.(*scheduler).signal() 42122, (*nodeContext).completeNodeTasks() 26354, ...), plus runtime.mapassign in the loader.

Mechanism

A check-roster runs its lanes as goroutines of one charly process. Each lane's bed calls host seams (check-load-plugins, loader-threaded, cli, check-bed-gpu-prereq) that load the project and connect plugins against process-wide state: the provider registry, the requires in-flight gate, the scoped-out record map and the shared CUE runtime. None is safe for concurrent use. Two lanes loading the same plugin under two candy keys trip the requires gate as a false 'dependency cycle'. An unlocked map write (recordScopedOutPlugin) can crash the process, and the CUE evaluator races on shared values.

Missed control

No test ran two roster lanes (or the seams they call) concurrently, and no roster bed ran under the race detector. The roster's lanes looked independent because every bed PHASE is a charly subprocess. The per-bed prelude that runs in the roster process was overlooked.

Blast radius

Every check-roster with lanes > 1 (the default is numCPU): a spurious load warning, a plugin missing from a lane, or a fatal crash of the whole roster. Single-bed charly check run is unaffected.

Root fix

plugin-check runs each lane's bed as a 'charly check run ' subprocess and maps its exit code (0/1/2/3) to the roster outcome. The roster process then never loads concurrently. A test runs two lanes and asserts each ran in its own process.

Spike (its result, or none with the reason)

Not run yet; the round runs on the fix branch. Candidates: (A) a process-wide mutex on the check-load-plugins seam, which would also need loader-threaded, cli and gpu-prereq under the same lock, so it is brittle; (B) one subprocess per lane. Fine-grained locks are ruled out: the CUE evaluator itself races (79387 race reports).

Agent: vol-cdi · Claude Code session 8daa865c-d43e-447b-90b3-7d16ccc921d7
Assisted-by: Claude Code Anthropic Claude Opus 5.5 (analysed on a live system)

Activity

  1. aitrawog commented on Dec 2, 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: vol-cdi · Claude Code session 8daa865c-d43e-447b-90b3-7d16ccc921d7
    Assisted-by: Claude Code Anthropic Claude Opus 5.5 (analysed on a live system)

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

    @aitrawog
    ContributorAuthor

    STATUS

    Re-classified as non-blocking, and vol-cdi releases its claim.

    Agent: vol-cdi · Claude Code session 8daa865c-d43e-447b-90b3-7d16ccc921d7
    Assisted-by: Claude Code Anthropic Claude Opus 5.5 (analysed on a live system)

  5. removed their assignment
    on Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:runtimetype:fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions