`nix-build` 进程陷入锁定,永远不会终止

`nix-build` process caught up in locking, never terminating

在 NixOS 20.09 上,我在 运行 一个 obelisk 项目时遇到了这个问题。例如。我做 ob init 并将 regex-tdfa 添加到 frontend/frontend.cabal.

的依赖项中

然后

> nix-build -A exe --no-out-link -vvv

我得到了一个永无止境的类似于这样的行输出:

building of '/nix/store/njiphyrb4xcnnckclvv0r2ns65yipnkp-mmorph-1.1.3.tar.gz.drv': woken up
building of '/nix/store/nsncr60fii4fwki70bb5ishf1hzq89b5-coreutils-8.31.drv': created
building of '/nix/store/nsncr60fii4fwki70bb5ishf1hzq89b5-coreutils-8.31.drv': woken up
building of '/nix/store/pvq34lb5r34bypfl53hx8kibakzqw7fc-gnused-4.7.drv': created
building of '/nix/store/pvq34lb5r34bypfl53hx8kibakzqw7fc-gnused-4.7.drv': woken up
building of '/nix/store/xr4aygslk3lqdz9wnsq04vpbm4v68vk5-glibc-locales-2.27.drv': created
building of '/nix/store/xr4aygslk3lqdz9wnsq04vpbm4v68vk5-glibc-locales-2.27.drv': woken up
building of '/nix/store/m3dzp25n0g4fwlygdhvak1kk8xz906n9-bash-4.4-p23.drv': init
building of '/nix/store/m3dzp25n0g4fwlygdhvak1kk8xz906n9-bash-4.4-p23.drv': loading derivation
acquiring write lock on '/nix/var/nix/temproots/21932'
downgrading to read lock on '/nix/var/nix/temproots/21932'
building of '/nix/store/m3dzp25n0g4fwlygdhvak1kk8xz906n9-bash-4.4-p23.drv': have derivation
acquiring write lock on '/nix/var/nix/temproots/21932'
downgrading to read lock on '/nix/var/nix/temproots/21932'
acquiring write lock on '/nix/var/nix/temproots/21932'
downgrading to read lock on '/nix/var/nix/temproots/21932'
acquiring write lock on '/nix/var/nix/temproots/21932'
downgrading to read lock on '/nix/var/nix/temproots/21932'
acquiring write lock on '/nix/var/nix/temproots/21932'
downgrading to read lock on '/nix/var/nix/temproots/21932'
acquiring write lock on '/nix/var/nix/temproots/21932'
downgrading to read lock on '/nix/var/nix/temproots/21932'

进程 nix-daemon 运行 秒,用时 100% CPU。如果 sudo nix-build ...nix-build 进程本身 运行s 100% CPU-time,永不终止。

其他人尝试重现,没有遇到问题。这可能与我的硬件有关。 See this reddit post with comments.

更多信息

我换成了传统硬盘,问题就解决了。当然,关于如何在 nvme 上避免此问题的实际解决方案会很好。

编辑:硬盘从来都不是问题。锁定问题显然已经在这个提交的某个地方悄悄解决了:https://github.com/flyingcircusio/nixpkgs/commit/ac60476ed94fd5424d9f3410c438825f793a8cbb