-
Notifications
You must be signed in to change notification settings - Fork 18
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
Writing more than 4096 bytes to stdout results in deadlock on Windows #121
Comments
Forgot to add version info:
|
Thanks for reporting! |
Sincey you are testing We then spawn threads for stdout and stderr to read them before we start writing to stdin. All of this seems like we should be set up to avoid these kinds of deadlocks unless |
Is it possible to reproduce this on Linux with larger output values? Or are you able to get a backtrace of where the deadlock occurs? Those would be big helps for trying to narrow this down. |
My debugging experience in Windows is...not so great...I don't even know what the equivalent of GDB/LLDB are? 😄 I'll look around and see what I can find. So I'll try and see if I can get this same behavior from Linux with a larger output get you a backtrace and maybe that at least gets us something. |
If you aren't using Visual Studio's debugger, probably WinDBG (affectionately pronounced as "Wind Bag") though I have no idea how Rust support is for either. At least WinDBG isn't as stuck in the 90s as when I last used it. |
While I figure out the Windows side of debugging, here is the Linux backtrace:
From the following: fn main() {
for _ in 0..(128*1024) {
print!("A");
}
} |
Ok, testing it on Linux. We are hanging when we are waiting for the process to exit. In theory, the stdout/stderr threads should be doing everything we need. I might try changing those from read_to_end just to make debugging easier |
Appreciate it! Also this isn't a major issue for us, so no need to prioritize over other things. We just have some UI snapshots disabled on Windows which isn't a super big deal at the moment 😉 |
Looks like I misunderstood how it worked and I wasn't reading from the merged pipe until everything was done. Should be easy to fix |
Apparently, I got confused between the different stdout's and was reading the non-exixtent one from a thread rather than the one that existed, causing it to deadlock on large buffers. This mostly affects trycmd's testing with markdown files. Fixes assert-rs#121
Well, consider me nerdsniped. The fix is released in v0.13.6 |
The company I work for is using
trycmd
and we noticed our CI timing out on Windows. After some investigation, it appears writing more than 4096 bytes to stdout will result intrycmd
deadlocking on Windows. This is presumably related to #45572 in Rust (std::process::Command hangs if piped stdout buffer fills) and makes sense since Windows uses a much smaller buffer than Linux.A reproducible test case on Windows:
A simple
trycmd
is all that it takes because we aren't looking for anything to actually pass or fail.In
bug.md
:The text was updated successfully, but these errors were encountered: