Skip to content

with run: each invocation builds in a directory of its own (#1374) - #1511

Merged
ehartford merged 1 commit into
fix-1465-cimport-cache-warningsfrom
fix-1374-run-private-artifacts
Sep 23, 2026
Merged

ehartford merged 1 commit into
fix-1465-cimport-cache-warningsfrom
fix-1374-run-private-artifacts

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Closes #1374.

Root cause (not the runtime objects). The extraction to out/tmp/with_runtime is already a unique temp file renamed into place. Eight concurrent with run of eight differently named copies of one program in one fresh directory pass (3 rounds, 24/24); eight concurrent runs of the same program fail (3 rounds: 19 rc=1 link failures, 5 rc=127).

with run prog.w built to link_stage_output_path_for_source: out/prog, its object out/prog.o, and the object's nm report out/prog.o.undef (link_stage_undefined_symbols_for_object), all named by the source alone.

Proof (installed v0.15.2.1, lldb): run A stopped at runtime_read_file called from link_stage_undefined_symbols_for_object, with out/p1.o and out/p1.o.undef (363 bytes) on disk; run B of the same file ran to completion (1 0, rc=0) and left neither file; A continued and failed with clang: error: no such file or directory: 'out/p1.o'. Unpaused, the same overlap reads another run's truncated or deleted report: undef is empty, link_stage_undefined_symbols_need_helpers_runtime says no runtime, and the link lacks rt_core ("_with_vec_push" undefined — the issue's symptom); a run whose binary another run's cleanup deleted exits 127.

Fix. run_run_command builds into <out>/<dir>/run.<pid>.<nanos>/<stem> and removes that directory after the program exits (or after a failed build). The binary keeps the source's stem, so argv[0]'s basename is unchanged.

Test. test/behavior/behav_run_concurrent_same_program.w runs eight with run of one program from eight threads in one case directory; with the installed compiler runs fail with _with_vec_push undefined and rc=127; with the tree's stage2 all eight print ran 7 and no per-run file remains.

Found on the way: #1471 (closures made in a loop capture a Copy local by place; the fixture spells one closure site per thread).

@ehartford
ehartford added this pull request to stack #1516 September 23, 2026 15:59
@ehartford

Copy link
Copy Markdown
Contributor Author

Stack #1516 battery (seed-driven, new seed, cold c_import cache, with :drop-audit/:move-audit) on main + #1509 → … → #1515 (head 63e8340): build ok, :fixpoint ok (stage2 == stage3 with DWARF variables), :drop-audit ok, :move-audit ok, :test ok (no reds), :test-green ok, :last-green ok. Merge the stack: gh stack merge 1515 --squash.

@ehartford
ehartford marked this pull request as ready for review September 23, 2026 16:30
The shared runtime objects are not the race: their extraction to
out/tmp/with_runtime is already a unique temp file renamed into place, and
eight concurrent `with run` of eight differently named copies of one program
in one fresh directory pass (3 rounds, 24/24). Eight concurrent runs of the
SAME program fail (3 rounds: 19 rc=1 link failures, 5 rc=127).

`with run prog.w` built to link_stage_output_path_for_source: out/prog, its
object out/prog.o and the object's nm report out/prog.o.undef
(link_stage_undefined_symbols_for_object), all named by the source alone.
Proven by interleaving under lldb (installed v0.15.2.1): run A stopped at
runtime_read_file called from link_stage_undefined_symbols_for_object, with
out/p1.o and out/p1.o.undef (363 bytes) on disk; run B of the same file ran
to completion (`1 0`, rc=0) and left neither file; A continued and failed
with `clang: error: no such file or directory: 'out/p1.o'`. Unpaused, the
same overlap reads another run's truncated or deleted report: undef is
empty, link_stage_undefined_symbols_need_helpers_runtime says no runtime,
and the link lacks rt_core ("_with_vec_push" undefined, the issue's
symptom); a run whose binary another run's cleanup deleted exits 127.

run_run_command now builds into <out>/<dir>/run.<pid>.<nanos>/<stem> and
removes that directory after the program exits (or after a failed build).

test/behavior/behav_run_concurrent_same_program.w runs eight `with run` of
one program from eight threads in one case directory; with the installed
compiler as the p7 compiler, runs fail with `_with_vec_push` undefined and
rc=127.
@ehartford
ehartford force-pushed the fix-1374-run-private-artifacts branch from a9da74f to 8589e3d Compare September 23, 2026 19:37
@ehartford
ehartford merged commit 2f66c19 into main Sep 23, 2026
@ehartford
ehartford deleted the fix-1374-run-private-artifacts branch September 24, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Concurrent with run in one directory: link fails with undefined rt_*/with_* symbols (shared out/tmp/with_runtime/*.o rewritten mid-link)

1 participant