Repository navigation
Open
Labels
bugObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.standard libraryThis issue involves writing Zig code for the standard library.
Milestone
Description
a.zig
const std = @import("std");
const debug = std.debug;
pub fn main() !void {
debug.warn("{}\n", "a" ** (1024 * 1024));
}
$ echo 'a' | radamsa -n inf -s 1 | ./a
...aaaaaaaaaaaaaaaaaaaaaaaaaa^Cstoppingon signal
[1] 23836 done echo 'a' |
23837 exit 42 radamsa -n inf -s 1 |
23838 abort (core dumped) ./aThis does not happen if we output our input to a file first and use cat
$ echo 'a' | radamsa -n inf -s 1 > out
^Cstopping on signal
$ cat out | ./a
...aaaaaaaHere's my stacktrace from the coredump
Program terminated with signal SIGABRT, Aborted.
#0 0x000000000031ca0e in syscall4 (number=14) at /home/jhc/repo/zig/build/stage1/lib/zig/std/os/linux/x86_64.zig:428
428 return asm volatile ("syscall"
(gdb) backtrace
#0 0x000000000031ca0e in syscall4 (number=14) at /home/jhc/repo/zig/build/stage1/lib/zig/std/os/linux/x86_64.zig:428
#1 0x00000000003062f5 in restoreSignals (set=0x7ffec6c075f8) at /home/jhc/repo/zig/build/stage1/lib/zig/std/os/linux/index.zig:1139
#2 0x00000000003058b1 in raise (sig=6) at /home/jhc/repo/zig/build/stage1/lib/zig/std/os/linux/index.zig:1126
#3 0x0000000000305192 in abort () at /home/jhc/repo/zig/build/stage1/lib/zig/std/os/index.zig:184
#4 0x00000000003050d6 in panicExtra () at /home/jhc/repo/zig/build/stage1/lib/zig/std/debug/index.zig:162
#5 0x0000000000305078 in panic (msg=...) at /home/jhc/repo/zig/build/stage1/lib/zig/std/special/panic.zig:22
#6 0x000000000031cad1 in posixWrite (fd=2) at /home/jhc/repo/zig/build/stage1/lib/zig/std/os/index.zig:377
#7 0x0000000000306313 in File_write (self=...) at /home/jhc/repo/zig/build/stage1/lib/zig/std/os/file.zig:426
#8 0x00000000003059d5 in File_OutStream_writeFn (out_stream=0x328020 <stderr_file_out_stream+8>) at /home/jhc/repo/zig/build/stage1/lib/zig/std/os/file.zig:484
#9 0x0000000000306381 in formatType () at /home/jhc/repo/zig/build/stage1/lib/zig/std/fmt/index.zig:237
#10 0x0000000000305a2c in format () at /home/jhc/repo/zig/build/stage1/lib/zig/std/fmt/index.zig:54
#11 0x00000000003052eb in OutStream(error{SystemResources,OperationAborted,BrokenPipe,Unexpected,DiskQuota,FileTooBig,InputOutput,NoSpaceLeft,AccessDenied,})_print ()
at /home/jhc/repo/zig/build/stage1/lib/zig/std/io.zig:219
#12 0x0000000000305130 in panicExtra () at /home/jhc/repo/zig/build/stage1/lib/zig/std/debug/index.zig:165
#13 0x0000000000305078 in panic (msg=...) at /home/jhc/repo/zig/build/stage1/lib/zig/std/special/panic.zig:22
#14 0x000000000031cad1 in posixWrite (fd=2) at /home/jhc/repo/zig/build/stage1/lib/zig/std/os/index.zig:377
#15 0x0000000000306313 in File_write (self=...) at /home/jhc/repo/zig/build/stage1/lib/zig/std/os/file.zig:426
#16 0x00000000003059d5 in File_OutStream_writeFn (out_stream=0x328020 <stderr_file_out_stream+8>) at /home/jhc/repo/zig/build/stage1/lib/zig/std/os/file.zig:484
#17 0x0000000000324079 in formatText () at /home/jhc/repo/zig/build/stage1/lib/zig/std/fmt/index.zig:372
#18 0x0000000000323fbc in formatType () at /home/jhc/repo/zig/build/stage1/lib/zig/std/fmt/index.zig:242
#19 0x0000000000323e1c in format () at /home/jhc/repo/zig/build/stage1/lib/zig/std/fmt/index.zig:54
#20 0x0000000000323cab in OutStream(error{SystemResources,OperationAborted,BrokenPipe,Unexpected,DiskQuota,FileTooBig,InputOutput,NoSpaceLeft,AccessDenied,})_print ()
at /home/jhc/repo/zig/build/stage1/lib/zig/std/io.zig:219
#21 0x00000000003234f2 in warn () at /home/jhc/repo/zig/build/stage1/lib/zig/std/debug/index.zig:47
We hit an unreachable in os.posixWrite which then panics again for the same reason (which just aborts the program).
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.standard libraryThis issue involves writing Zig code for the standard library.
Activity
Hejsil commentedon Jan 15, 2019
This seems related: https://stackoverflow.com/questions/30006926/why-does-read-fail-with-eagain-when-piping-to-a-program-using-boostasio-for
marnix commentedon Sep 2, 2020
Information: Cannot reproduce the core dump or EAGAIN with recent zig master (0.6.0 + fc00111) (and Radamsa 0.6) on Ubuntu 18.04.5 using updated reproduction script
However, the
command line now makes ./a wait indefinitely. Replacing
infby something like5000makes ./a wait for 5-10 seconds...git-bruh commentedon Sep 12, 2023
This seems to be fixed now