-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Rustc endless loop out-of-memory and consequent SIGKILL in generic new type #67690
Comments
It seems a problem with I'm thinking ways to better troubleshoot, but the side effects of the issue is hard. |
It'd be helpful to try and simplify the code, ideally to something that doesn't have dependencies (beyond std or so), or at least as few dependencies as possible. As a start putting up a github repository with a Cargo.toml and as simple a crate as possible would be helpful for reproducing on our side (i.e., extracting the file you've linked from that crate -- or, if the crate is really necessary, then indicating as such). The heaptrack profile looks pretty useless unfortunately -- rustc on linux is shipped with jemalloc as the allocator which likely makes heaptrack tracking not really work too well. |
Thank you, sorry for the late response (working) but i get it working on playground. I'm now trying to minimize them to focus on the issue. |
Got it down to 18 lines. Still produces the same error. I have not tested if this goes out-of-memory. But receiving a EDIT: Additionally, I advise to rename this issue to something like |
One liner: Strangely, this no longer crashes if you remove any of #![no_std]
mod a {
pub trait A {}
}
pub trait B {}
pub trait C {}
pub type T<P: a::A + B + C> = P; Even weirder, this does not crash: (I didn't come up with the one-liner, that was @pythondude325) |
I stopped rustc (SIGSTOP) and got a backtrace with gdb, it looks like it's trying to generate infinite errors: backtrace
|
It looks like this is a problem with the error reporter itself: it's affected by the length of the name (!!) OOM: pub trait AAAAAAAAAAAAAA {}
pub trait B {}
pub type T<P: AAAAAAAAAAAAAA + B> = P; No OOM: pub trait AAAAAAAAAAAAA {}
pub trait B {}
pub type T<P: AAAAAAAAAAAAA + B> = P; |
I figured out the issue has to do with how the error printer places the annotations, adding a newline after the trait names and before the plus solves the issue. pub trait AAAA {}
pub trait B {}
pub trait C {}
pub type T<P: AAAA
+ B + C> = P; |
Probably caused by some code in here: https://github.com/rust-lang/rust/blob/master/src/librustc_errors/emitter.rs#L792-L849 |
Handle multiple error fix suggestions carefuly The existing code seems to assume that substitutions spans are disjoint, which is not always the case. In the example: pub trait AAAA {} pub trait B {} pub trait C {} pub type T<P: AAAA + B + C> = P; , we get three substituions starting from ':' and ending respectively at the end of each trait token. With the former offset calculation, this would cause `underline_start` to eventually become negative before being converted to `usize`... The new version may report erroneous results for non perfectly overlapping substitutions but I don't know if such examples exist. Alternatively, we could detect these cases and trim out overlapping substitutions. Fixes rust-lang#67690
Hi, i have made some changes for a crate
stubborn-io
to support a generic type that implementsToSocketAddrs
fromTokio
, but suddenly the code can't compile because it runs out of memory with 6, 8, 10 GB.This is the code i'm trying to compile:
if changed the type
A
forSocketAddr
orString
it then compiles and runs fine.Source: https://github.com/dangerousplay/stubborn-io/blob/64bad09fbb398ceca0add972399cddd04751e378/src/tokio/tcp.rs#L1-L29
It fails to compile on x86_64-unknown-linux-gnu with
stable
,nightly
.I'm attaching the Heaptrack files for further analysis.
https://gofile.io/?c=Vnar2K
The text was updated successfully, but these errors were encountered: