Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Handle EINTR.
When building with sccache locally, I'm seeing a bunch of errors to acquire the
jobserver token which are caused by interrupts at bad times.

I think it was a kernel update what caused this, fwiw, but not 100% sure.

Both can happen according to the man pages, and we're not handling them
sensibly.

I think retrying the read / poll when the error is EINTR is a sensible thing to
do.
  • Loading branch information
emilio committed Jan 13, 2020
commit b6c1e95d0c36d303dddde63304121d35a69a5039
12 changes: 9 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,11 @@ mod imp {
loop {
fd.revents = 0;
if libc::poll(&mut fd, 1, -1) == -1 {
return Err(io::Error::last_os_error());
let e = io::Error::last_os_error();
match e.kind() {
io::ErrorKind::Interrupted => continue,
_ => return Err(e),
}
}
if fd.revents == 0 {
continue;
Expand All @@ -605,8 +609,10 @@ mod imp {
"early EOF on jobserver pipe",
))
}
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {}
Err(e) => return Err(e),
Err(e) => match e.kind() {
io::ErrorKind::WouldBlock | io::ErrorKind::Interrupted => continue,
_ => return Err(e),
},
}
}
}
Expand Down