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

LTO may hang forever #58674

Closed
kpcyrd opened this issue Feb 23, 2019 · 4 comments
Closed

LTO may hang forever #58674

kpcyrd opened this issue Feb 23, 2019 · 4 comments
Labels
C-bug Category: This is a bug. 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

@kpcyrd
Copy link

kpcyrd commented Feb 23, 2019

After quite a bit of troubleshooting it seems cargo build --release broke for one of my projects due to the size of the codebase.

kpcyrd/sn0int#77

According to the debug log this is related to lto:

 INFO 2019-02-23T14:19:15Z: rustc_codegen_llvm::back::lto: 1470 symbols to preserve in this crate
 INFO 2019-02-23T14:19:15Z: rustc_codegen_llvm::back::lto: going for that thin, thin LTO
 INFO 2019-02-23T14:19:15Z: rustc_codegen_llvm::back::lto: local module: 0 - sn0int.15aj1zuq-cgu.5
 INFO 2019-02-23T14:19:15Z: rustc_codegen_llvm::back::lto: local module: 1 - sn0int.15aj1zuq-cgu.0
 INFO 2019-02-23T14:19:16Z: rustc_codegen_llvm::back::lto: local module: 2 - sn0int.15aj1zuq-cgu.15
 INFO 2019-02-23T14:19:16Z: rustc_codegen_llvm::back::lto: local module: 3 - sn0int.15aj1zuq-cgu.10
 INFO 2019-02-23T14:19:16Z: rustc_codegen_llvm::back::lto: local module: 4 - sn0int.15aj1zuq-cgu.3
 INFO 2019-02-23T14:19:16Z: rustc_codegen_llvm::back::lto: local module: 5 - sn0int.15aj1zuq-cgu.6
 INFO 2019-02-23T14:19:17Z: rustc_codegen_llvm::back::lto: local module: 6 - sn0int.15aj1zuq-cgu.1
 INFO 2019-02-23T14:19:17Z: rustc_codegen_llvm::back::lto: local module: 7 - sn0int.15aj1zuq-cgu.12
 INFO 2019-02-23T14:19:17Z: rustc_codegen_llvm::back::lto: local module: 8 - sn0int.15aj1zuq-cgu.14
 INFO 2019-02-23T14:19:17Z: rustc_codegen_llvm::back::lto: local module: 9 - sn0int.15aj1zuq-cgu.4
 INFO 2019-02-23T14:19:18Z: rustc_codegen_llvm::back::lto: local module: 10 - sn0int.15aj1zuq-cgu.2
 INFO 2019-02-23T14:19:18Z: rustc_codegen_llvm::back::lto: local module: 11 - sn0int.15aj1zuq-cgu.7
 INFO 2019-02-23T14:19:18Z: rustc_codegen_llvm::back::lto: local module: 12 - sn0int.15aj1zuq-cgu.9
 INFO 2019-02-23T14:19:18Z: rustc_codegen_llvm::back::lto: local module: 13 - sn0int.15aj1zuq-cgu.13
 INFO 2019-02-23T14:19:18Z: rustc_codegen_llvm::back::lto: local module: 14 - sn0int.15aj1zuq-cgu.11
 INFO 2019-02-23T14:19:18Z: rustc_codegen_llvm::back::lto: local module: 15 - sn0int.15aj1zuq-cgu.8
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto: thin LTO data created
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto: thin LTO import map loaded
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto: checking which modules can be-reused and which have to be re-optimized.
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.5: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.0: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.15: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.10: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.3: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.6: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.1: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.12: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.14: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.4: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.2: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.7: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.9: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.13: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.11: re-compiled
 INFO 2019-02-23T14:19:19Z: rustc_codegen_llvm::back::lto:  - sn0int.15aj1zuq-cgu.8: re-compiled
 INFO 2019-02-23T14:19:20Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.3
 INFO 2019-02-23T14:19:20Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.2
 INFO 2019-02-23T14:19:20Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.0
 INFO 2019-02-23T14:19:20Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.1
 INFO 2019-02-23T14:19:42Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.6
 INFO 2019-02-23T14:19:48Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.5
 INFO 2019-02-23T14:20:02Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.4
 INFO 2019-02-23T14:20:03Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.8
 INFO 2019-02-23T14:20:09Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.10
 INFO 2019-02-23T14:20:18Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.14
 INFO 2019-02-23T14:20:19Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.15
 INFO 2019-02-23T14:20:28Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.9
 INFO 2019-02-23T14:20:32Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.13
 INFO 2019-02-23T14:20:34Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.11
 INFO 2019-02-23T14:20:38Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.12
 INFO 2019-02-23T14:20:43Z: rustc_codegen_llvm::back::lto: running thin lto passes over sn0int.15aj1zuq-cgu.7

It seems I could confirm this because this command works:

RUSTFLAGS="-C lto=no" cargo build --release

This issue has been reproduced with:

  • rustc 1.32.0 (9fda7c2 2019-01-16)
  • rustc 1.34.0-nightly (e1c6d00 2019-02-22)

I couldn't find a way to make this the default though, adding this to my Cargo.toml didn't work:

[profile.release]
lto = false

Steps to reproduce

git clone https://github.com/kpcyrd/sn0int.git
cd sn0int
git checkout 17f4682
cargo build --release
@jonas-schievink jonas-schievink added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. labels Feb 23, 2019
@meithecatte
Copy link
Contributor

I'd suggest specifying a specific commit with git checkout in the reproducer.

@kpcyrd
Copy link
Author

kpcyrd commented Feb 24, 2019

Good point:

Last working commit: 4ce8f00
First broken commit: 17f4682

@kpcyrd
Copy link
Author

kpcyrd commented Apr 24, 2019

It seems this has been resolved at some point, 1.34.0 works correctly again. I've asked the original reporter to re-test and I'd close this issue if he reports a success.

@kpcyrd
Copy link
Author

kpcyrd commented Apr 25, 2019

It seems this has been resolved.

@kpcyrd kpcyrd closed this as completed Apr 25, 2019
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. 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.
Projects
None yet
Development

No branches or pull requests

3 participants