-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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: std::process::Command
may pass asynchronous pipes to child process
#95759
Comments
Windows: Increase a pipe's buffer capacity to 64kb This brings it inline with typical Linux defaults: https://www.man7.org/linux/man-pages/man7/pipe.7.html > Since Linux 2.6.11, the pipe capacity is 16 pages (i.e., 65,536 bytes in a system with a page size of 4096 bytes). This may also help with rust-lang#45572 and rust-lang#95759 but does not fix either issue. It simply makes them much less likely to be encountered.
This has now made #95848 fail 2 times in a row... is there some form of emergency patch that can be applied to resolve this issue? |
There is #95841 fix, but it need to be reviewed :-) |
Yeah, I had hoped increasing the pipe buffer size would work well enough to make failures less common until a proper fix was implemented. But unfortunately it's still quite prone to failures. I'm trying a different reviewer for #95841 in case they're more available right now. |
@ChrisDenton FWIW, there is still one thing I am confused by: what if someone spawns a program written in Rust using some means other than our own |
Sure they can spawn their process using asynchronous handles for stdio. They can even do that using I think it's more correct to say "passed-in pipes must be assumed to be synchronous" is part of the Windows API. And it's what we were always assuming (albeit unintentionally violating in certain circumstances). |
Rust assumes stdio handles are opened for synchronous access (as will most other Windows processes). However, when passing
ChildStdOut
,ChildStdIn
orChildStdErr
to a newCommand
the pipes passed in are asynchronous. For a full test case see src/test/ui-fulldeps/stdio-from.rs but here's a shorter example:This is related to an older issue: #38811 (comment)
This can cause soundness issues described in #81357.
The text was updated successfully, but these errors were encountered: