-
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
Thread 'rustc' has overflowed its stack on dumb program #75577
Comments
Oh yeah, also, here's a backtrace of |
This is probably not too hard to fix, so marking it as a InstructionsThe stacktrace posted above is incomplete. So the first thing you will want to do is to compile the provided reproducer program under a debugger and extract the couple dozen of the stack frames at the bottom of the stack. This should inform you as to where exactly in the compiler the recursion is entered. Once you have that information available, you will have to find the corresponding code in the codebase and add a call to Spoiler: bottom frames of stack
Spoiler: where in the code change needs to be madeLooking at the stack trace you will see that the recursion begins with a call to Manually implementing I encourage you to ping me here or on Zulip if you need additional help. |
Hi. I'd like to work on this issue |
@rustbot claim |
I am literally unable to test if my changes fix this problem because 13.6 GB RAM and 2GB swap is not enough to test it....But if I understood this correctly, the solution is to simply implement |
Prevent stack overflow in deeply nested types. Related issue rust-lang#75577 (?) Unfortunately, I am unable to test whether this actually solves the problem because apparently, 12GB RAM + 2GB swap is not enough to compile the (admittedly toy) source file.
@AuroransSolis could you test this again in your environment with the latest nightly? |
I tried briefly and it quickly claimed 25GB of memory (10GB of RAM and 15GB of swap), causing my displays to freeze and forcing me to use a teletype to kill it. I'll try again overnight tonight and see what happens. |
Attempted again. Turns out my 16GB of memory and 256GB of swap wasn't enough. It ate up all of it and the kernel sent it a SIGKILL. I suppose this just further confirms my categorizing this as a dumb program. Update: friend of mine will be loaning me a 2TB drive to use as a swap disk. Once I get that I'll try again to make sure there's no further issues. |
That's a possibility. I'll try again with about half the input later this evening and update here after doing so. |
I attempted to reproduce this on my Windows system but it looks like Windows won't give it enough page space to continue:
This ended up taking ~130GB of swap space and 64GB of RAM before ICEing. |
@nagisa, I did some testing on this and have come up with a minimal example. As written, it produces the same stack trace as the original program using a debug build of
As you suspected, the original issue was in
However, if we want the compiler to support deeply nested types such as these, there are several other recursive loops which need to be broken up with
For whatever reason, this didn't trigger the original
When I added
When I added
When I added
When I added
When I added
When I added
When I added
When I added
This loop would be tricky to fix; as a quick hack, I re-exported the I also tested some variations on the second program. Most of them hit the same recursive loops as the original, but two of them revealed some new problematic loops. The first was this one:
When I attempted to compile it with the fixes above, rustc crashed on this loop:
This was fixed when I added After that, I tried a variation with deeply nested expressions, which was the second variation that yielded new recursive loops:
It caused rustc to crash on this loop:
When I added
This loop was a real pain to fix, since one can't just add I plan on putting these fixes into a PR, but I have a few questions I'd like to ask first.
|
It's me again! Back this time with something that throws a spanner in the works for rustc without it taking multiple hundred gigabytes of memory and several days to compile. It's an Advent of Code challenge once more - and this time I tried to solve everything at compile time with macro abuse and types. Here's a small example using the setup I made in the playground (input is on line 181), and here's the large example that causes the error (as a gist since it times out in the playground). I have just a little bit of a hunch that
#![recursion_limit="50000"]
basically being required has something to do with the error:I feel like an apology is in order for anyone who tries figuring out what's going wrong here, so: I'm deeply, deeply, sorry.
The text was updated successfully, but these errors were encountered: