-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
async_io: adapt self-pipe trick to Windows #8044
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work. I imagine it's worth reporting that select on windows pipes fails for this case?
Needs a CHANGES entry.
My understanding is that it is not that it doesn't work, but rather that the semantics of pipes on Windows do not match exactly those of Linux and the emulation in
Thanks, will add. I also want to wait to see if by chance this PR also fixes #8043. |
Signed-off-by: nojebar <[email protected]>
Signed-off-by: Nicolás Ojeda Bär <[email protected]>
e477b72
to
58fb66c
Compare
@emillon if there is a bug fix release 3.8.3 this should be in it. |
Signed-off-by: Nicolás Ojeda Bär <[email protected]>
Signed-off-by: Nicolás Ojeda Bär <[email protected]>
* async_io: adapt self-pipe trick to Windows (#8044) Signed-off-by: Nicolás Ojeda Bär <[email protected]> * Update CHANGES.md Signed-off-by: Etienne Millon <[email protected]> --------- Signed-off-by: Nicolás Ojeda Bär <[email protected]> Signed-off-by: Etienne Millon <[email protected]> Co-authored-by: Nicolás Ojeda Bär <[email protected]>
CHANGES: - Fix deadlock on Windows (ocaml/dune#8044, @nojb) - When using `sendfile` to copy files on Linux, fall back to the portable version if it fails at runtime for some reason (NFS, etc). (ocaml/dune#8049, fixes ocaml/dune#8041, @emillon)
The Dune RPC server uses the "self-pipe trick" to interrupt
Unix.select
. Unfortunately, on Windows, pipes cannot be passed to the nativeselect
system call, which means thatUnix.select
falls back to a complicated emulation using threads to poll for data on the pipe. This, plus the fact that pipes are always blocking, seem to be causing some deadlock somewhere which makes the RPC server hang under certain circumstances.This PR proposes an alternative form of the self-pipe trick using a self-connected UDP socket. The advantages is that no pipes are involved, so only the native
select
call is used byUnix.select
, completely bypassing all the complexity of the emulation and the associated blocking pipes.