ivykis
ivykis copied to clipboard
ivykis aborts on FreeBSD 13.1 (`kqueue`) when a polled pipe fd gets closed
The attached reproducer code spawns two processes, one of them polls a perfectly valid pipe fd for writing using ivykis, and the child process would be responsible for reading, but for an easier reproduction, the child just closes the pipe and exits. (Reading and then closing would result in the same abort.)
https://gist.github.com/MrAnno/0a6dd9572e8a7a981996654ccd3e5e08
Running it yields the following backtrace:
[0] from 0x000000080039233a in thr_kill
[1] from 0x000000080030ac74 in raise
[2] from 0x00000008003bc109 in abort
[3] from 0x000000080024ecbb in iv_fatal+235 at iv_fatal.c:57
[4] from 0x0000000800256832 in iv_fd_kqueue_poll+1106 at iv_fd_kqueue.c:212
[5] from 0x0000000800251561 in iv_fd_poll_and_run+177 at iv_fd.c:206
[6] from 0x0000000800253a15 in iv_main+181 at iv_main_posix.c:112
[7] from 0x0000000000201de6 in main+198 at main.c:60
I believe ivykis incorrectly reports fatal errors in case a kevent() call returns EV_ERROR on the file description: https://github.com/buytenh/ivykis/blob/f1b14555fb0b5d9acfbcfaf35b1313bb28d858c2/src/iv_fd_kqueue.c#L208-L214
The epoll implementation, for example, reports these kind of errors as non-fatal using the error callback: https://github.com/buytenh/ivykis/blob/f1b14555fb0b5d9acfbcfaf35b1313bb28d858c2/src/iv_fd_epoll.c#L185-L186