-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Spurious "filename too long" failure on bots #33844
Comments
This error can occur when the gcc command is over 32,767 characters. It would be nice if there was some way to check the length of the |
Failure appears to always be the |
Needed to diagnose rust-lang#33844 Signed-off-by: Peter Atashian <[email protected]>
Attempt to diagnose #33844 #33844 is a spurious failure that causes builds to fail due to the linker command sometimes failing with error 206, which means that the command is too long. This PR makes rustc print out the linker arguments in that case so the reason for it being so long can be diagnosed and hopefully fixed. r? @alexcrichton
Hi everyone, what about moving to the so-called response files? (stackoverflow, msdn, gcc) I programmed in Windows not so long ago and it's how Visual Studio has always been doing to workaround the argv limit. Apart from having to deal with exactly one temp file it'll solve the problem once and for all. Maybe I could even take this and produce a patch. Opinions? |
The correct link for |
@retep998 That link was simply copy'n'pasted from the SO link, thanks for the correction. I agree that the problematic invocations should be investigated first because it's only occasionally showing up. |
The captured instance of this shows the command line as not very long, so my guess is that it's actually related to the environment variable block. This can also be only up to 32K. The compiler will attempt to update the Specifically, I suspect that this block needs to be changed. I believe we've run into this before in #17327 which led to #17360, so I'm gonna close this in favor of #17360. |
I am kinda skeptical of this. It'd take a lot of threads entering this block at the same time to add the PATH up to 32k. Also, if PATH is growing too long, wouldn't the error be happening in |
@vadimcn The error is happening as a result of |
Also, on the matter of the environment block being too big...
Since we're calling |
@retep998 I just confirmed a limit of ~32K on at least individual environment variables indeed exists: use std::process::{Command, Output};
fn test(n: usize) -> std::io::Result<Output> {
// just about anything works, I simply used a hello world
let mut c = Command::new("hello.exe");
let path = {
let mut parts: Vec<u8> = Vec::with_capacity(n + 3); // "C:\\AAA...A"
parts.push(67);
parts.push(58);
parts.push(92);
for i in 0..n {
parts.push(65);
}
// parts.push(0);
String::from_utf8(parts).unwrap()
};
c.env("PATH", path);
c.output()
}
fn main() {
let mut l = 1usize;
let mut r = 1usize;
loop {
let ret = test(r);
if let Err(_) = ret {
break;
}
l = r;
r = 2 * r;
}
loop {
let mid = (l + r) / 2;
let ret = test(mid);
println!("left={} right={} mid={} ({:?})", l, r, mid, ret);
if let Err(_) = ret {
r = mid;
} else {
l = mid;
}
if r - l <= 1 {
break;
}
}
} This gives a value close to 32K on my Windows 7 VM. |
@vadimcn it looks like so far it's almost always been doc tests in libcore that are failing (that's just from memory, not verified). The most recent failure indicates that libcore has 954 tests which means that so long as each test adds ~30 bytes to PATH it'll overflow eventually. In our case
All of those together are 381 bytes which means of our 954 tests only about 84 have to fail this race (< 10%). The race here, that is, where because threads just append to PATH they append to an already lengthened PATH, and then restore the longer path (causing further threads to lengthen it). We don't actually call Plus, this diagnosis fits the bill of the symptoms so far:
|
Ah and this also only happens on WIndows, which is the only spot with that logic active. |
Did further investigation and confirmed:
I'm not bothering to check implementation of |
This commit attempts to bring our prepends to PATH on Windows when loading plugins because we've been seeing quite a few issues with failing to spawn a process on Windows, the leading theory of which is that PATH is too large as a result of this. Currently this is mostly a stab in the dark as it's not confirmed to actually fix the problem, but it's probably not a bad change to have anyway! cc rust-lang#33844 Closes rust-lang#17360
rustc: Try to contain prepends to PATH This commit attempts to bring our prepends to PATH on Windows when loading plugins because we've been seeing quite a few issues with failing to spawn a process on Windows, the leading theory of which is that PATH is too large as a result of this. Currently this is mostly a stab in the dark as it's not confirmed to actually fix the problem, but it's probably not a bad change to have anyway! cc #33844 Closes #17360
http://buildbot.rust-lang.org/builders/auto-win-gnu-32-opt-rustbuild/builds/1204
https://gist.github.com/alexcrichton/e72877d88345cac07278c6449cc343e8
Weird!
The text was updated successfully, but these errors were encountered: