ziglang/zig
262
5.9k
Fork
You've already forked zig
760

Frequent internal test runner failure: EndOfStream on powerpc64le-linux #31562

Open
opened 2026年03月18日 12:20:33 +01:00 by alexrp · 5 comments

Since the merge of #31403, we've seen this failure frequently on PowerPC. I've only seen it when the test runner is built in release modes. The build mode of the compiler does not seem to matter.

test
mq test-modules
 mq test-std
 mq run test std-native-pwr10-ReleaseSafe-libc failure
thread 947389 panic: internal test runner failure: EndOfStream
/home/ci/.cache/act/4a7b3683960aac35/hostexecutor/lib/compiler/test_runner.zig:68:60: 0x11e18af in main (test)
 return mainServer(init) catch |err| std.debug.panic("internal test runner failure: {t}", .{err});
 ^
???:?:?: 0x3fff94796f0b in ??? (/lib/powerpc64le-linux-gnu/libc.so.6)
???:?:?: 0x3fff9479714b in ??? (/lib/powerpc64le-linux-gnu/libc.so.6)
error: test process unexpectedly terminated with signal ABRT
failed command: /home/ci/.cache/act/4a7b3683960aac35/hostexecutor/zig-local-cache/o/a5a8897b77e0551d7332cca83deffa41/test --cache-dir=/home/ci/.cache/act/4a7b3683960aac35/hostexecutor/zig-local-cache --seed=0x9b11b31b --listen=-
Since the merge of https://codeberg.org/ziglang/zig/pulls/31403, we've seen this failure frequently on PowerPC. I've only seen it when the test runner is built in release modes. The build mode of the compiler does not seem to matter. ``` test mq test-modules mq test-std mq run test std-native-pwr10-ReleaseSafe-libc failure thread 947389 panic: internal test runner failure: EndOfStream /home/ci/.cache/act/4a7b3683960aac35/hostexecutor/lib/compiler/test_runner.zig:68:60: 0x11e18af in main (test) return mainServer(init) catch |err| std.debug.panic("internal test runner failure: {t}", .{err}); ^ ???:?:?: 0x3fff94796f0b in ??? (/lib/powerpc64le-linux-gnu/libc.so.6) ???:?:?: 0x3fff9479714b in ??? (/lib/powerpc64le-linux-gnu/libc.so.6) error: test process unexpectedly terminated with signal ABRT failed command: /home/ci/.cache/act/4a7b3683960aac35/hostexecutor/zig-local-cache/o/a5a8897b77e0551d7332cca83deffa41/test --cache-dir=/home/ci/.cache/act/4a7b3683960aac35/hostexecutor/zig-local-cache --seed=0x9b11b31b --listen=- ```
alexrp added this to the Urgent milestone 2026年03月18日 12:20:33 +01:00
alexrp changed title from (削除) Frequent internal test runner failure: EndOfStream on PowerPC (削除ここまで) to Frequent internal test runner failure: EndOfStream on powerpc64le-linux 2026年03月18日 12:23:19 +01:00
Author
Owner
Copy link

Some more findings:

  • It only happens with --listen=-.
  • It only happens with -lc.

ReleaseSafe error trace with a slightly modified test runner:

test-std
└─ run test std-native-pwr10-ReleaseSafe-libc failure
[default] (err): EndOfStream
/home/ci/zig-repro/lib/compiler/test_runner.zig:68:9: 0x1202e4f in mainServer (test)
 return mainServer(init);
 ^
/home/ci/zig-repro/lib/compiler/test_runner.zig:68:9: 0x1202e57 in mainServer (test)
 return mainServer(init);
 ^
