Skip to content

Compilation error signal: 9, sigkill: kill #100164

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Compilation error signal: 9, sigkill: kill #100164

Amdahl-rs opened this issue Aug 5, 2022 · 15 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
@Noratrieb
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
Member

mati865 commented Aug 6, 2022

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

@ghost
Copy link

ghost commented Aug 6, 2022

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 >

@realyukii
Copy link

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

How to compile rust on old notebook? it seems each time I compile rust-based project it always get killed (I tried to build paru)

@Noratrieb
Copy link
Member

@RealYukiSan pass -j1 or some other small number to cargo to limit parallelism. if you have further questions, please ask them on https://users.rust-lang.org or some other forum instead of 2 year old issues :)

@realyukii
Copy link

realyukii commented Sep 3, 2024

@RealYukiSan pass -j1 or some other small number to cargo to limit parallelism. if you have further questions, please ask them on https://users.rust-lang.org or some other forum instead of 2 year old issues :)

Thanks I will try it :3

EDIT:
rustc and makepkg command doesn't support -j option :(
I will try disable the OOM and see if it works.

EDIT 2:
It still fail, I think rust not friendly on low-end computer

   Compiling paru v2.0.3 (/home/user/paru/src/paru-2.0.3)
rustc-LLVM ERROR: out of memory
Allocation failed
error: could not compile `paru` (bin "paru")

Caused by:
  process didn't exit successfully: `rustc --crate-name paru --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=273 --crate-type bin --emit=dep-info,link -C opt-level=3 -C lto -C codegen-units=1 --check-cfg 'cfg(docsrs)' --check-cfg 'cfg(feature, values("async-trait", "backtrace", "generate", "git", "mock", "mock_chroot", "static"))' -C metadata=ab2fc252971afca8 -C extra-filename=-ab2fc252971afca8 --out-dir /home/user/paru/src/paru-2.0.3/target/release/deps -C strip=debuginfo -L dependency=/home/user/paru/src/paru-2.0.3/target/release/deps --extern alpm=/home/user/paru/src/paru-2.0.3/target/release/deps/libalpm-edf154fa0940552a.rlib --extern alpm_utils=/home/user/paru/src/paru-2.0.3/target/release/deps/libalpm_utils-ceb788accf42de17.rlib --extern ansi_term=/home/user/paru/src/paru-2.0.3/target/release/deps/libansi_term-57e450aca84da04d.rlib --extern anyhow=/home/user/paru/src/paru-2.0.3/target/release/deps/libanyhow-0f35e809314ccca8.rlib --extern aur_depends=/home/user/paru/src/paru-2.0.3/target/release/deps/libaur_depends-7773ab00a473070c.rlib --extern aur_fetch=/home/user/paru/src/paru-2.0.3/target/release/deps/libaur_fetch-7222f96dcf4dec3a.rlib --extern bitflags=/home/user/paru/src/paru-2.0.3/target/release/deps/libbitflags-2a7d6df753258e64.rlib --extern chrono=/home/user/paru/src/paru-2.0.3/target/release/deps/libchrono-1c0b6c8a74a37bd5.rlib --extern cini=/home/user/paru/src/paru-2.0.3/target/release/deps/libcini-65f6916a2dcc873b.rlib --extern dirs=/home/user/paru/src/paru-2.0.3/target/release/deps/libdirs-caae0c1e210eecd2.rlib --extern env_logger=/home/user/paru/src/paru-2.0.3/target/release/deps/libenv_logger-f4d35b9a11dd5474.rlib --extern futures=/home/user/paru/src/paru-2.0.3/target/release/deps/libfutures-c4ef611abf14f706.rlib --extern globset=/home/user/paru/src/paru-2.0.3/target/release/deps/libglobset-049909e4507ab1a0.rlib --extern htmlescape=/home/user/paru/src/paru-2.0.3/target/release/deps/libhtmlescape-3549bf33f465dd0c.rlib --extern indicatif=/home/user/paru/src/paru-2.0.3/target/release/deps/libindicatif-4d61dbe64fd023c6.rlib --extern log=/home/user/paru/src/paru-2.0.3/target/release/deps/liblog-0ba36317e163d42e.rlib --extern nix=/home/user/paru/src/paru-2.0.3/target/release/deps/libnix-96bff0120a1349f0.rlib --extern once_cell=/home/user/paru/src/paru-2.0.3/target/release/deps/libonce_cell-78d6f322b8dc1f5c.rlib --extern pacmanconf=/home/user/paru/src/paru-2.0.3/target/release/deps/libpacmanconf-10c35cb980927c22.rlib --extern paru=/home/user/paru/src/paru-2.0.3/target/release/deps/libparu-71e8a429eccadbe2.rlib --extern raur=/home/user/paru/src/paru-2.0.3/target/release/deps/libraur-cbdfa766e2c403a5.rlib --extern regex=/home/user/paru/src/paru-2.0.3/target/release/deps/libregex-7c7acc5a18a6d3a2.rlib --extern reqwest=/home/user/paru/src/paru-2.0.3/target/release/deps/libreqwest-f13a3240283eac1c.rlib --extern rss=/home/user/paru/src/paru-2.0.3/target/release/deps/librss-7b048124b7c70738.rlib --extern scraper=/home/user/paru/src/paru-2.0.3/target/release/deps/libscraper-98cd46ce1c5bbbec.rlib --extern serde=/home/user/paru/src/paru-2.0.3/target/release/deps/libserde-5f6553fa5d98278e.rlib --extern serde_json=/home/user/paru/src/paru-2.0.3/target/release/deps/libserde_json-74eae8572984ee12.rlib --extern signal_hook=/home/user/paru/src/paru-2.0.3/target/release/deps/libsignal_hook-7e3c23c10b59f692.rlib --extern smart_default=/home/user/paru/src/paru-2.0.3/target/release/deps/libsmart_default-021602325d53124b.so --extern srcinfo=/home/user/paru/src/paru-2.0.3/target/release/deps/libsrcinfo-f28e1dcd32c45f0a.rlib --extern tempfile=/home/user/paru/src/paru-2.0.3/target/release/deps/libtempfile-3a3b6d1936431d2c.rlib --extern terminal_size=/home/user/paru/src/paru-2.0.3/target/release/deps/libterminal_size-49376e9823bc33df.rlib --extern tokio=/home/user/paru/src/paru-2.0.3/target/release/deps/libtokio-a23a0872a161ef73.rlib --extern toml=/home/user/paru/src/paru-2.0.3/target/release/deps/libtoml-828589cdb29d72cb.rlib --extern tr=/home/user/paru/sr
c/paru-2.0.3/target/release/deps/libtr-0bbd2dc10ef2c56f.rlib --extern unicode_width=/home/user/paru/src/paru-2.0.3/target/release/deps/libunicode_width-b5ca20086baa0344.rlib --extern url=/home/user/paru/src/paru-2.0.3/target/release/deps/liburl-706f3df8843cd8e7.rlib -Cforce-frame-pointers=yes -C debuginfo=2 --remap-path-prefix=/home/user/paru/src=/usr/src/debug/paru -L native=/usr/lib` (signal: 6, SIGABRT: process abort signal)
==> ERROR: A failure occurred in build().
    Aborting...

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

No branches or pull requests

7 participants