Skip to content
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

nix-instantiate terminated by signal 11, --show-trace has no effect #35

Closed
peti opened this issue Jul 2, 2012 · 8 comments
Closed

nix-instantiate terminated by signal 11, --show-trace has no effect #35

peti opened this issue Jul 2, 2012 · 8 comments

Comments

@peti
Copy link
Member

peti commented Jul 2, 2012

Define the following attribute in ~/.nixpkgs/config.nix

{
  packageOverrides = pkgs:
  {
    crashNix = pkgs.haskellPackages.ghcWithPackages (self: [pkgs.haskellPackages.hledgerWeb]);
  };
}

and run:

$ nix-build ~/.nix-defexpr -A crashNix --show-trace
nix-instantiate killed by signal 11

This may very well be a bug in the ghtWithPackages expression, but I'm having a hard time finding out what the problem might be (since that wrapper works just fine for almost any other attribute set). Any suggestions how to remedy this issue are highly welcome.

@edolstra
Copy link
Member

edolstra commented Jul 2, 2012

A segfault in the evaluator is usually due to an infinite recursion in the Nix expression. GDB says:

#0  0x00007ffff7976505 in nix::ExprOpConcatLists::eval(nix::EvalState&, nix::Env&, nix::Value&) ()
   from /nix/store/9n6swhw1qr71f8xls4i4dzfbmnachgv3-nix-1.1pre2718_8da6772/lib/nix/libexpr.so.0
#1  0x00007ffff797e47d in nix::EvalState::forceValue(nix::Value&) () from /nix/store/9n6swhw1qr71f8xls4i4dzfbmnachgv3-nix-1.1pre2718_8da6772/lib/nix/libexpr.so.0
#2  0x00007ffff7976482 in nix::ExprVar::eval(nix::EvalState&, nix::Env&, nix::Value&) () from /nix/store/9n6swhw1qr71f8xls4i4dzfbmnachgv3-nix-1.1pre2718_8da6772/lib/nix/libexpr.so.0
#3  0x00007ffff7976523 in nix::ExprOpConcatLists::eval(nix::EvalState&, nix::Env&, nix::Value&) ()
   from /nix/store/9n6swhw1qr71f8xls4i4dzfbmnachgv3-nix-1.1pre2718_8da6772/lib/nix/libexpr.so.0
#4  0x00007ffff797e47d in nix::EvalState::forceValue(nix::Value&) () from /nix/store/9n6swhw1qr71f8xls4i4dzfbmnachgv3-nix-1.1pre2718_8da6772/lib/nix/libexpr.so.0
#5  0x00007ffff7976482 in nix::ExprVar::eval(nix::EvalState&, nix::Env&, nix::Value&) () from /nix/store/9n6swhw1qr71f8xls4i4dzfbmnachgv3-nix-1.1pre2718_8da6772/lib/nix/libexpr.so.0
#6  0x00007ffff7976523 in nix::ExprOpConcatLists::eval(nix::EvalState&, nix::Env&, nix::Value&) ()
   from /nix/store/9n6swhw1qr71f8xls4i4dzfbmnachgv3-nix-1.1pre2718_8da6772/lib/nix/libexpr.so.0
...

repeated a few thousand times.

@kosmikus
Copy link
Member

kosmikus commented Jul 5, 2012

I've tested a bit, and I think it's not a bug in ghcWithPackages, but rather an actual problem in Nix. I've tried to add dependencies of hledgerWeb to the list instead of hledgerWeb itself, and it turns out that if I add both yesod and yesodDefault to the list, I get a segfault, but if I choose only one of the two, I don't.

@kosmikus
Copy link
Member

kosmikus commented Jul 6, 2012

It seems I can "fix" this by changing the definition of the library function closePropagation which is used by ghcWithPackages, so that it produces smaller intermediate lists while running. However, I think that only qualifies as a workaround. Nix shouldn't just segfault if something gets too large.

@peti
Copy link
Member Author

peti commented Jul 16, 2012

How do we proceed with this issue? Would it be possible to commit the fix to closePropagation as a quick work around?

@edolstra
Copy link
Member

@kosmikus, can you commit your fix? In general Nix expressions shouldn't recurse too deeply because the C stack is not infinite (well, not until we can use GCC's -fsplit-stack). The crashNix expression goes over 80000 levels deep.

It would be nice to give a better error message than "signal 11", but there is no portable way to detect a stack overflow.

@kosmikus
Copy link
Member

I had hesitated committing the fix because these are central library functions which may affect other things, and I haven't checked if my new version returns all results in the same order. But yes, I can try to do it.

@kosmikus
Copy link
Member

Committed as NixOS/nixpkgs@3fbd694.

@peti
Copy link
Member Author

peti commented Jul 18, 2012

The crashes in ghcWithPackages are now gone.

edolstra added a commit that referenced this issue Apr 25, 2017
Update <nixpkgs/nixos> path in documentation.
meditans pushed a commit to Ericson2314/nix that referenced this issue Aug 28, 2020
zolodev pushed a commit to zolodev/nix that referenced this issue Jan 1, 2024
housekeeping: enable devenv, automatic updates, CLA+license
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants