-
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 x86_64 Windows CI failures due to OOM #66342
Comments
I wonder if we could get a backtrace or something from this allocation -- it seems... suspicious that we're only sometimes OOMing. It's also interesting to note that this is almost exactly 4 GB in a single allocation, which is surprising generally ( |
On my PR it was a different (almost) power of two:
edit |
So I minimized this to: pub fn from_hex() -> [u8; 42949672960] {
loop {}
} on a recent nightly gives:
It looks like the compiler is trying to allocate enough space to store a value of the return type. As long as I use a large enough value it reproduces reliably and it isn't specific to Windows: playground. I bisected this to 57a5f92 and I'm guessing #66216 (cc @wesleywiser) is the root cause. |
Yes, that seems likely. I will take a look at this tonight. |
@wesleywiser should we put #66074 on hold while this is sorted out? |
@ecstatic-morse Yeah, let's do that just to be safe. |
In issue rust-lang#66342, we're seeing extremely large allocations by rustc (4GB for the `hex` crate, which is only a few hundred lines). This is exhausing the memory on CI, causing jobs to fail intermittently. This PR installs a custom allocation error hook for nightly compilers, which attempts to trigger a panic after printing the initial error message. Hopefully, this will allow us to retrieve a backtrace when one of these large spurious allocations occurs. The hook is installed in `librustc_driver`, so that other compiler frontends (e.g. clippy) will get this logic as well. I'm unsure if this needs to be behind any kind of additional feature gate, beyond being ngithly only. This only affects compiler frontends, not generic users of `libstd`. While this will nake OOM errors on nightly much more verbose, I don't think this is necessarily a bad thing. I would expect that out of memory errors when running the compiler are usually infrequent, so most users will probably never notice this change. If any users are experiencing rust-lang#66342 (or something like it) on their own crates, the extra output might even be useful to them. I don't know of any reasonable way of writing a test for this. I manually verified the implementation by inserting: `let _a: Vec<usize> = Vec::with_capacity(9999999999)` into `librustc_driver` after the hook installation, and verified that a backtrace was printed. If we're very unlucky, it may turn out the large allocation on CI happens to occur after several large successful allocations, leaving extremely little memory left when we try to panic. If this is the case, then we may fail to panic or print the backtrace, since panicking currently allocates memory. However, we will still print an error message, so the output will be no less useful (though a little more spammy) then before.
triage: P-high. Removing nomination label. |
Fix two OOM issues related to `ConstProp` Fixes rust-lang#66342 Fixes rust-lang#66397 r? @oli-obk
Fix two OOM issues related to `ConstProp` Fixes rust-lang#66342 Fixes rust-lang#66397 r? @oli-obk
A MSVC x86_64 bors job has failed on two unrelated PRs (#60026, #66170) with the same error:
In both cases,
cargo build
attempted to allocate several GB of memory while compiling thehex
crate. One of these failures was in thedist-x86_64-msvc
job, and the other was inx86_64-msvc-cargo
.This failure appears to be spurious: a previous version of #60026 passed the same job.
The text was updated successfully, but these errors were encountered: