You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue was investigated and written by an AI agent, at the repository
owner's direction, on the owner's machine. All outputs below come from runs
of the shown commands. The owner read this text before posting.
Summary
On macOS, a computation that parks on a FIFO never returns at end of file.
Both lanes wait with poll(), and poll() does not report a FIFO close on
macOS. The select() call does. So reading a FIFO to the end hangs.
Symptom
An effect that parks on fd 0 reads a pipe and a file to the end. On a FIFO it
stops after the data:
returnio_wait_on(w, 0, POLLIN, 0, stdin_read_line_more); // fd 0, no deadline
Scope
One probe waits on a FIFO. The same probe ran on three machines:
poll
select
macOS 27.0 (26A428), arm64
never
True
Linux 5.15
revents=0x10
True
iSH (a system-call emulator)
never
never
A named FIFO fails and an anonymous pipe does not. fstat answers S_ISFIFO
for both, so the name is what matters. < file, producer | prog, a pty and <(cmd) all see EOF.
Where the runtime waits
The native lane: while (poll(fds, n, ms) < 0) in io_wait, in the C that bend prog.bend -o prog.c emits.
The JS lane: io_sys().poll(...) in io_wait, in the emitted JS.
Note
This issue was investigated and written by an AI agent, at the repository
owner's direction, on the owner's machine. All outputs below come from runs
of the shown commands. The owner read this text before posting.
Summary
On macOS, a computation that parks on a FIFO never returns at end of file.
Both lanes wait with
poll(), andpoll()does not report a FIFO close onmacOS. The
select()call does. So reading a FIFO to the end hangs.Symptom
An effect that parks on fd 0 reads a pipe and a file to the end. On a FIFO it
stops after the data:
The parked call:
Scope
One probe waits on a FIFO. The same probe ran on three machines:
pollselectrevents=0x10A named FIFO fails and an anonymous pipe does not.
fstatanswersS_ISFIFOfor both, so the name is what matters.
< file,producer | prog, a pty and<(cmd)all see EOF.Where the runtime waits
while (poll(fds, n, ms) < 0)inio_wait, in the C thatbend prog.bend -o prog.cemits.io_sys().poll(...)inio_wait, in the emitted JS.Reproducer, without Bend
The same holds when the program opens the FIFO itself instead of the shell.
Workaround that works
A deadline on the park makes the effect wake and read again:
io_wait_on(w, 0, POLLIN, io_tick() + 250000000ull, more)io_park_on(0, false, k, go, performance.now() + 250)Both lanes then read a FIFO to the end, and their other computations keep
running.
tcp_poll.calready uses this shape.Question
The difference is in Darwin, but Bend decides how it waits. Which do you want?
selectwait.Environment
Bend 2.0.20 on macOS 27.0 (build 26A428), arm64. I have one macOS machine, so
I cannot say whether other versions behave the same.