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 crashes reproducible with building openstack image #4741

Open
Mic92 opened this issue Apr 25, 2021 · 2 comments
Open

Nix crashes reproducible with building openstack image #4741

Mic92 opened this issue Apr 25, 2021 · 2 comments

Comments

@Mic92
Copy link
Member

Mic92 commented Apr 25, 2021

Describe the bug

Found while reviewing: NixOS/nixpkgs#120489

$ NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz gdb ./outputs/out/bin/nix-build '<nixpkgs/nixos>' -A config.system.build.openstackImage --arg configuration "{ imports = [ <nixpkgs/nixos/maintainers/scripts/openstack/openstack-image.nix> ]; }"
Segmentation fault (core dumped)
...
(gdb) bt
#0  0x00007ffff7b14d40 in GC_push_all_eager () from /nix/store/2bzqdg4ymd37xbrddrfa6ywy0npdlmd6-boehm-gc-8.0.4/lib/libgc.so.1
#1  0x00007ffff7b22da0 in GC_push_all_stacks () from /nix/store/2bzqdg4ymd37xbrddrfa6ywy0npdlmd6-boehm-gc-8.0.4/lib/libgc.so.1
#2  0x00007ffff7b1e7b7 in GC_mark_some () from /nix/store/2bzqdg4ymd37xbrddrfa6ywy0npdlmd6-boehm-gc-8.0.4/lib/libgc.so.1
#3  0x00007ffff7b1e9d5 in GC_stopped_mark () from /nix/store/2bzqdg4ymd37xbrddrfa6ywy0npdlmd6-boehm-gc-8.0.4/lib/libgc.so.1
#4  0x00007ffff7b1fff4 in GC_try_to_collect_inner () from /nix/store/2bzqdg4ymd37xbrddrfa6ywy0npdlmd6-boehm-gc-8.0.4/lib/libgc.so.1
#5  0x00007ffff7b20368 in GC_collect_or_expand () from /nix/store/2bzqdg4ymd37xbrddrfa6ywy0npdlmd6-boehm-gc-8.0.4/lib/libgc.so.1
#6  0x00007ffff7b20728 in GC_allocobj () from /nix/store/2bzqdg4ymd37xbrddrfa6ywy0npdlmd6-boehm-gc-8.0.4/lib/libgc.so.1
#7  0x00007ffff7b20abf in GC_generic_malloc_inner () from /nix/store/2bzqdg4ymd37xbrddrfa6ywy0npdlmd6-boehm-gc-8.0.4/lib/libgc.so.1
#8  0x00007ffff7b2586e in GC_generic_malloc_many () from /nix/store/2bzqdg4ymd37xbrddrfa6ywy0npdlmd6-boehm-gc-8.0.4/lib/libgc.so.1
#9  0x00007ffff7b25a52 in GC_malloc_kind () from /nix/store/2bzqdg4ymd37xbrddrfa6ywy0npdlmd6-boehm-gc-8.0.4/lib/libgc.so.1
#10 0x00007ffff7e45956 in nix::allocBytes (n=24) at src/libexpr/eval-inline.hh:90
#11 nix::EvalState::allocValue (this=<optimized out>) at src/libexpr/eval.cc:773
#12 0x00007ffff7e46ccc in nix::EvalState::callPrimOp (this=this@entry=0x6cfe00, fun=..., arg=..., v=..., pos=...) at src/libexpr/eval.cc:1243
#13 0x00007ffff7e4ca7e in nix::EvalState::callFunction (this=0x6cfe00, fun=..., arg=..., v=..., pos=...) at src/libexpr/eval.cc:1256
#14 0x00007ffff7e4d25d in nix::ExprApp::eval (this=0x3a99040, state=..., env=..., v=...) at src/libexpr/eval.cc:1211
#15 0x00007ffff7e4d238 in nix::ExprApp::eval (this=0x3a99080, state=..., env=..., v=...) at src/libexpr/eval.cc:1210
#16 0x0000000000539f98 in nix::EvalState::forceValue (this=<optimized out>, v=..., pos=...) at src/libexpr/eval-inline.hh:41
#17 0x00007ffff7e4d9b2 in nix::EvalState::forceInt (this=this@entry=0x6cfe00, v=..., pos=...) at src/libexpr/eval.cc:1648
#18 0x00007ffff7ece2da in nix::prim_substring (state=..., pos=..., args=0x7fffa543d7d0, v=...) at src/libexpr/primops.cc:3089
#19 0x00007ffff7e46c95 in nix::EvalState::callPrimOp (this=this@entry=0x6cfe00, fun=..., arg=..., v=..., pos=...) at src/libexpr/eval.cc:1241
#20 0x00007ffff7e4ca7e in nix::EvalState::callFunction (this=0x6cfe00, fun=..., arg=..., v=..., pos=...) at src/libexpr/eval.cc:1256
#21 0x00007ffff7e4d25d in nix::ExprApp::eval (this=0x3a99200, state=..., env=..., v=...) at src/libexpr/eval.cc:1211
#22 0x00007ffff7e4f928 in nix::ExprOpEq::eval (this=0x3a992a0, state=..., env=..., v=...) at src/libexpr/eval.cc:1445
#23 0x00007ffff7e4f4b8 in nix::EvalState::evalBool (pos=..., e=<optimized out>, env=..., this=0x6cfe00) at src/libexpr/eval.cc:949
#24 nix::ExprOpAnd::eval (this=0x3a992e0, state=..., env=..., v=...) at src/libexpr/eval.cc:1461
#25 0x00007ffff7e4ca9c in nix::EvalState::callFunction (this=0x6cfe00, fun=..., arg=..., v=..., pos=...) at src/libexpr/eval.cc:1343
#26 0x00007ffff7e4d25d in nix::ExprApp::eval (this=0x8a91ee0, state=..., env=..., v=...) at src/libexpr/eval.cc:1211
#27 0x00007ffff7e4f3c8 in nix::EvalState::evalBool (pos=..., e=<optimized out>, env=..., this=0x6cfe00) at src/libexpr/eval.cc:949
#28 nix::ExprOpOr::eval (this=0x8a91f20, state=..., env=..., v=...) at src/libexpr/eval.cc:1467
#29 0x00007ffff7e4f355 in nix::EvalState::evalBool (pos=..., e=<optimized out>, env=..., this=0x6cfe00) at src/libexpr/eval.cc:949
#30 nix::ExprOpOr::eval (this=0x8a921a0, state=..., env=..., v=...) at src/libexpr/eval.cc:1467
#31 0x00007ffff7e4f355 in nix::EvalState::evalBool (pos=..., e=<optimized out>, env=..., this=0x6cfe00) at src/libexpr/eval.cc:949
#32 nix::ExprOpOr::eval (this=0x8a8fe20, state=..., env=..., v=...) at src/libexpr/eval.cc:1467
#33 0x00007ffff7e4bfc9 in nix::EvalState::evalBool (e=<optimized out>, env=..., this=<optimized out>) at src/libexpr/eval.cc:939
#34 nix::ExprOpNot::eval (this=<optimized out>, state=..., env=..., v=...) at src/libexpr/eval.cc:1439
#35 0x00007ffff7e4ca9c in nix::EvalState::callFunction (this=0x6cfe00, fun=..., arg=..., v=..., pos=...) at src/libexpr/eval.cc:1343
#36 0x00007ffff7ec91f6 in nix::<lambda(const Path&)>::operator()(const nix::Path &) const (__closure=0x8ae4e90, path=...) at src/libexpr/primops.cc:1827
#37 0x00007ffff75c8182 in std::function<bool (std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (__args#0="/nix/store/9jkmbh9njs56x4qkx297kp8ybhsfyyl1-source/pkgs/development/pure-modules/gen", this=0x7ffffffe63d0) at /nix/store/2mgq3kcgv4hmfav47dpgfp2w71dwwqa0-gcc-9.3.0/include/c++/9.3.0/bits/std_function.h:688
#38 nix::dump (path="/nix/store/9jkmbh9njs56x4qkx297kp8ybhsfyyl1-source/pkgs/development/pure-modules", sink=..., filter=...) at src/libutil/archive.cc:105
#39 0x00007ffff75c8358 in nix::dump (path="/nix/store/9jkmbh9njs56x4qkx297kp8ybhsfyyl1-source/pkgs/development", sink=..., filter=...) at src/libutil/archive.cc:107
#40 0x00007ffff75c8358 in nix::dump (path="/nix/store/9jkmbh9njs56x4qkx297kp8ybhsfyyl1-source/pkgs", sink=..., filter=...) at src/libutil/archive.cc:107
#41 0x00007ffff75c8358 in nix::dump (path="/nix/store/9jkmbh9njs56x4qkx297kp8ybhsfyyl1-source", sink=..., filter=...) at src/libutil/archive.cc:107
#42 0x00007ffff7612270 in std::function<void (nix::Sink&)>::operator()(nix::Sink&) const (__args#0=..., this=0x8b02648) at /nix/store/2mgq3kcgv4hmfav47dpgfp2w71dwwqa0-gcc-9.3.0/include/c++/9.3.0/bits/std_function.h:688
#43 nix::SinkToSource::<lambda(boost::coroutines2::coroutine<std::__cxx11::basic_string<char> >::push_type&)>::operator() (__closure=<synthetic pointer>, yield=...) at src/libutil/serialise.cc:286
#44 boost::coroutines2::detail::pull_coroutine<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::control_block::<lambda(boost::context::fiber&&)>::operator() (c=..., this=<optimized out>) at include/boost/coroutine2/detail/pull_control_block_cc.ipp:84
#45 std::__invoke_impl<boost::context::fiber, boost::coroutines2::detail::pull_coroutine<T>::control_block::control_block(boost::context::preallocated, StackAllocator&&, Fn&&) [with StackAllocator = nix::VirtualStackAllocator; Fn = nix::sinkToSource(std::function<void(nix::Sink&)>, std::function<void()>)::SinkToSource::read(char*, size_t)::<lambda(boost::coroutines2::coroutine<std::__cxx11::basic_string<char> >::push_type&)>; T = std::__cxx11::basic_string<char>]::<lambda(boost::context::fiber&&)>&, boost::context::fiber> (__f=...) at /nix/store/2mgq3kcgv4hmfav47dpgfp2w71dwwqa0-gcc-9.3.0/include/c++/9.3.0/bits/invoke.h:60
#46 std::__invoke<boost::coroutines2::detail::pull_coroutine<T>::control_block::control_block(boost::context::preallocated, StackAllocator&&, Fn&&) [with StackAllocator = nix::VirtualStackAllocator; Fn = nix::sinkToSource(std::function<void(nix::Sink&)>, std::function<void()>)::SinkToSource::read(char*, size_t)::<lambda(boost::coroutines2::coroutine<std::__cxx11::basic_string<char> >::push_type&)>; T = std::__cxx11::basic_string<char>]::<lambda(boost::context::fiber&&)>&, boost::context::fiber> (__fn=...) at /nix/store/2mgq3kcgv4hmfav47dpgfp2w71dwwqa0-gcc-9.3.0/include/c++/9.3.0/bits/invoke.h:96
#47 std::invoke<boost::coroutines2::detail::pull_coroutine<T>::control_block::control_block(boost::context::preallocated, StackAllocator&&, Fn&&) [with StackAllocator = nix::VirtualStackAllocator; Fn = nix::sinkToSource(std::function<void(nix::Sink&)>, std::function<void()>)::SinkToSource::read(char*, size_t)::<lambda(boost::coroutines2::coroutine<std::__cxx11::basic_string<char> >::push_type&)>; T = std::__cxx11::basic_string<char>]::<lambda(boost::context::fiber&&)>&, boost::context::fiber> (__fn=...) at /nix/store/2mgq3kcgv4hmfav47dpgfp2w71dwwqa0-gcc-9.3.0/include/c++/9.3.0/functional:82
#48 boost::context::detail::fiber_record<boost::context::fiber, nix::VirtualStackAllocator, boost::coroutines2::detail::pull_coroutine<T>::control_block::control_block(boost::context::preallocated, StackAllocator&&, Fn&&) [with StackAllocator = nix::VirtualStackAllocator; Fn = nix::sinkToSource(std::function<void(nix::Sink&)>, std::function<void()>)::SinkToSource::read(char*, size_t)::<lambda(boost::coroutines2::coroutine<std::__cxx11::basic_string<char> >::push_type&)>; T = std::__cxx11::basic_string<char>]::<lambda(boost::context::fiber&&)> >::run (fctx=<optimized out>, this=<optimized out>) at include/boost/context/fiber_fcontext.hpp:144
#49 boost::context::detail::fiber_entry<boost::context::detail::fiber_record<boost::context::fiber, nix::VirtualStackAllocator, boost::coroutines2::detail::pull_coroutine<T>::control_block::control_block(boost::context::preallocated, StackAllocator&&, Fn&&) [with StackAllocator = nix::VirtualStackAllocator; Fn = nix::sinkToSource(std::function<void(nix::Sink&)>, std::function<void()>)::SinkToSource::read(char*, size_t)::<lambda(boost::coroutines2::coroutine<std::__cxx11::basic_string<char> >::push_type&)>; T = std::__cxx11::basic_string<char>]::<lambda(boost::context::fiber&&)> > >(boost::context::detail::transfer_t) (t=...) at include/boost/context/fiber_fcontext.hpp:80
#50 0x00007ffff6fa01ef in make_fcontext () from /nix/store/axhx785ch3g7ir9l6fv8fmj6pri3hbml-boost-1.69.0/lib/libboost_context.so.1.69.0
#51 0x0000000000000000 in ?? ()

This happens in both the nixpkgs version of nixUnstable as well as a fresh build from git on revision fe2bf46

@Mic92 Mic92 added the bug label Apr 25, 2021
@Mic92
Copy link
Member Author

Mic92 commented Apr 25, 2021

What I noticed is that nix also spawns a massive amounts of threads while doing the evaluation. But this is rather a performance issue.

@stale
Copy link

stale bot commented Oct 22, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Oct 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant