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

rustc / cargo panics on NixOS when compiling backtrace #78

Closed
tazjin opened this issue Nov 30, 2017 · 8 comments
Closed

rustc / cargo panics on NixOS when compiling backtrace #78

tazjin opened this issue Nov 30, 2017 · 8 comments

Comments

@tazjin
Copy link

tazjin commented Nov 30, 2017

Hey!

System info:

~ $ cat /etc/os-release 
NAME=NixOS
ID=nixos
VERSION="17.09.2182.7f6f0c49f0 (Hummingbird)"
VERSION_CODENAME=hummingbird
VERSION_ID="17.09.2182.7f6f0c49f0"
PRETTY_NAME="NixOS 17.09.2182.7f6f0c49f0 (Hummingbird)"
HOME_URL="https://nixos.org/"
SUPPORT_URL="https://nixos.org/nixos/support.html"
BUG_REPORT_URL="https:/NixOS/nixpkgs/issues"
~ $ rustc --version
rustc 1.22.1 (05e2e1c41 2017-11-22)
~ $ cargo --version
cargo 0.23.0 (61fa02415 2017-11-22)

I'm getting the following panic when building backtrace:

   Compiling rustc-demangle v0.1.5
   Compiling libc v0.2.33
   Compiling cc v1.0.3
   Compiling cfg-if v0.1.2
   Compiling backtrace-sys v0.1.16
   Compiling backtrace v0.3.4
thread '<unnamed>' panicked at 'failed to acquire jobserver token: Resource temporarily unavailable (os error 11)', /checkout/src/librustc_trans/back/write.rs:1619:28
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: failed to acquire jobserver token: Resource temporarily unavailable (os error 11)

error: Could not compile `backtrace`.

To learn more, run the command again with --verbose.

This is reproducible for me by just running cargo init and adding backtrace = "0.3.4" as the only dependency to the project.

Interestingly running cargo build a second time will succeed! I've tried setting build parallelism flags, e.g. -j1 to disable parallel builds, but it doesn't seem to make a difference.

Will try to add more information to the issue as debugging continues, but thought that you may have an idea what this is about :)

@tazjin tazjin changed the title Cargo panics on NixOS when compiling backtrace rustc / cargo panics on NixOS when compiling backtrace Nov 30, 2017
@alexcrichton
Copy link
Member

Could you confirm where you're acquiring Cargo from? This was fixed in the jobserver crate 0.1.8 and it may not be pulled into Cargo locally for you perhaps?

@tazjin
Copy link
Author

tazjin commented Nov 30, 2017

It's the nixpkgs-overlay which - afaik - uses the same channels as rustup. I'll double-check that in a bit

@tazjin
Copy link
Author

tazjin commented Dec 1, 2017

@alexcrichton Which version of Cargo is supposed to have jobserver >= 0.1.8? As far as I can tell both Cargo master and the last two releases use 0.1.6.

Trying to figure out what exactly has caused this to suddenly be an issue, because reverting to Rust 1.21.0 (release from 2017-10-12) doesn't fix this again 🤔

@alexcrichton
Copy link
Member

@tazjin a specification of jobserver = "0.1.6 is actually >= 0.1.6, < 0.2 so you need to look in the lock file to see what was actually selected. On Rust right now at least that's 0.1.8. That may not have been updated for 1.21.0 though and just 1.22.0

@matthiasbeyer
Copy link

It seems I'm running into this. Reported here.

@matthiasbeyer
Copy link

After building cargo 0.18 from source I was able to release my crates.

@pmahoney
Copy link

Just another datapoint, unrelated to backtrace-rs: I'm seeing the same error also under NixOS building letsencrypt-rs using rustc 1.21.0, cargo 0.22.0. Repeated builds show the error happening while compiling different dependencies (the error is not deterministic).

Running cargo build with -j1 did not help, but running with -j19 seems to allow everything to build OK, so that may be a workaround if anyone else is running into the same bug. (-j19 was just a large number I happened to choose, there is no reason behind it; watching htop while building, I don't think I ever saw more than five instances of rustc).

I'm not using the Mozilla overlay, just the stock rust packages in NixOS 18.03pre123130.1bc288591ea.

@alexcrichton
Copy link
Member

I think this was a bug in rustc, so closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants