Bug #13436
EPOLLET should wake up for each pipe write, even without reads
0%
Description
Some software makes use of a self pipe to wake up an event loop; i.e., a pipe where the read end is in the epoll set and the write end is available to other threads in order to inject wakeups.
On Linux systems, an edge-triggered wait on a pipe will fire for every write to the pipe, even if that pipe has not been read after poll. Some software in the wild has been observed to make use of this behaviour, draining the pipe only once the pipe buffer is full or nearing full.
On illumos systems, today, the epoll wakeup appears to occur only on a transition from an empty pipe buffer to a pipe buffer with at least one byte. The pipe must be drained completely before it will trigger again
A test, test_pipe_et
, has been added to our epoll test suite: https://github.com/illumos/epoll-test-suite/blob/master/functional/test_pipe_et.c
This passes on Linux but fails on illumos:
$ ./test_pipe_et test_pipe_et 0 TPASS test_pipe_et 1 TPASS test_pipe_et 2 TFAIL: 0 != 1
No data to display