ocaml-multicore / eio

Effects-based direct-style IO for multicore OCaml
Other
548 stars 66 forks source link

Eio_posix: fix update to watched FDs on cancel #574

Closed talex5 closed 1 year ago

talex5 commented 1 year ago

If cancelling removes the last waiter, we need to update the set of FDs being watched.

Fixes #572.

Reported by @quernd

anmonteiro commented 1 year ago

This also fixes an issue I was seeing where EIO reported successful writes on closed file descriptors.

talex5 commented 1 year ago

This also fixes an issue I was seeing where EIO reported successful writes on closed file descriptors.

Closing a file prevents new write operations from starting, but existing ones may be allowed to complete. I don't see why this PR should affect that; the bug will cause an extra wake-up but the write should just get EAGAIN and go back to sleep immediately.

quernd commented 1 year ago

I was a bit nervous about the assert but it appears the logic is sound. I ran some long-running load tests and the program did not crash or exhibit any pathological behaviour. Thanks for the quick response 👍