Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Subcompilation fails when build-exe executed in parallel #9439

@zeramorphic

Description

@zeramorphic

Executing the zig compiler (specifically zig build-exe) multiple times in parallel can occasionally cause subcompilations to fail. This issue is present on both Ubuntu and Windows, running from the master branch. A sample of error messages:

Locally on Windows:
error: sub-compilation of compiler_rt failed
    C:\Users\<name>\.quill\compiler-deps\zig\lib\zig\std\special\compiler_rt\compareXf2.zig:10:21: error: unable to load 'C:\\Users\\<name>\\AppData\\Local\\zig\\o\\1e050970caac7a47b47d926ff10336fa\builtin.zig': UnexpectedEndOfFile

CI on Ubuntu:
error: sub-compilation of compiler_rt failed
    /opt/hostedtoolcache/zig/zig-linux-x86_64-0.9.0-dev.453+7ef854682/x64/lib/std/special/compiler_rt/mulodi4.zig:6:25: error: unable to load '/home/runner/.cache/zig/o/7b7987c94a9484a14de4c027d3e08478/builtin.zig': UnexpectedEndOfFile

CI on Windows:
error: sub-compilation of libssp failed
    C:\hostedtoolcache\windows\zig\zig-windows-x86_64-0.9.0-dev.477+00e944f71\x64\lib\zig\std\start.zig:8:22: error: unable to load 'C:\\Users\\runneradmin\\AppData\\Local\\zig\\o\\0e84b4fe2fc2fbd9bba0df21f28dc564\builtin.zig': UnexpectedEndOfFile

This can happen during CI runs (1, 2). In this project, I'm using zig as essentially a portable linker, so the test suite calls build-exe dozens of times in different threads. Without changes to my code, the same test can succeed or fail seemingly at random.

At a guess, it looks like there might be a race condition between different invocations of the compiler writing to and reading from files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions