Coder Social home page Coder Social logo

Comments (8)

edolstra avatar edolstra commented on August 16, 2024

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.

from nix.

kosmikus avatar kosmikus commented on August 16, 2024

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.

from nix.

kosmikus avatar kosmikus commented on August 16, 2024

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.

from nix.

peti avatar peti commented on August 16, 2024

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

from nix.

edolstra avatar edolstra commented on August 16, 2024

@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.

from nix.

kosmikus avatar kosmikus commented on August 16, 2024

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.

from nix.

kosmikus avatar kosmikus commented on August 16, 2024

Committed as NixOS/nixpkgs@3fbd694.

from nix.

peti avatar peti commented on August 16, 2024

The crashes in ghcWithPackages are now gone.

from nix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.