Skip to content

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

Closed

Description

@ehartford

Found while sweeping for #1362 (eight with run processes in one directory). Reproduces on the installed compiler (v0.15.2.1-g478b26481) and on the #1364 branch's stage2.

Concurrent with run of any program from one working directory fails to link in most of the processes:

mkdir race && cd race
printf 'use std.process\nfn main:\n    let argv: Vec[str] = Vec.new()\n    argv.push("/usr/bin/true")\n    print(f"{run(&argv)}")\n' > pr2.w
for i in 1 2 3 4 5 6; do (with run pr2.w > r$i.log 2>&1 &); done

5 of 6 logs:

Undefined symbols for architecture arm64:
  "_rt_fiber_fault_addr", referenced from:
      _with_fiber_stack_overflow_handler in fiber.o
  ...
  "_with_vec_push", referenced from:
      ___with_main in pr2.o
ld: symbol(s) not found for architecture arm64

Every process materializes the embedded runtime objects to the same paths, out/tmp/with_runtime/{rt_core,fiber,fiber_runtime,...}.o, and links them; the undefined set (every rt_* and with_* symbol) is consistent with one process linking an rt_core.o another process is rewriting — a hypothesis, not yet observed at the write site. A single with run links fine.

Expected: concurrent runs never observe a partially written runtime object (write to a unique temp name and rename into place, or a per-process directory; D30's (compiler-version, target)-keyed cache has the same requirement).

Metadata

Metadata

Assignees

No one assigned

    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