Skip to content
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

Sending a sender over a channel and immediately receiving from the corresonding receiver intermittently fails on linux #252

Open
jdm opened this issue Jan 9, 2020 · 2 comments

Comments

@jdm
Copy link
Member

jdm commented Jan 9, 2020

#179
This is one of our longest-existing and most distributed intermittent failures in Servo's automated tests.

@pshaughn
Copy link

pshaughn commented Feb 6, 2020

let result = recvmsg(fd, &mut self.msghdr, 0);
let result = if result > 0 {
Ok(result as usize)
} else if result == 0 {
Err(UnixError::ChannelClosed)
} else {
Err(UnixError::last())
};

If the error we get is an EINTR coming from here, we should retry the recvmsg, not abort. From what I'm reading, EINTR can happen here at random when the process receives basically any UNIX signal.
An example of a loop that exists for the sake of retrying on EINTR, from wine: https://github.com/wine-mirror/wine/blob/9642f35922b79cebacdc774eb54619e389ccd531/dlls/ntdll/server.c#L793
A more Rust-specific warning about this: https://people.gnome.org/~federico/blog/rust-libstd-syscalls-and-errors.html

@pshaughn
Copy link

pshaughn commented Feb 6, 2020

I jammed an assert that it wasn't EINTR in there and started running the test from #179 in a loop in a bunch of terminals but I'm not getting either that test's failure or my own assertion failure; my environment (a Mint VM on Windows host) might not be vulnerable to whatever problem this is. Someone who can reproduce this easily should see which Unix error code it is.
(If it is this, every blocking libc call that mentions EINTR as a possible error in its man page should have similar retry logic applied, it's not exclusive to recvmsg.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants