首页 > 解决方案 > 如何修复`无法将jobserver管道容量从4096增加到8192;jobserver 否则可能会出现来自 cargo/rustc 的死锁错误

问题描述

在执行一些 rust 编译任务如运行cargo buildcargo xtask install时,偶尔编译器会崩溃并报错:

Caused by:
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names -C link-arg=-fuse-ld=lld --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit status: 101)
  --- stderr
  thread 'rustc' panicked at 'failed to create jobserver: Custom { kind: PermissionDenied, error: "failed to increase jobserver pipe capacity from 4096 to 8192; jobserver otherwise might deadlock" }', compiler/rustc_data_structures/src/jobserver.rs:23:38
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

  error: internal compiler error: unexpected panic

  note: the compiler unexpectedly panicked. this is a bug.

  note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

  note: rustc 1.56.0-nightly (0035d9dce 2021-08-16) running on x86_64-unknown-linux-gnu

  note: compiler flags: -C link-arg=-fuse-ld=lld --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro

  query stack during panic:
  end of query stack

这发生在最新的 Rust nightly 工具链上,该工具链包括截至发布时工作的 RLS,rustc 1.56.0-nightly (0035d9dce 2021-08-16)

操作系统是 Debian Linux

标签: rustrust-cargo

解决方案


此错误可能是由合并的 PR 引起的,该 PRjobserver-rs旨在增加 Linux 上的作业服务器管道缓冲区容量:https ://github.com/alexcrichton/jobserver-rs/pull/34

这似乎造成了回归,因此在这里恢复:https ://github.com/alexcrichton/jobserver-rs/pull/35

然而,由于构建失败导致几周内没有新的 Rust nightly 被铸造出来rls,所以这个 bug 在最新的 nightly 中仍然存在。

修复方法是每晚恢复到较旧的 rust,并等待新的每晚工作发布并提供rls支持,其中包括恢复对jobserver-rs.


推荐阅读