mirror of
https://github.com/NixOS/nix.git
synced 2025-11-24 11:19:35 +01:00
builtins.deepSeq on deeply nested structures (e.g., a linked list with 100,000 elements) caused an uncontrolled OS-level stack overflow with no Nix stack trace. Fix by adding call depth tracking to forceValueDeep, integrating with Nix's existing max-call-depth mechanism. Now produces a controlled "stack overflow; max-call-depth exceeded" error with a proper stack trace. Closes: https://github.com/NixOS/nix/issues/7816
30 lines
1.4 KiB
Text
30 lines
1.4 KiB
Text
error:
|
|
… while calling the 'deepSeq' builtin
|
|
at /pwd/lang/eval-fail-deepseq-stack-overflow.nix:8:1:
|
|
7| in
|
|
8| builtins.deepSeq reverseLinkedList (
|
|
| ^
|
|
9| throw "unexpected success; expected a controlled stack overflow instead"
|
|
|
|
… while evaluating the attribute 'tail'
|
|
at /pwd/lang/eval-fail-deepseq-stack-overflow.nix:6:67:
|
|
5| long = builtins.genList (x: x) 100000;
|
|
6| reverseLinkedList = builtins.foldl' (tail: head: { inherit head tail; }) null long;
|
|
| ^
|
|
7| in
|
|
|
|
(9997 duplicate frames omitted)
|
|
|
|
… while evaluating the attribute 'head'
|
|
at /pwd/lang/eval-fail-deepseq-stack-overflow.nix:6:62:
|
|
5| long = builtins.genList (x: x) 100000;
|
|
6| reverseLinkedList = builtins.foldl' (tail: head: { inherit head tail; }) null long;
|
|
| ^
|
|
7| in
|
|
|
|
error: stack overflow; max-call-depth exceeded
|
|
at /pwd/lang/eval-fail-deepseq-stack-overflow.nix:5:28:
|
|
4| let
|
|
5| long = builtins.genList (x: x) 100000;
|
|
| ^
|
|
6| reverseLinkedList = builtins.foldl' (tail: head: { inherit head tail; }) null long;
|