creating two mutual FODs causes a deadlock #335

Open
opened 2024-05-21 13:52:31 +00:00 by puck · 0 comments
Owner
let
  pkgs = import <nixpkgs> { };
  a = pkgs.runCommandNoCC "nya" {
    outputHashMode = "flat";
    outputHashAlgo = "sha256";
    outputHash = builtins.hashString "sha256" "a";
  } "printf b > $out; sleep 5";
  b = pkgs.runCommandNoCC "nya" {
    outputHashMode = "flat";
    outputHashAlgo = "sha256";
    outputHash = builtins.hashString "sha256" "b";
  } "printf a > $out; sleep 2";
in pkgs.runCommandNoCC "meow" { } "cat ${a} ${b} > $out"

When b finishes building, it tries to lock the output path of a, which is building; once a finishes building, it locks the output path of b, causing a deadlock.

```nix let pkgs = import <nixpkgs> { }; a = pkgs.runCommandNoCC "nya" { outputHashMode = "flat"; outputHashAlgo = "sha256"; outputHash = builtins.hashString "sha256" "a"; } "printf b > $out; sleep 5"; b = pkgs.runCommandNoCC "nya" { outputHashMode = "flat"; outputHashAlgo = "sha256"; outputHash = builtins.hashString "sha256" "b"; } "printf a > $out; sleep 2"; in pkgs.runCommandNoCC "meow" { } "cat ${a} ${b} > $out" ``` When `b` finishes building, it tries to lock the output path of `a`, which is building; once `a` finishes building, it locks the output path of `b`, causing a deadlock.
puck added the
stability
bug
E/hard
Area/store
labels 2024-05-21 13:52:31 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#335
No description provided.