从源代码构建奇偶校验后,货物构建与“阻止等待注册表索引上的文件锁定”挂起

时间:2017-11-30 02:58:28

标签: rust rust-cargo

我按照readme说明从源代码构建Parity,然后执行此命令:

viewDidLoad

然后:

if (self.view.superview!.bounds != UIScreen.main.bounds) {
    print("This is a popover!")
}

..按照指示;这两个导致我在提示挂起时收到以下消息:

cargo build --release

我在Mac上。

15 个答案:

答案 0 :(得分:27)

正在运行cargo clean似乎可以解决问题。

答案 1 :(得分:19)

我遇到了同样的问题,并使用rm -rf ~/.cargo/registry/index/*解决了这个问题。

答案 2 :(得分:7)

当您同时运行同一项目的2个编译时,会发生这种情况。编译器使用锁定文件来避免数据争用问题。有一些可能性:

  • 如果您自己运行这两个编译,则解决方案显而易见:您需要取消其中两个。

  • 如果使用自动编译项目的IDE:您可以等待作业完成或关闭IDE。如果不起作用,则可能是因为RLS挂了。您只需pkill rls即可解决问题。

  • 作为最后的选择,您可以强制删除锁:another answer中所述的rm -rf ~/.cargo/registry/index/*

答案 3 :(得分:6)

重要的是要确保您没有其他rl或货物正在运行。 export class HomePage implements OnInit { context = document.getElementsByClassName('loop')[0]; startElement = document.getElementsByClassName('is-start')[0]; clones = document.getElementsByClassName('is-clone'); disableScroll = false; scrollWidth; scrollPos; clonesWidth; i; constructor() { window.requestAnimationFrame(this.reCalc); this.context.addEventListener('scroll', function () { window.requestAnimationFrame(this.scrollUpdate); }, false); window.addEventListener('resize', function () { window.requestAnimationFrame(this.reCalc); }, false); } getScrollPos() { return (this.context.pageXOffset || this.context.scrollLeft) - (this.context.clientLeft || 0); } setScrollPos(pos) { this.context.scrollLeft = pos; } getClonesWidth() { this.clonesWidth = 0; this.i = 0; for (this.i; this.i < this.clones.length; this.i += 1) { this.clonesWidth = this.clonesWidth + this.clones[this.i].clientWidth; } return this.clonesWidth; } reCalc() { this.scrollPos = this.getScrollPos(); this.scrollWidth = this.context.scrollWidth; this.clonesWidth = this.getClonesWidth(); if (this.scrollPos <= 0) { this.setScrollPos(1); } } scrollUpdate() { if (this.disableScroll === false) { this.scrollPos = this.getScrollPos(); if (this.clonesWidth + this.scrollPos >= this.scrollWidth) { // Scroll to the left when you’ve reached the far right this.setScrollPos(1); // Scroll 1 pixel to allow scrolling backwards. this.disableScroll = true; } else if (this.scrollPos <= 0) { // Scroll to the right when you reach the far left. this.setScrollPos(this.scrollWidth - this.clonesWidth); this.disableScroll = true; } if (this.disableScroll) { // Disable scroll-jumping for a short time to avoid flickering. window.setTimeout(function () { this.disableScroll = false; }, 40); } } } } 是确保它们不存在的好方法。

答案 4 :(得分:3)

在按照接受的答案中的建议删除Cargo注册表索引之前,请确保当前没有其他进程正在编译Parity或任何其他Rust包。

答案 5 :(得分:3)

删除rm $CARGO_HOME/.package-cache对我有用。

我在执行ctrl+z时不小心击中了ctrl+c而不是cargo run,下一次执行cargo run时我看到了Blocking waiting for file lock on the registry index。我删除了该文件,然后又可以正常工作。

答案 6 :(得分:3)

我的VSCode intellisense正在构建。确保您的智能感知没有建立。它在底部显示一个小齿轮图标。大多数情况是在您更新git.pavlovia.org

时发生的

答案 7 :(得分:1)

我尝试按照Readme的说明创建一个Polkadot节点。

我能够通过运行以下命令(将其复制/粘贴到Bash Terminal中)进行构建:

git clone https://github.com/paritytech/polkadot;
cd polkadot; git checkout master;
rustup update nightly;
rustup target add wasm32-unknown-unknown --toolchain nightly;
rustup update stable;
rustup default stable;
cargo install --git https://github.com/alexcrichton/wasm-gc --force;
cargo install --git https://github.com/pepyakin/wasm-export-table.git --force;
brew install openssl; brew upgrade openssl;
rustc --version; cargo --version;
./build.sh;
cargo build;
cargo run -- --help;
./target/debug/polkadot --help;

然后我尝试使用以下命令(等效)运行Polkadot节点:

./target/debug/polkadot -- --chain=dev --validator --key Alice -d /tmp/alice;
cargo run -- --chain=dev --validator --key Alice -d /tmp/alice;

但是它显示以下内容:

Blocking waiting for file lock on the git checkouts
Blocking waiting for file lock on build directory

我发现这是由CLion(Jetbrains IDE)引起的。

我通过关闭CLion解决了这个问题。我改用了Visual Studio Code编辑器,它还允许调试带有断点的Rust代码

答案 8 :(得分:1)

当您同时运行两次cargo build命令时,通常会收到此错误。如果您使用的是IDE,请检查插件是否在后台运行cargo命令,这对于我来说就是VS Code。

答案 9 :(得分:1)

VScode中存在相同问题:如果您已安装RLS

  1. 文件|首选项|设置
  2. 搜索“ rls”
  3. 在“ rust”扩展名中,取消选中“打开文件或项目时自动启动RLS”

重新打开您的项目,并且应该解决该问题。

答案 10 :(得分:0)

我的问题是IDE正在运送货物并锁定了目录。尝试关闭您的IDE

答案 11 :(得分:0)

如果您曾点击“阻止程序包缓存上的文件锁定等待锁定”,

运行以下命令,然后再次运行货物。 rm $ CARGO_HOME / .package-cache

答案 12 :(得分:0)

您应该暂时停止 rls 过程。

答案 13 :(得分:0)

关于聚会迟到的风险,而cargo、rls或rust-analyzer负责锁定以避免数据竞争。 一个潜在的问题可能是 inotify filewatchers 的数量。

通常它们通过产生新的观察者并等待轮到他们而正常工作,但如果观察者空间用完,这可能是一个问题。 同意以上所有解决方案,但建议检查max_user_watches

的数量
# view current settings
cat /proc/sys/fs/inotify/max_user_watches

# increasing it, /etc/sysctl.conf
fs.inotify.max_user_watches=524288

# The new value can then be loaded in by running s
$sudo sysctl -p.

答案 14 :(得分:-1)

如果您确定没有其他货物处理程序正在执行,但是此问题仍然经常发生,则可能是您的网络问题。