-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Huge CPU and RAM usage in redundant_clone/possible_borrower on long functions #10134
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
Comments
So you have 1024 meow-calls? Sounds like my cat standing in front of the patio door. |
I believe I have this same bug. January 1st nightly clippy is killed after ballooning to 6.1 GB in a few seconds. stable only uses 700 MB. Dec 30th also fails. Dec 29th is fine. While I do have macros, I have no so recursive (AFAIK). Unfortunately, I do not know what in my (rather large) library could serve as MWE. https://github.com/serai-dex/serai/tree/develop/coins/monero in case it is somehow helpful. |
No doubt. One thing I noticed is that the I experimented with a few variants of this idea. For example, using copy-on-write I am open to ideas. |
Perhaps we need a different approach that calculates the borrowers for a function once and caches that while linting the function to better amortize the work? To me it looks like we may be accidentally quadratic even with a less memory hungry representation. Btw. I'm curious: How do hybrid bit sets compare to RoaringBitSets? |
Bisected and leaving this log here, still investigating on my end:
|
Second testcase that still OOMs even with #10173: fn meow(_s: impl AsRef<str>) {}
macro_rules! quad {
($x:stmt) => {
$x
$x
$x
$x
};
}
fn main() {
quad!(quad!(quad!(for i in 0..4 {
quad!(quad!(meow(format!("abc{i}"))));
})));
} |
Oof. Thanks, @mwkmwkmwk. |
This is also causing my project's CI to fail. I can minimize if necessary but since there are already a few examples I will wait to see if the fixes for the issues above also solve my problem. |
Should the problem commit in question be reverted until a fixed version is available, since this has broken multiple projects? I understand nightly doesn't have the safety guarantees of stable, it's nightly, yet some targets require nightly and nightly is currently known to be not functioning to standards. I'm unsure the exact policies here, just wanted to raise it and get the opinion of someone more educated. I've personally just stuck to 12-29 to avoid it, for now. |
Clippy is normally synced every two weeks with with the main rust repo every two weeks. I believe the next sync is coming up this Thursday, so if it doesn't have a fix before then we can revert it right before the sync. |
Same thing happens during a clippy run on Vaultwarden. |
Next nightly should be reverted. |
Can we close this one? |
I think so, i have not seen this happen for a while now, it's about 2 years old haha. |
Summary
Clippy takes a very large amount of time and RAM to analyze the following code. The time is spent in a single invocation of
<rustc_mir_dataflow::framework::engine::Engine<clippy_utils::mir::possible_borrower::PossibleBorrowerAnalysis>>::iterate_to_fixpoint
:The bug happens with nightly-2022-12-30, while nightly-2022-12-29 is fine (clippy finishes near-instantly).
Reproducer
I tried this code:
(adjust amount of
quad!
to taste; the above will reliably OOM my machine)I expected to see this happen:
Clippy finishes near-instantly.
Instead, this happened:
Clippy crashes with OOM after a while.
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: