Skip to content

Windows cache corruption after repeatedly running tests #12664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jcmoyer opened this issue Aug 28, 2022 · 1 comment
Closed

Windows cache corruption after repeatedly running tests #12664

jcmoyer opened this issue Aug 28, 2022 · 1 comment
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@jcmoyer
Copy link
Contributor

jcmoyer commented Aug 28, 2022

Zig Version

0.10.0-dev.3659+e5e6eb983

Steps to Reproduce

This is a weird issue and I'm not entirely sure how to trigger it. Over time, tests begin to fail building more frequently. Here's an example on a brand new project:

// build.zig
const std = @import("std");

pub fn build(b: *std.build.Builder) void {
    const a_tests = b.addTest("src/a.zig");
    const b_tests = b.addTest("src/b.zig");
    const c_tests = b.addTest("src/c.zig");

    const test_step = b.step("test", "Run unit tests");
    test_step.dependOn(&a_tests.step);
    test_step.dependOn(&b_tests.step);
    test_step.dependOn(&c_tests.step);
}
// a.zig, b.zig, c.zig all contain the following
test {}

I'm not sure if this problem also exists on stage1 because self-hosted recompiles things every zig build test, but stage1 just runs the cached test binaries.

Expected Behavior

There shouldn't be any build failures.

Actual Behavior

Command line output:

d:\Scratch\testfailure>zig init-exe
info: Created build.zig
info: Created src\main.zig
info: Next, try `zig build --help` or `zig build run`

[fill in the files using the above snippets]

d:\Scratch\testfailure>zig build test
All 1 tests passed.
All 1 tests passed.
All 1 tests passed.

d:\Scratch\testfailure>zig build test
All 1 tests passed.
All 1 tests passed.
All 1 tests passed.

d:\Scratch\testfailure>zig build test
All 1 tests passed.
All 1 tests passed.
All 1 tests passed.

d:\Scratch\testfailure>zig build test
LLD Link... warning(link): failed to write cache manifest when linking: LockViolation
All 1 tests passed.
All 1 tests passed.
All 1 tests passed.

d:\Scratch\testfailure>zig build test
All 1 tests passed.
All 1 tests passed.
All 1 tests passed.

d:\Scratch\testfailure>zig build test
All 1 tests passed.
All 1 tests passed.
All 1 tests passed.

d:\Scratch\testfailure>zig build test
All 1 tests passed.
LLD Link... warning(link): failed to write cache manifest when linking: LockViolation
All 1 tests passed.
All 1 tests passed.

d:\Scratch\testfailure>zig build test
LLD Link... warning(link): failed to write cache manifest when linking: LockViolation
All 1 tests passed.
LLD Link... warning(link): failed to write cache manifest when linking: LockViolation
All 1 tests passed.
All 1 tests passed.

d:\Scratch\testfailure>zig build test
All 1 tests passed.
LLD Link... warning(link): failed to write cache manifest when linking: LockViolation
All 1 tests passed.
LLD Link... warning(link): failed to write cache manifest when linking: LockViolation
All 1 tests passed.

d:\Scratch\testfailure>zig build test
All 1 tests passed.
LLD Link... warning(link): failed to write cache manifest when linking: LockViolation
All 1 tests passed.
All 1 tests passed.

d:\Scratch\testfailure>zig build test
LLD Link... warning(link): failed to write cache manifest when linking: LockViolation
All 1 tests passed.
error: InvalidFormat
error: test...
error: The following command exited with error code 1:
D:\Scratch\zig-install\bin\zig.exe test D:\Scratch\testfailure\src\b.zig --cache-dir D:\Scratch\testfailure\zig-cache --global-cache-dir C:\Users\jcmoyer\AppData\Local\zig --name test --enable-cache
error: the following build command failed with exit code 1:
d:\Scratch\testfailure\zig-cache\o\6be072760b1c422c81d96f0d8413e4e5\build.exe D:\Scratch\zig-install\bin\zig.exe d:\Scratch\testfailure d:\Scratch\testfailure\zig-cache C:\Users\jcmoyer\AppData\Local\zig test

