-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
builtins.deepSeq
Leads to Segfault
#7816
Comments
Crashes are not ok, but for completeness: We do have a known crash on darwin, caused by an incomplete GC/coroutine integration. Could you try with garbage collection disabled?
|
Oh that's really unfortunate. Coincidentally though, I wrote a nix script yesterday that handles infinite lazy structures for recursive BFS exploration (it was only getting hung up by exploring errors, hence the
Sadly, still hits a segfault. However, I watched the memory usage and it gets to 6Gb before being killed so it does appear to be in the relm of memory leaks/stack-overflow problems. I imagine it gets to the perl buildInput for cowsay, and then I'm pretty sure perl, or maybe perl packages, has some recursive references. I also ran it on a linux machine and do get a stack overflow error
|
My statement was a bit too general. In general, it does not support infinite structures, but it does support looping structures that don't diverge. To illustrate
In the I think what you're really after is the Line 350 in 90e630a
It's not the most elegant formulation, but the gist is to always read the "root" attribute values, and then only recurse into attributes that have |
I do want to understand the more general process. It seems really strange to me that cowsay would have a diverging infinite structure inside of it. Are there any good debugging approaches I could use for finding out where it might be looping? (e.g. some sort of trace of the attribute names, so I can see which ones are repeating) |
Some attributes behave more like what would be zero-argument methods in a strict language if that makes sense.
You could step with the nix debugger (announcement link). This is most useful when it's the Nix code driving the stack use, and not Nix could perhaps be improved to enforce its own stack limit, which might help, incase that's what's crashing here. #6361 (comment) Another angle is to use |
Thanks for the additional detail, looks like thats going to help since I'm exploring older commits before However, for the newer commits I am running into an issue. Parents of nested packages like This is off the latest commit: |
Seems related (same stack trace). One loop I saw is: tcl depend on stdenv and stdenv depend on tcl. First bootstrapping stage stdenv have this recursion. |
I encountered this same pattern when using nix 2.18 for my nix-daemon and 2.17 for my cli which is rather odd to me. Edit: I tried running it with --debugger and regardless if I pass --impure or not I get the following which corresponds to this code https://github.com/NixOS/nixpkgs/blob/ccfc0b4b4f6d6051e88229d3189107ad7ac9b3e6/pkgs/top-level/impure.nix#L41C22-L41C26 So the recursion could be in https://github.com/NixOS/nixpkgs/blob/ccfc0b4b4f6d6051e88229d3189107ad7ac9b3e6/pkgs/top-level/impure.nix#L10 ? I am not sure In my NIX_PATH I do not have nixpkgs-overlays set.
Edit2: that was just a bug while trying to enter the debugger. When temporarily removing the offending code, the original error still appears. |
Describe the bug
Per the docs example I was using
deepSeq
along withtryEval
. However, when given a package as an input (maybe all packages) it crashs the repl with a segfault.Steps To Reproduce
Note: on the latest nixpkgs there is a warning (printed many times), however it still ends by crashing the repl
Expected behavior
(I do expect the evaluation to take a very very long time, thats not an issue)
If the process is running out of memory, which is understandable, I would expect a stack overflow error.
Otherwise I would expect some more informative error message explaining why/where it failed.
nix-env --version
outputnix-env (Nix) 2.11.1
(Darwin aarch64)The text was updated successfully, but these errors were encountered: