Skip to content
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

Compilation error signal: 9, sigkill: kill #100164

Closed
Amdahl-rs opened this issue Aug 5, 2022 · 12 comments
Closed

Compilation error signal: 9, sigkill: kill #100164

Amdahl-rs opened this issue Aug 5, 2022 · 12 comments
Labels
C-bug Category: This is a bug.

Comments

@Amdahl-rs
Copy link

**

I have a function with 30000 enum match items, which directly reports an error when compiling. "(signal: 9, sigkill: kill)", and the code is roughly as follows

 match (ref_a , ref_b , ref_c) {
            (Int8(val_a), Int8(val_b) , Int8(val_c) )  => self.group(val_a,val_b,val_c ),
          
           .......(30000 combinations)
}

process didn't exit successfully: rustc ................................. (signal: 9, sigkill: kill)

Meta

rustc --version --verbose:

rustc 1.62.0-nightly (f4a7ce997 2022-04-08)
binary: rustc
commit-hash: f4a7ce997a1d7546d2b737f8b87d36907bcea2ad
commit-date: 2022-04-08
host: x86_64-unknown-linux-gnu
release: 1.62.0-nightly
LLVM version: 14.0.0

Linux 5.15.0-41-generic #44~20.04.1-Ubuntu SMP Fri Jun 24 13:27:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Machine memory 32G

Backtrace

 process didn't exit successfully: `rustc --crate-name a_query --edition=2021 query/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="simd"' -C metadata=9a9ac94ad6ed1e61 -C extra-filename=-9a9ac94ad6ed1e61 

@Amdahl-rs Amdahl-rs added the C-bug Category: This is a bug. label Aug 5, 2022
@Nilstrieb
Copy link
Member

Perhaps the compiler is running out of memory and getting killed by the OOM killer.

@Amdahl-rs
Copy link
Author

I monitored the memory usage. It should not be. My memory is 32g, basically free

@5225225
Copy link
Contributor

5225225 commented Aug 5, 2022

Can you upload a single rust file that fails to compile on your system? You can use https://gist.github.com/ as a pastebin.

@Amdahl-rs
Copy link
Author

Sorry, the project is too big to be separated

@saethlin
Copy link
Member

saethlin commented Aug 6, 2022

Can you get a backtrace to this by running the build under gdb then running backtrace when the SIGKILL hits?

@saethlin
Copy link
Member

saethlin commented Aug 6, 2022

I can easily imagine this compilation using 32 GB or more, question is why

@mati865
Copy link
Contributor

mati865 commented Aug 6, 2022

You should check dmesg and journal if there are any mentions of killed process.

@gimbling-away
Copy link
Contributor

I mean...

I'm not exactly surprised that Rustc is taking more than 32 gigabytes of memory to compile 30000 patterns in a single match statement.

@Amdahl-rs
Copy link
Author

Why need 30000 patterns in a single match.Because I can't find a suitable way for the following modes:
“Association type cannot dyn”

pub trait A: Into<AImpl> {
   //**Association type:**
    type Item<'a>: Scalar<'a> where Self: 'a;
}
pub enum AImpl {
    Int8(P),  // P impl trait A
    Int16(D), // D impl trait A
   //20 Item
}

fn func<'a, T1: A, T2: A, T3: A, T4: A>(a: &'a T1, b: &'a T2, c: &'a T3, d: &'a T4) {
    
}
//
// There is a better way??
//
fn call_func(a:AImpl,b:AImpl,c:AImpl,d:AImpl ) {
    match (a,b,c,d) {
        (  AImpl::Int8(v1),AImpl::Int8(v2),AImpl::Int8(v3),AImpl::Int8(v4),) => {
            func( v1,v2,v3,v4)
        }
       ... //30000 match
    }
}

@Seppel3210
Copy link
Contributor

geez the code size will probably be huge with that as well 😰 @Amdahl-rs
Instead of type Item = dyn SomeTrait; you maybe meant type Item = Box<dyn SomeTrait>?
Or if you really want to allow unsized types (and with that also dyn Trait types) for the associated type you have to do
type Item<'a>: Scalar<'a> + ?Sized where Self: 'a

@Seppel3210
Copy link
Contributor

And also where is the Scalar trait defined? Is it in your crate or an external one? If it is external: which one?

@Amdahl-rs
Copy link
Author

Thanks: @Seppel3210
The main problems are:
Association type trait, which is caused by using box < dyn sometrait >

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

7 participants