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

Nonsensical infinite loop when tracing runCommand result #52170

Open
nh2 opened this issue Dec 15, 2018 · 2 comments
Open

Nonsensical infinite loop when tracing runCommand result #52170

nh2 opened this issue Dec 15, 2018 · 2 comments
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md

Comments

@nh2
Copy link
Contributor

nh2 commented Dec 15, 2018

Issue description

I just spent over 3 hours tracing down / minimising an infinite loop that just made nix hang.

Steps to reproduce

Create and deploy a nixops deployment with contents:

{
  machine1 = { pkgs, ... }: {

    systemd.services.bla = {
      preStart = builtins.trace (pkgs.runCommand "a" {} "b") "c";
    };

  };
}

nixops deploying this will hang forever.

Moving the trace further out the following way succeeds and traces something:

{
  machine1 = { pkgs, ... }: {

    systemd.services.bla = builtins.trace (pkgs.runCommand "a" {} "b") {
      preStart = "c";
    };

  };
}

Moving it even further out the following way produces error: infinite recursion encountered

{
  machine1 = { pkgs, ... }: builtins.trace (pkgs.runCommand "a" {} "b") {

    systemd.services.bla = {
      preStart = "c";
    };

  };
}

What the hell is going on?

How can we avoid it to save people debugging time when they accidentally write this?

I'd also be thankful for reproductions by other people, and in particular whether this works with normal configuration.nix and without nixops.

@nh2
Copy link
Contributor Author

nh2 commented Dec 15, 2018

Interestingly, this does not hang:

{
  machine1 = { pkgs, ... }: {

    systemd.services.bla = {
      unitConfig.ExecStart = builtins.trace (pkgs.runCommand "a" {} "b") "c";
    };

  };
}

What is special about preStart (or script, which also hangs) that makes it hang for that?

It suggests that pkgs itself, or pkgs.runCommand, somehow depends on the preStart value, but I don't get why that would be (or why it would make sense to be this way).

@stale
Copy link

stale bot commented Jun 3, 2020

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md
Projects
None yet
Development

No branches or pull requests

1 participant