In nix-repl, if one begins evaluating some long-running evaluation, sends a SIGINT, and then tries it again, it is likely that they'll get an infinite recursion error, even if there is no infinite recursion.
I think this is because Nix's backholes thunks, but doesn't un-blackhole them while handling the interrupt. That opens the possibility of a blackholed thunk being encountered on the second evaluation, leading Nix to falsy conclude it's already started forcing this thunk on this evaluation, and thus infinite recursion is happening.
The solution would to unwind after the interrupt, un-blackholing all thunks on the stack.
Inspired by @zimbatm to extract this from NixOS/rfcs#14.
In nix-repl, if one begins evaluating some long-running evaluation, sends a SIGINT, and then tries it again, it is likely that they'll get an infinite recursion error, even if there is no infinite recursion.
I think this is because Nix's backholes thunks, but doesn't un-blackhole them while handling the interrupt. That opens the possibility of a blackholed thunk being encountered on the second evaluation, leading Nix to falsy conclude it's already started forcing this thunk on this evaluation, and thus infinite recursion is happening.
The solution would to unwind after the interrupt, un-blackholing all thunks on the stack.
Inspired by @zimbatm to extract this from NixOS/rfcs#14.