[Nix#8530] throwing/asserting in tryEval has exponential complexity after evaluating certain values #137

Open
opened 2024-03-16 06:45:07 +00:00 by lix-bot · 0 comments
Member

Upstream-Issue: NixOS/nix#8530

Describe the bug

Under the same conditions:

  • builtins.throw "" works
  • builtins.throw x hangs
  • builtins.trace x (builtins.throw "") works
  • builtins.seq x (builtins.throw "") hangs
  • builtins.seq x (builtins.trace "a" builtins.throw "") prints "a" and hangs
  • assert false; x works
  • builtins.seq x (assert false; x) hangs

I tried on Nix 2.10, 2.11, 2.12, 2.14, 2.15 and could reproduce on all of them

Steps To Reproduce

  1. Clone this repo
  2. Run nix flake check
  3. Adjust debugThrow function in default.nix as needed
  4. See as it hangs or doesn't hang depending on the conditions

Expected behavior

It never hangs.

nix-env --version output

nix-env (Nix) 2.15.1

Additional context

I encountered this in the wild while working with Nix, I'll try to make a smaller example and will update this issue.

edit: I tried stripping some things down, and now it simply takes a long time to execute... perhaps this is a case of exponential complexity

Priorities

Add 👍 to issues you find important.

Upstream-Issue: https://git.lix.systems/NixOS/nix/issues/8530 **Describe the bug** Under the same conditions: - `builtins.throw ""` works - `builtins.throw x` hangs - `builtins.trace x (builtins.throw "")` works - `builtins.seq x (builtins.throw "")` hangs - `builtins.seq x (builtins.trace "a" builtins.throw "")` prints "a" and hangs - `assert false; x` works - `builtins.seq x (assert false; x)` hangs I tried on Nix 2.10, 2.11, 2.12, 2.14, 2.15 and could reproduce on all of them **Steps To Reproduce** 1. Clone [this repo](https://github.com/chayleaf/notnft/tree/97a88a3fa864a842427617b1f1926281d511ddaa) 2. Run `nix flake check` 3. Adjust `debugThrow` function in `default.nix` as needed 4. See as it hangs or doesn't hang depending on the conditions **Expected behavior** It never hangs. **`nix-env --version` output** `nix-env (Nix) 2.15.1` **Additional context** I encountered this in the wild while working with Nix, I'll try to make a smaller example and will update this issue. edit: I tried stripping some things down, and now it simply takes a long time to execute... perhaps this is a case of exponential complexity **Priorities** Add :+1: to [issues you find important](https://github.com/NixOS/nix/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc).
lix-bot added the
performance
bug
imported
labels 2024-03-16 06:45:07 +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#137
No description provided.