-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
windows: TcpStream::shutdown
does not wake up blocking reads
#121594
Labels
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
A-io
Area: `std::io`, `std::fs`, `std::net` and `std::path`
C-bug
Category: This is a bug.
O-windows
Operating system: Windows
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
Comments
rustbot
added
the
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
label
Feb 25, 2024
I think there is no (simple) way to make the implementation conform to the docs, so we should probably just remove the guarantees about currently blocked operations from the docs and only talk about future operations. Note that POSIX @rustbot label A-docs T-libs-api O-windows A-io -needs-triage |
rustbot
added
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
A-io
Area: `std::io`, `std::fs`, `std::net` and `std::path`
O-windows
Operating system: Windows
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
and removed
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
labels
Feb 25, 2024
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Mar 9, 2024
…ChrisDenton fix `close_read_wakes_up` test On windows, `shutdown` does not interrupt `read`, even though we document that it does (see rust-lang#121594). The `close_read_wakes_up` test has a race condition and only passes on windows if the `shutdown` happens before the `read`. This PR ignores the test on windows adds a sleep to make it more likely that the `read` happens before the `shutdown` and the test actually tests what it is supposed to test on other platforms. I'm submitting this before any docs changes, so that we can find out on what platforms `shutdown` actually works as documented. r? `@ChrisDenton`
github-actions bot
pushed a commit
to rust-lang/miri
that referenced
this issue
Mar 10, 2024
fix `close_read_wakes_up` test On windows, `shutdown` does not interrupt `read`, even though we document that it does (see rust-lang/rust#121594). The `close_read_wakes_up` test has a race condition and only passes on windows if the `shutdown` happens before the `read`. This PR ignores the test on windows adds a sleep to make it more likely that the `read` happens before the `shutdown` and the test actually tests what it is supposed to test on other platforms. I'm submitting this before any docs changes, so that we can find out on what platforms `shutdown` actually works as documented. r? `@ChrisDenton`
lnicola
pushed a commit
to lnicola/rust-analyzer
that referenced
this issue
Apr 7, 2024
fix `close_read_wakes_up` test On windows, `shutdown` does not interrupt `read`, even though we document that it does (see rust-lang/rust#121594). The `close_read_wakes_up` test has a race condition and only passes on windows if the `shutdown` happens before the `read`. This PR ignores the test on windows adds a sleep to make it more likely that the `read` happens before the `shutdown` and the test actually tests what it is supposed to test on other platforms. I'm submitting this before any docs changes, so that we can find out on what platforms `shutdown` actually works as documented. r? `@ChrisDenton`
RalfJung
pushed a commit
to RalfJung/rust-analyzer
that referenced
this issue
Apr 27, 2024
fix `close_read_wakes_up` test On windows, `shutdown` does not interrupt `read`, even though we document that it does (see rust-lang/rust#121594). The `close_read_wakes_up` test has a race condition and only passes on windows if the `shutdown` happens before the `read`. This PR ignores the test on windows adds a sleep to make it more likely that the `read` happens before the `shutdown` and the test actually tests what it is supposed to test on other platforms. I'm submitting this before any docs changes, so that we can find out on what platforms `shutdown` actually works as documented. r? `@ChrisDenton`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
A-io
Area: `std::io`, `std::fs`, `std::net` and `std::path`
C-bug
Category: This is a bug.
O-windows
Operating system: Windows
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
Description
The docs for
TcpStream::shutdown
currently guarantee that a shutdown withShutdown::Read
must wake up pending operations immediately:The docs for
Shutdown::Read
explicitly says that currently blocked reads must return:However, that is currently not the case on
*-pc-windows-*
platforms. Instead, a currently blocked read will stay blocked forever when shutdown is called withShutdown::Read
in a different thread. The same also happens withShutdown::Both
.This is causing the
close_read_wakes_up
test to fail spuriously due to a race condition, for example in #121523 (comment) and #120543 (comment). The test only passes if theshutdown
happens before theread
.Repro
I tried this code:
I expected to see this happen: The
.shutdown(Shutdown::Read)
makes the blocking read return immediately withOk(0)
.Instead, this happened: The blocking read does not return, making the program hang indefinitely.
Meta
rustc --version --verbose
:Tested on these platforms:
x86_64-pc-windows-msvc
with Microsoft Windows Server 2019 (GitHub CI)x86_64-pc-windows-gnu
with wine 9.1 on LinuxRelated
shutdown
", except that we do and also already did when that PR was opened.close_read_wakes_up
test on Windows #94714 enabled the test again as "works on my machine".The text was updated successfully, but these errors were encountered: