-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Don't spin on empty fds in read2
on Unix
#5030
Conversation
This commit fixes what I think is some pathological behavior in Cargo where if one stdio stream is closed before another then Cargo can accidentally spin in a tight loop and not block appropriately. Previously, for example, if stderr closed before stdout then Cargo would spin in a `poll` loop continuously getting notified that stderr is closed. The behavior is now changed so after a file descriptor is done we stop passing it to `poll` and instead only pass the one remaining readable file descriptor.
r? @matklad (rust_highfive has picked a reviewer for you, use r? to override) |
@bors r+ The widows case presumable doesn't need similar handling? |
📌 Commit ec991eb has been approved by |
⌛ Testing commit ec991eb with merge a99c7c0619e922c29da9148b15143e5640129b93... |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit ec991eb has been approved by |
Don't spin on empty fds in `read2` on Unix This commit fixes what I think is some pathological behavior in Cargo where if one stdio stream is closed before another then Cargo can accidentally spin in a tight loop and not block appropriately. Previously, for example, if stderr closed before stdout then Cargo would spin in a `poll` loop continuously getting notified that stderr is closed. The behavior is now changed so after a file descriptor is done we stop passing it to `poll` and instead only pass the one remaining readable file descriptor.
@matklad nah the Windows case I believe already handles this properly (IOCP is way different from nonblocking I/O) |
Could you also make a PR against compiletest which has this same file copied into it? |
☀️ Test successful - status-appveyor, status-travis |
This was originally copied over from Cargo and Cargo has since [been updated][update] so let's pull in the fixes here too! [update]: rust-lang/cargo#5030
…imulacrum Update compiletest's `read2` function This was originally copied over from Cargo and Cargo has since [been updated][update] so let's pull in the fixes here too! [update]: rust-lang/cargo#5030
…imulacrum Update compiletest's `read2` function This was originally copied over from Cargo and Cargo has since [been updated][update] so let's pull in the fixes here too! [update]: rust-lang/cargo#5030
This was originally copied over from Cargo and Cargo has since [been updated][update] so let's pull in the fixes here too! [update]: rust-lang/cargo#5030
This commit fixes what I think is some pathological behavior in Cargo where if
one stdio stream is closed before another then Cargo can accidentally spin in a
tight loop and not block appropriately. Previously, for example, if stderr
closed before stdout then Cargo would spin in a
poll
loop continuously gettingnotified that stderr is closed.
The behavior is now changed so after a file descriptor is done we stop passing
it to
poll
and instead only pass the one remaining readable file descriptor.