-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Severe memory leak in Rustc #78125
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
Labels
A-async-await
Area: Async & Await
C-bug
Category: This is a bug.
I-compilemem
Issue: Problems and improvements with respect to memory usage during compilation.
I-hang
Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
This looks like a duplicate of #75992. |
@Davester47 can you check if this issue occurs on Rust 1.45? |
Alright, I'm installing 1.45.0 to check it |
1.45.0 successfully compiled it. |
1.46.0 has the leak as well |
@Davester47 if you can come up with an MCVE for the hang, that would be extremely helpful. Right now all the examples we have require actix. |
Alright, I'll give it a shot in the next couple days |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-async-await
Area: Async & Await
C-bug
Category: This is a bug.
I-compilemem
Issue: Problems and improvements with respect to memory usage during compilation.
I-hang
Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
AFAICT, this isn't a security vulnerability, so I'm reporting this here.
I was attempting to build a RESTful CRUD API with Actix-web, and I've stumbled into a compiler bug. All the source files are about 150-200 LoC, so I'm not going to post them all here. The code that reproduces this bug is available at https://github.com/Davester47/rustc-leak. I left instructions to reproduce the leak in the README.md
To Reproduce:
When I try to compile it with
cargo build
, it compiles all the dependencies fine. However, as soon as it gets to building the final binary ("snack-actix"), it starts leaking memory like crazy (500+ MB/s) and it never stops. It ran for over 10 minutes on the final phase on my Windows laptop, and I think it used over 15 GB of swap (I can't tell for sure on the task manager). On linux, the computer becomes unusable as soon as it starts using swap space.My advice if you try to reproduce this is to have Task Manager or
htop
open while you compile it, and be ready to hit Ctrl+C. It will use all of your memory if you don't.The last thing that I did before it started leaking memory was finish the function in src/controllers/snack.rs. I know that my code is probably bad style or not idiomatic or something, but it shouldn't use over 12 GBs of memory.
I don't know how I would find where the leak happens or why it happens, so I'm hoping someone here will be able to. Let me know if you need more information. Please don't let this issue get sidelined.
Meta
I've confirmed that the leak occurs on all of the following toolchains.
rustc --version --verbose
:There's no backtrace, since I had to kill rustc with Ctrl+C every time to avoid crashing my computer (Sometimes I failed). I have 8 GBs of RAM, which should be enough to compile anything. It never panicked.
The text was updated successfully, but these errors were encountered: