Don't spin on empty fds in read2 on Unix#5030
Merged
bors merged 1 commit intorust-lang:masterfrom Feb 12, 2018
Merged
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) |
Contributor
|
@bors r+ The widows case presumable doesn't need similar handling? |
Contributor
|
📌 Commit ec991eb has been approved by |
Contributor
|
⌛ Testing commit ec991eb with merge a99c7c0619e922c29da9148b15143e5640129b93... |
Contributor
|
💡 This pull request was already approved, no need to approve it again.
|
Contributor
|
📌 Commit ec991eb has been approved by |
Contributor
bors
added a commit
that referenced
this pull request
Feb 12, 2018
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.
Member
Author
|
@matklad nah the Windows case I believe already handles this properly (IOCP is way different from nonblocking I/O) |
Member
|
Could you also make a PR against compiletest which has this same file copied into it? |
Contributor
|
☀️ Test successful - status-appveyor, status-travis |
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this pull request
Feb 12, 2018
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
kennytm
added a commit
to kennytm/rust
that referenced
this pull request
Feb 13, 2018
…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
kennytm
added a commit
to kennytm/rust
that referenced
this pull request
Feb 14, 2018
…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
djrenren
pushed a commit
to djrenren/compiletest
that referenced
this pull request
Aug 26, 2019
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
pollloop continuously gettingnotified that stderr is closed.
The behavior is now changed so after a file descriptor is done we stop passing
it to
polland instead only pass the one remaining readable file descriptor.