/home/ci/zig-repro/lib/compiler/test_runner.zig:102:60: 0x1202e1f in mainServer (test)
 defer if (testing.allocator_instance.deinit() == .leak) {
 ^
/home/ci/zig-repro/lib/compiler/test_runner.zig:68:9: 0x1202e27 in main (test)
 return mainServer(init);
 ^
error: test process unexpectedly exited with code 1
failed command: ./.zig-cache/o/164cda2816ad0972e13e50279f45dea7/test --cache-dir=./.zig-cache --seed=0x7dcb0c2f --listen=-

🤨

Some more findings: * It only happens with `--listen=-`. * It only happens with `-lc`. ReleaseSafe error trace with a slightly modified test runner: ``` test-std └─ run test std-native-pwr10-ReleaseSafe-libc failure [default] (err): EndOfStream /home/ci/zig-repro/lib/compiler/test_runner.zig:68:9: 0x1202e4f in mainServer (test) return mainServer(init); ^ /home/ci/zig-repro/lib/compiler/test_runner.zig:68:9: 0x1202e57 in mainServer (test) return mainServer(init); ^ /home/ci/zig-repro/lib/compiler/test_runner.zig:102:60: 0x1202e1f in mainServer (test) defer if (testing.allocator_instance.deinit() == .leak) { ^ /home/ci/zig-repro/lib/compiler/test_runner.zig:68:9: 0x1202e27 in main (test) return mainServer(init); ^ error: test process unexpectedly exited with code 1 failed command: ./.zig-cache/o/164cda2816ad0972e13e50279f45dea7/test --cache-dir=./.zig-cache --seed=0x7dcb0c2f --listen=- ``` 🤨
Author
Owner
Copy link

ReleaseFast error trace, which surprisingly seems more relevant than the ReleaseSafe one:

test-std
└─ run test std-native-pwr10-ReleaseFast-libc failure
[default] (err): EndOfStream
/home/ci/zig-repro/lib/std/Io/Reader.zig:690:33: 0x120905b in readSliceAll (test)
 error.ReadFailed => return error.ReadFailed,
 ^
/home/ci/zig-repro/lib/std/zig/Server.zig:152:5: 0x1209063 in receiveMessage (test)
 return s.in.takeStruct(InMessage.Header, .little);
 ^
/home/ci/zig-repro/lib/std/hash_map.zig:1517:17: 0x1208867 in mainServer (test)
 self.available = 0;
 ^
/home/ci/zig-repro/lib/compiler/test_runner.zig:68:9: 0x120886f in main (test)
 return mainServer(init);
 ^
error: test process unexpectedly exited with code 1
failed command: ./.zig-cache/o/0fda276b7b6b411dcb2dd54333f68294/test --cache-dir=./.zig-cache --seed=0xe6f4bcce --listen=-
ReleaseFast error trace, which surprisingly seems more relevant than the ReleaseSafe one: ``` test-std └─ run test std-native-pwr10-ReleaseFast-libc failure [default] (err): EndOfStream /home/ci/zig-repro/lib/std/Io/Reader.zig:690:33: 0x120905b in readSliceAll (test) error.ReadFailed => return error.ReadFailed, ^ /home/ci/zig-repro/lib/std/zig/Server.zig:152:5: 0x1209063 in receiveMessage (test) return s.in.takeStruct(InMessage.Header, .little); ^ /home/ci/zig-repro/lib/std/hash_map.zig:1517:17: 0x1208867 in mainServer (test) self.available = 0; ^ /home/ci/zig-repro/lib/compiler/test_runner.zig:68:9: 0x120886f in main (test) return mainServer(init); ^ error: test process unexpectedly exited with code 1 failed command: ./.zig-cache/o/0fda276b7b6b411dcb2dd54333f68294/test --cache-dir=./.zig-cache --seed=0xe6f4bcce --listen=- ```

Reproduced on Android aarch64, Termux, kernel 4.19.157-perf+, Zig 0.16.0:

echo '{}' | zig test lib/compiler/test_runner.zig -lc --listen=-
error: EndOfStream

Without -lc it works. Same behavior as powerpc64le, but on an unsupported kernel (<5.10). Suggests the issue is not arch-specific, but std.Io.Reader interacting badly with glibc when reading from pipes.

Update: actually fails both with and without -lc on 4.19. So it's not glibc-specific, it's kernel.

Reproduced on Android aarch64, Termux, kernel 4.19.157-perf+, Zig 0.16.0: ``` echo '{}' | zig test lib/compiler/test_runner.zig -lc --listen=- error: EndOfStream ``` Without `-lc` it works. Same behavior as powerpc64le, but on an unsupported kernel (<5.10). Suggests the issue is not arch-specific, but `std.Io.Reader` interacting badly with glibc when reading from pipes. Update: actually fails both with and without -lc on 4.19. So it's not glibc-specific, it's kernel.
Author
Owner
Copy link

@Liveiciee wrote in #31562 (comment):

Reproduced on Android aarch64, Termux, kernel 4.19.157-perf+, Zig 0.16.0:

I'm not sure what that command is supposed to demonstrate; you're deliberately violating the test runner protocol, so it'll fail on any system.

@Liveiciee wrote in https://codeberg.org/ziglang/zig/issues/31562#issuecomment-13252818: > Reproduced on Android aarch64, Termux, kernel 4.19.157-perf+, Zig 0.16.0: I'm not sure what that command is supposed to demonstrate; you're deliberately violating the test runner protocol, so it'll fail on any system.
Author
Owner
Copy link

@jacobly's repro from Zulip:

@@ -73,6 +73,7 @@ pub fn main(init: std.process.Init.Minimal) void {

 fn mainServer(init: std.process.Init.Minimal) !void {
 @disableInstrumentation();
+ _ = init;
 var stdin_reader = Io.File.stdin().readerStreaming(runner_threaded_io, &stdin_buffer);
 var stdout_writer = Io.File.stdout().writerStreaming(runner_threaded_io, &stdout_buffer);
 var server = try std.zig.Server.init(.{
@@ -129,12 +130,12 @@ fn mainServer(init: std.process.Init.Minimal) !void {
 },
 .run_test => {
- testing.environ = init.environ;
- testing.allocator_instance = .{};
- testing.io_instance = .init(testing.allocator, .{
- .argv0 = .init(init.args),
- .environ = init.environ,
- });
 log_err_count = 0;
 const index = try server.receiveBody_u32();
 const test_fn = builtin.test_functions[index];
@@ -156,9 +157,10 @@ fn mainServer(init: std.process.Init.Minimal) !void {
 break :s .fail;
 },
 };
- testing.io_instance.deinit();
- const leak_count = testing.allocator_instance.detectLeaks();
- testing.allocator_instance.deinitWithoutLeakChecks();
+ const leak_count = 0;
 try server.serveTestResults(.{
 .index = index,
 .flags = .{
diff --git a/lib/std/Io/Threaded.zig b/lib/std/Io/Threaded.zig
index 14ad2f459f..5cf3c1d695 100644
--- a/lib/std/Io/Threaded.zig
+++ b/lib/std/Io/Threaded.zig
@@ -9641,6 +9641,7 @@ fn fileReadStreamingPosix(file: File, data: []const []u8) File.ReadStreamingErro
 }
 }
+ if (!builtin.is_test and std.os.linux.nanosleep(&.{ .sec = 0, .nsec = std.time.ns_per_ms }, null) != 0) @trap();
 const syscall: Syscall = try .start();
 while (true) {
 const rc = posix.system.readv(file.handle, dest.ptr, @intCast(dest.len));
conststd=@import("std");comptime{for(0..2)|i|_=struct{test{_=i;varparams=std.mem.zeroInit(std.os.linux.io_uring_params,.{});if(std.os.linux.close(@intCast(std.os.linux.io_uring_setup(1,&params)))!=0)@trap();if(std.os.linux.nanosleep(&.{.sec=0,.nsec=25*std.time.ns_per_ms},null)!=0)@trap();}};for(0..2)|i|_=struct{test{_=i;}};}
conststd=@import("std");pubfnbuild(b:*std.Build)void{construn=b.addRunArtifact(b.addTest(.{.root_module=b.createModule(.{.root_source_file=b.path("repro.zig"),.target=b.graph.host,})}));run.has_side_effects=true;b.getInstallStep().dependOn(&run.step);}

This needs to be reduced to a minimal repro, and then (I suspect) reported as a Linux kernel bug.

@jacobly's repro from Zulip: ```diff @@ -73,6 +73,7 @@ pub fn main(init: std.process.Init.Minimal) void { fn mainServer(init: std.process.Init.Minimal) !void { @disableInstrumentation(); + _ = init; var stdin_reader = Io.File.stdin().readerStreaming(runner_threaded_io, &stdin_buffer); var stdout_writer = Io.File.stdout().writerStreaming(runner_threaded_io, &stdout_buffer); var server = try std.zig.Server.init(.{ @@ -129,12 +130,12 @@ fn mainServer(init: std.process.Init.Minimal) !void { }, .run_test => { - testing.environ = init.environ; - testing.allocator_instance = .{}; - testing.io_instance = .init(testing.allocator, .{ - .argv0 = .init(init.args), - .environ = init.environ, - }); log_err_count = 0; const index = try server.receiveBody_u32(); const test_fn = builtin.test_functions[index]; @@ -156,9 +157,10 @@ fn mainServer(init: std.process.Init.Minimal) !void { break :s .fail; }, }; - testing.io_instance.deinit(); - const leak_count = testing.allocator_instance.detectLeaks(); - testing.allocator_instance.deinitWithoutLeakChecks(); + const leak_count = 0; try server.serveTestResults(.{ .index = index, .flags = .{ diff --git a/lib/std/Io/Threaded.zig b/lib/std/Io/Threaded.zig index 14ad2f459f..5cf3c1d695 100644 --- a/lib/std/Io/Threaded.zig +++ b/lib/std/Io/Threaded.zig @@ -9641,6 +9641,7 @@ fn fileReadStreamingPosix(file: File, data: []const []u8) File.ReadStreamingErro } } + if (!builtin.is_test and std.os.linux.nanosleep(&.{ .sec = 0, .nsec = std.time.ns_per_ms }, null) != 0) @trap(); const syscall: Syscall = try .start(); while (true) { const rc = posix.system.readv(file.handle, dest.ptr, @intCast(dest.len)); ``` ```zig const std = @import("std"); comptime { for (0..2) |i| _ = struct { test { _ = i; var params = std.mem.zeroInit(std.os.linux.io_uring_params, .{}); if (std.os.linux.close(@intCast(std.os.linux.io_uring_setup(1, &params))) != 0) @trap(); if (std.os.linux.nanosleep(&.{ .sec = 0, .nsec = 25 * std.time.ns_per_ms }, null) != 0) @trap(); } }; for (0..2) |i| _ = struct { test { _ = i; } }; } ``` ```zig const std = @import("std"); pub fn build(b: *std.Build) void { const run = b.addRunArtifact(b.addTest(.{ .root_module = b.createModule(.{ .root_source_file = b.path("repro.zig"), .target = b.graph.host, }) })); run.has_side_effects = true; b.getInstallStep().dependOn(&run.step); } ``` This needs to be reduced to a minimal repro, and then (I suspect) reported as a Linux kernel bug.
Sign in to join this conversation.
No Branch/Tag specified
master
elfv2
spork8
restricted
0.16.x
panic-rewrite
parking-futex-lockfree
windows-Io-cleanup
Io-watch
ParseCommandLineOptions
windows-async-files
poll-ring
debug-file-leaks-differently
debug-file-leaks
ProcessPrng
elfv2-dyn
jobserver
threadtheft
io-threaded-no-queue
0.15.x
Io.net
comptime-allocator
restricted-function-pointers
cli
wasm-linker-writer
wrangle-writer-buffering
sha1-stream
async-await-demo
fixes
0.14.x
ast-node-methods
macos-debug-info
make-vs-configure
fuzz-macos
sans-aro
ArrayList-reserve
incr-bug
llvm-ir-nosanitize-metadata
ci-tarballs
ci-scripts
threadpool
0.12.x
new-pkg-hash
json-diagnostics
more-doctests
rework-comptime-mutation
0.11.x
ci-perf-comment
stage2-async
0.10.x
autofix
0.9.x
aro
hcs
0.8.x
0.7.x
0.16.0
0.15.2
0.15.1
0.15.0
0.14.1
0.14.0
0.12.1
0.13.0
0.12.0
0.11.0
0.10.1
0.10.0
0.9.1
0.9.0
0.8.1
0.8.0
0.7.1
0.7.0
0.6.0
0.5.0
0.4.0
0.3.0
0.2.0
0.1.1
0.1.0
Labels
Clear labels
abi/f32
abi/ilp32
abi/sf
accepted
This proposal is planned.
arch/21k
arch/6502
arch/aarch64
arch/alpha
arch/amdgcn
arch/arc
arch/arc32
arch/arc64
arch/arm
arch/avr
arch/bfin
arch/bpf
arch/colossus
arch/cris
arch/csky
arch/dlx
arch/epiphany
arch/fr30
arch/frv
arch/hexagon
arch/hppa
arch/hppa64
arch/ia64
arch/kalimba
arch/kvx
arch/lanai
arch/lm32
arch/loongarch32
arch/loongarch64
arch/m32r
arch/m68k
arch/m88k
arch/mcore
arch/microblaze
arch/mips
arch/mips64
arch/mmix
arch/moxie
arch/mrisc32
arch/msp430
arch/nds32
arch/ns32k
arch/nvptx
arch/or1k
arch/powerpc
arch/powerpc64
arch/propeller
arch/riscv32
arch/riscv64
arch/rl78
arch/rx
arch/s390x
arch/sh
arch/sparc
arch/sparc64
arch/spirv
arch/spu
arch/tricore
arch/v850
arch/vax
arch/vc4
arch/ve
arch/wasm
arch/x86
arch/x86_64
arch/xcore
arch/xtensa
autodoc
The web application for interactive documentation and generation of its assets.
backend/c
The C backend outputs C source code.
backend/llvm
The LLVM backend outputs an LLVM bitcode module.
backend/self-hosted
The self-hosted backends produce machine code directly.
binutils
Zig's included binary utilities: zig ar, zig dlltool, zig lib, zig ranlib, zig objcopy, and zig rc.
breaking
Implementing this issue could cause existing code to no longer compile or have different behavior.
build system
The Zig build system - zig build, std.Build, the build runner, and package management.
debug info
An issue related to debug information (e.g. DWARF) produced by the Zig compiler.
docs
An issue with documentation, e.g. the language reference or standard library doc comments.
error message
This issue points out an error message that is unhelpful and should be improved.
frontend
Tokenization, parsing, AstGen, ZonGen, Sema, Legalize, and Liveness.
fuzzing
An issue related to Zig's integrated fuzz testing.
incremental
Reuse of internal compiler state for faster compilation.
lib/c
This issue relates to Zig's libc implementation and/or vendored libcs.
lib/compiler-rt
This issue relates to Zig's compiler-rt library.
lib/cxx
This issue relates to Zig's vendored libc++ and/or libc++abi.
lib/std
This issue relates to Zig's standard library.
lib/tsan
This issue relates to Zig's vendored libtsan.
lib/ubsan-rt
This issue relates to Zig's ubsan-rt library.
lib/unwind
This issue relates to Zig's vendored libunwind.
linking
Zig's integrated object file and incremental linker.
miscompilation
The compiler reports success but produces semantically incorrect code.
os/android
os/contiki
os/dragonfly
os/driverkit
os/emscripten
os/freebsd
os/fuchsia
os/haiku
os/hermit
os/hurd
os/illumos
os/ios
os/linux
os/maccatalyst
os/macos
os/managarm
os/netbsd
os/ohos
os/openbsd
os/plan9
os/redox
os/rtems
os/serenity
os/tvos
os/uefi
os/visionos
os/wasi
os/watchos
os/windows
proposal
This issue suggests language modifications. If it also has the "accepted" label then it is planned.
release notes
This issue or pull request should be mentioned in the release notes.
testing
This issue is related to testing the compiler, standard library, or other parts of Zig.
zig cc
Zig as a drop-in C-family compiler.
zig fmt
The Zig source code formatter.
zig reduce
The Zig source code reduction tool.
bounty
https://ziglang.org/news/announcing-donor-bounties
bug
Observed behavior contradicts documented or intended behavior.
contributor-friendly
This issue is limited in scope and/or knowledge of project internals.
downstream
An issue with a third-party project that uses this project.
enhancement
Solving this issue will likely involve adding new logic or components to the codebase.
infra
An issue related to project infrastructure, e.g. continuous integration.
optimization
A task to improve performance and/or resource usage.
question
No questions on the issue tracker; use a community space instead.
regression
Something that used to work in a previous version stopped working
upstream
An issue with a third-party project that this project uses.
use case
Describes a real use case that is difficult or impossible, but does not propose a solution.
No labels
abi/f32
abi/ilp32
abi/sf
accepted
arch/21k
arch/6502
arch/aarch64
arch/alpha
arch/amdgcn
arch/arc
arch/arc32
arch/arc64
arch/arm
arch/avr
arch/bfin
arch/bpf
arch/colossus
arch/cris
arch/csky
arch/dlx
arch/epiphany
arch/fr30
arch/frv
arch/hexagon
arch/hppa
arch/hppa64
arch/ia64
arch/kalimba
arch/kvx
arch/lanai
arch/lm32
arch/loongarch32
arch/loongarch64
arch/m32r
arch/m68k
arch/m88k
arch/mcore
arch/microblaze
arch/mips
arch/mips64
arch/mmix
arch/moxie
arch/mrisc32
arch/msp430
arch/nds32
arch/ns32k
arch/nvptx
arch/or1k
arch/powerpc
arch/powerpc64
arch/propeller
arch/riscv32
arch/riscv64
arch/rl78
arch/rx
arch/s390x
arch/sh
arch/sparc
arch/sparc64
arch/spirv
arch/spu
arch/tricore
arch/v850
arch/vax
arch/vc4
arch/ve
arch/wasm
arch/x86
arch/x86_64
arch/xcore
arch/xtensa
autodoc
backend/c
backend/llvm
backend/self-hosted
binutils
breaking
build system
debug info
docs
error message
frontend
fuzzing
incremental
lib/c
lib/compiler-rt
lib/cxx
lib/std
lib/tsan
lib/ubsan-rt
lib/unwind
linking
miscompilation
os/android
os/contiki
os/dragonfly
os/driverkit
os/emscripten
os/freebsd
os/fuchsia
os/haiku
os/hermit
os/hurd
os/illumos
os/ios
os/linux
os/maccatalyst
os/macos
os/managarm
os/netbsd
os/ohos
os/openbsd
os/plan9
os/redox
os/rtems
os/serenity
os/tvos
os/uefi
os/visionos
os/wasi
os/watchos
os/windows
proposal
release notes
testing
zig cc
zig fmt
zig reduce
bounty
bug
contributor-friendly
downstream
enhancement
infra
optimization
question
regression
upstream
use case
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ziglang/zig#31562
Reference in a new issue
ziglang/zig
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?