d:\Scratch\testfailure>zig build test
LLD Link... warning(link): failed to write cache manifest when linking: LockViolation
All 1 tests passed.
error: InvalidFormat
error: test...
error: The following command exited with error code 1:
D:\Scratch\zig-install\bin\zig.exe test D:\Scratch\testfailure\src\b.zig --cache-dir D:\Scratch\testfailure\zig-cache --global-cache-dir C:\Users\jcmoyer\AppData\Local\zig --name test --enable-cache
error: the following build command failed with exit code 1:
d:\Scratch\testfailure\zig-cache\o\6be072760b1c422c81d96f0d8413e4e5\build.exe D:\Scratch\zig-install\bin\zig.exe d:\Scratch\testfailure d:\Scratch\testfailure\zig-cache C:\Users\jcmoyer\AppData\Local\zig test

d:\Scratch\testfailure>zig build test
LLD Link... warning(link): failed to write cache manifest when linking: LockViolation
All 1 tests passed.
All 1 tests passed.
LLD Link... warning(link): failed to write cache manifest when linking: LockViolation
All 1 tests passed.

d:\Scratch\testfailure>zig build test
All 1 tests passed.
LLD Link... warning(link): failed to write cache manifest when linking: LockViolation
All 1 tests passed.
LLD Link... warning(link): failed to write cache manifest when linking: LockViolation
All 1 tests passed.

d:\Scratch\testfailure>zig build test
LLD Link... warning(link): failed to write cache manifest when linking: LockViolation
All 1 tests passed.
All 1 tests passed.
All 1 tests passed.

d:\Scratch\testfailure>zig build test
All 1 tests passed.
error: InvalidFormat
error: test...
error: The following command exited with error code 1:
D:\Scratch\zig-install\bin\zig.exe test D:\Scratch\testfailure\src\b.zig --cache-dir D:\Scratch\testfailure\zig-cache --global-cache-dir C:\Users\jcmoyer\AppData\Local\zig --name test --enable-cache
error: the following build command failed with exit code 1:
d:\Scratch\testfailure\zig-cache\o\6be072760b1c422c81d96f0d8413e4e5\build.exe D:\Scratch\zig-install\bin\zig.exe d:\Scratch\testfailure d:\Scratch\testfailure\zig-cache C:\Users\jcmoyer\AppData\Local\zig test

d:\Scratch\testfailure>zig build test
LLD Link... warning(link): failed to write cache manifest when linking: LockViolation
All 1 tests passed.
All 1 tests passed.
LLD Link... warning(link): failed to write cache manifest when linking: LockViolation
All 1 tests passed.

d:\Scratch\testfailure>zig build test
LLD Link... warning(link): failed to write cache manifest when linking: LockViolation
All 1 tests passed.
error: InvalidFormat
error: test...
error: The following command exited with error code 1:
D:\Scratch\zig-install\bin\zig.exe test D:\Scratch\testfailure\src\b.zig --cache-dir D:\Scratch\testfailure\zig-cache --global-cache-dir C:\Users\jcmoyer\AppData\Local\zig --name test --enable-cache
error: the following build command failed with exit code 1:
d:\Scratch\testfailure\zig-cache\o\6be072760b1c422c81d96f0d8413e4e5\build.exe D:\Scratch\zig-install\bin\zig.exe d:\Scratch\testfailure d:\Scratch\testfailure\zig-cache C:\Users\jcmoyer\AppData\Local\zig test
@jcmoyer jcmoyer added the bug Observed behavior contradicts documented or intended behavior label Aug 28, 2022
@jcmoyer
Copy link
Contributor Author

jcmoyer commented Aug 30, 2022

Closing this as I can no longer reproduce the problem as of 527055a and having switched from MSVC to zig-bootstrap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

1 participant