nix-super/doc/manual/rl-next
Rebecca Turner 7434caca05
Fix segfault on infinite recursion in some cases
This fixes a segfault on infinite function call recursion (rather than
infinite thunk recursion) by tracking the function call depth in
`EvalState`.

Additionally, to avoid printing extremely long stack traces, stack
frames are now deduplicated, with a `(19997 duplicate traces omitted)`
message. This should only really be triggered in infinite recursion
scenarios.

Before:

    $ nix-instantiate --eval --expr '(x: x x) (x: x x)'
    Segmentation fault: 11

After:

    $ nix-instantiate --eval --expr '(x: x x) (x: x x)'
    error: stack overflow

           at «string»:1:14:
                1| (x: x x) (x: x x)
                 |              ^

    $ nix-instantiate --eval --expr '(x: x x) (x: x x)' --show-trace
    error:
           … from call site
             at «string»:1:1:
                1| (x: x x) (x: x x)
                 | ^

           … while calling anonymous lambda
             at «string»:1:2:
                1| (x: x x) (x: x x)
                 |  ^

           … from call site
             at «string»:1:5:
                1| (x: x x) (x: x x)
                 |     ^

           … while calling anonymous lambda
             at «string»:1:11:
                1| (x: x x) (x: x x)
                 |           ^

           … from call site
             at «string»:1:14:
                1| (x: x x) (x: x x)
                 |              ^

           (19997 duplicate traces omitted)

           error: stack overflow
           at «string»:1:14:
                1| (x: x x) (x: x x)
                 |              ^
2023-12-29 22:16:44 -08:00
..
allowed-uris-can-now-match-whole-schemes.md allowed-uris: Match whole schemes also when scheme is not followed by slashes 2023-12-11 12:18:04 +01:00
cgroup-stats.md worker protocol: serialise cgroup stats in BuildResult (#9598) 2023-12-13 16:37:17 -05:00
config Compile hand-written release notes with changelog-d 2023-11-24 15:13:21 +01:00
eval-system.md Add release not for eval-system 2023-12-14 19:55:50 -05:00
hash-format-nix32.md rl-next: Use markdown frontmatter syntax 2023-12-09 19:57:55 +01:00
ifd-eval-store.md Build IFD in the build store when using eval-store. 2023-12-23 21:33:56 -05:00
mounted-ssh-store.md rl-next: Use markdown frontmatter syntax 2023-12-09 19:57:55 +01:00
nix-config-show.md rl-next: Use markdown frontmatter syntax 2023-12-09 19:57:55 +01:00
nix-env-json-drv-path.md rl-next: Use markdown frontmatter syntax 2023-12-09 19:57:55 +01:00
nix-hash-convert.md rl-next: Use markdown frontmatter syntax 2023-12-09 19:57:55 +01:00
nix-profile-names.md Fix release notes 2023-12-21 16:38:25 +01:00
source-positions-in-errors.md rl-next: Use markdown frontmatter syntax 2023-12-09 19:57:55 +01:00
stack-overflow-segfaults.md Fix segfault on infinite recursion in some cases 2023-12-29 22:16:44 -08:00