Skip to content

Random segfaults with aarch64-darwin on flakes based project #4919

@hlolli

Description

@hlolli

Describe the bug

Feel free to close since this doesn't fit a good ticket criteria. But I've been experiencing one of those hard to reproduce bugs. Where when I want to enter a dev shell in a project I'm working on (nix develop), I'm met with SIGSEV. Sometimes trying again does the trick and everything works normal. But sometimes this is more annoying.

Additional context

I executed the the failing command with lldb, and luckily my nix binary has all the debugging symbols I think is needed to track down the issue here. But I may be wrong

> lldb (which nix) develop
(lldb) target create "/run/current-system/sw/bin/nix"
Current executable set to '/run/current-system/sw/bin/nix' (arm64).
(lldb) settings set -- target.run-args  "develop"
(lldb) r
warning: (arm64) /nix/store/1ibx05mgkbfrfmrvvjnjfmnyyb6nc37v-nix-2.4pre20210503_6d2553a/bin/nix(0x0000000100000000) address 0x0000000100000000 maps to more than one section: nix.__TEXT and nix.__TEXT
warning: (arm64) /nix/store/1ibx05mgkbfrfmrvvjnjfmnyyb6nc37v-nix-2.4pre20210503_6d2553a/bin/nix(0x0000000100000000) address 0x0000000100170000 maps to more than one section: nix.__DATA_CONST and nix.__DATA_CONST
warning: (arm64) /nix/store/1ibx05mgkbfrfmrvvjnjfmnyyb6nc37v-nix-2.4pre20210503_6d2553a/bin/nix(0x0000000100000000) address 0x00000001001a0000 maps to more than one section: nix.__DATA and nix.__DATA
Process 1493 launched: '/run/current-system/sw/bin/nix' (arm64)
warning: (arm64) /run/current-system/sw/bin/nix(0x0000000100000000) address 0x0000000100000000 maps to more than one section: nix.__TEXT and nix.__TEXT
warning: (arm64) /run/current-system/sw/bin/nix(0x0000000100000000) address 0x0000000100170000 maps to more than one section: nix.__DATA_CONST and nix.__DATA_CONST
warning: (arm64) /run/current-system/sw/bin/nix(0x0000000100000000) address 0x00000001001a0000 maps to more than one section: nix.__DATA and nix.__DATA
warning: unknown setting 'allowUnfree'
warning: Git tree '/Users/hlodversigurdsson/Documents/kudos' is dirty
Process 1493 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x157c04000)
    frame #0: 0x000000010061ae48 libgc.1.dylib`GC_push_all_stack + 228
libgc.1.dylib`GC_push_all_stack:
->  0x10061ae48 <+228>: ldr    x0, [x19]
    0x10061ae4c <+232>: cmp    x0, x22
    0x10061ae50 <+236>: ccmp   x0, x21, #0x2, hs
    0x10061ae54 <+240>: b.hs   0x10061ae3c               ; <+216>
Target 0: (nix) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x157c04000)
  * frame #0: 0x000000010061ae48 libgc.1.dylib`GC_push_all_stack + 228
    frame #1: 0x0000000100620dd8 libgc.1.dylib`GC_push_all_stacks + 248
    frame #2: 0x000000010060e67c libgc.1.dylib`GC_mark_some + 236
    frame #3: 0x000000010060db88 libgc.1.dylib`GC_stopped_mark + 360
    frame #4: 0x000000010060d544 libgc.1.dylib`GC_try_to_collect_inner + 492
    frame #5: 0x0000000100610e00 libgc.1.dylib`GC_collect_or_expand + 284
    frame #6: 0x0000000100611020 libgc.1.dylib`GC_allocobj + 156
    frame #7: 0x0000000100607c48 libgc.1.dylib`GC_generic_malloc_inner + 312
    frame #8: 0x0000000100617ea0 libgc.1.dylib`GC_generic_malloc_many + 1108
    frame #9: 0x0000000100616e9c libgc.1.dylib`GC_malloc_kind + 188
    frame #10: 0x00000001004710e0 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 488
    frame #11: 0x00000001004747d0 libnixexpr.dylib`nix::EvalState::coerceToString(nix::Pos const&, nix::Value&, std::__1::set<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&, bool, bool) + 88
    frame #12: 0x00000001004ff840 libnixexpr.dylib`nix::prim_concatStringsSep(nix::EvalState&, nix::Pos const&, nix::Value**, nix::Value&) + 400
    frame #13: 0x0000000100471978 libnixexpr.dylib`nix::EvalState::callPrimOp(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 516
    frame #14: 0x0000000100470fb4 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 188
    frame #15: 0x0000000100470ec8 libnixexpr.dylib`nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) + 120
    frame #16: 0x00000001004713f0 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 1272
    frame #17: 0x0000000100470ec8 libnixexpr.dylib`nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) + 120
    frame #18: 0x0000000100473714 libnixexpr.dylib`nix::ExprOpNEq::eval(nix::EvalState&, nix::Env&, nix::Value&) + 72
    frame #19: 0x000000010046f758 libnixexpr.dylib`nix::EvalState::forceValue(nix::Value&, nix::Pos const&) + 144
    frame #20: 0x0000000100470068 libnixexpr.dylib`nix::ExprVar::eval(nix::EvalState&, nix::Env&, nix::Value&) + 68
    frame #21: 0x0000000100473920 libnixexpr.dylib`nix::ExprOpOr::eval(nix::EvalState&, nix::Env&, nix::Value&) + 136
    frame #22: 0x0000000100472988 libnixexpr.dylib`nix::ExprIf::eval(nix::EvalState&, nix::Env&, nix::Value&) + 72
    frame #23: 0x0000000100474308 libnixexpr.dylib`nix::ExprConcatStrings::eval(nix::EvalState&, nix::Env&, nix::Value&) + 344
    frame #24: 0x00000001004713f0 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 1272
    frame #25: 0x0000000100470ec8 libnixexpr.dylib`nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) + 120
    frame #26: 0x000000010046f758 libnixexpr.dylib`nix::EvalState::forceValue(nix::Value&, nix::Pos const&) + 144
    frame #27: 0x000000010047544c libnixexpr.dylib`nix::EvalState::forceString(nix::Value&, nix::Pos const&) + 32
    frame #28: 0x0000000100475cc0 libnixexpr.dylib`nix::EvalState::forceString(nix::Value&, std::__1::set<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >&, nix::Pos const&) + 36
    frame #29: 0x00000001004fd5c0 libnixexpr.dylib`nix::prim_match(nix::EvalState&, nix::Pos const&, nix::Value**, nix::Value&) + 244
    frame #30: 0x0000000100471978 libnixexpr.dylib`nix::EvalState::callPrimOp(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 516
    frame #31: 0x0000000100470fb4 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 188
    frame #32: 0x0000000100470ec8 libnixexpr.dylib`nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) + 120
    frame #33: 0x000000010046f758 libnixexpr.dylib`nix::EvalState::forceValue(nix::Value&, nix::Pos const&) + 144
    frame #34: 0x0000000100470068 libnixexpr.dylib`nix::ExprVar::eval(nix::EvalState&, nix::Env&, nix::Value&) + 68
    frame #35: 0x0000000100473714 libnixexpr.dylib`nix::ExprOpNEq::eval(nix::EvalState&, nix::Env&, nix::Value&) + 72
    frame #36: 0x0000000100472988 libnixexpr.dylib`nix::ExprIf::eval(nix::EvalState&, nix::Env&, nix::Value&) + 72
    frame #37: 0x00000001004713f0 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 1272
    frame #38: 0x0000000100470ec8 libnixexpr.dylib`nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) + 120
    frame #39: 0x00000001004713f0 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 1272
    frame #40: 0x0000000100470ec8 libnixexpr.dylib`nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) + 120
    frame #41: 0x000000010050c9a8 libnixexpr.dylib`nix::elemAt(nix::EvalState&, nix::Pos const&, nix::Value&, int, nix::Value&) + 260
    frame #42: 0x0000000100471978 libnixexpr.dylib`nix::EvalState::callPrimOp(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 516
    frame #43: 0x0000000100470fb4 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 188
    frame #44: 0x0000000100470ec8 libnixexpr.dylib`nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) + 120
    frame #45: 0x000000010046f758 libnixexpr.dylib`nix::EvalState::forceValue(nix::Value&, nix::Pos const&) + 144
    frame #46: 0x000000010047544c libnixexpr.dylib`nix::EvalState::forceString(nix::Value&, nix::Pos const&) + 32
    frame #47: 0x000000010046f7d8 libnixexpr.dylib`nix::EvalState::forceStringNoCtx(nix::Value&, nix::Pos const&) + 64
    frame #48: 0x00000001004fd51c libnixexpr.dylib`nix::prim_match(nix::EvalState&, nix::Pos const&, nix::Value**, nix::Value&) + 80
    frame #49: 0x0000000100471978 libnixexpr.dylib`nix::EvalState::callPrimOp(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 516
    frame #50: 0x0000000100470fb4 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 188
    frame #51: 0x0000000100470ec8 libnixexpr.dylib`nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) + 120
    frame #52: 0x0000000100473714 libnixexpr.dylib`nix::ExprOpNEq::eval(nix::EvalState&, nix::Env&, nix::Value&) + 72
    frame #53: 0x00000001004713f0 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 1272
    frame #54: 0x0000000100470ec8 libnixexpr.dylib`nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) + 120
    frame #55: 0x000000010050c9a8 libnixexpr.dylib`nix::elemAt(nix::EvalState&, nix::Pos const&, nix::Value&, int, nix::Value&) + 260
    frame #56: 0x0000000100471978 libnixexpr.dylib`nix::EvalState::callPrimOp(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 516
    frame #57: 0x0000000100470fb4 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 188
    frame #58: 0x00000001004fa5d8 libnixexpr.dylib`nix::prim_filter(nix::EvalState&, nix::Pos const&, nix::Value**, nix::Value&) + 304
    frame #59: 0x0000000100471978 libnixexpr.dylib`nix::EvalState::callPrimOp(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 516
    frame #60: 0x0000000100470fb4 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 188
    frame #61: 0x0000000100470ec8 libnixexpr.dylib`nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) + 120
    frame #62: 0x0000000100473f00 libnixexpr.dylib`nix::ExprOpConcatLists::eval(nix::EvalState&, nix::Env&, nix::Value&) + 112
    frame #63: 0x00000001004ed378 libnixexpr.dylib`nix::EvalState::forceList(nix::Value&, nix::Pos const&) + 132
    frame #64: 0x00000001004fa838 libnixexpr.dylib`nix::prim_length(nix::EvalState&, nix::Pos const&, nix::Value**, nix::Value&) + 32
    frame #65: 0x0000000100471978 libnixexpr.dylib`nix::EvalState::callPrimOp(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 516
    frame #66: 0x0000000100470fb4 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 188
    frame #67: 0x0000000100470ec8 libnixexpr.dylib`nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) + 120
    frame #68: 0x00000001004fbec8 libnixexpr.dylib`nix::prim_sub(nix::EvalState&, nix::Pos const&, nix::Value**, nix::Value&) + 148
    frame #69: 0x0000000100471978 libnixexpr.dylib`nix::EvalState::callPrimOp(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 516
    frame #70: 0x0000000100470fb4 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 188
    frame #71: 0x0000000100470ec8 libnixexpr.dylib`nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) + 120
    frame #72: 0x000000010046f758 libnixexpr.dylib`nix::EvalState::forceValue(nix::Value&, nix::Pos const&) + 144
    frame #73: 0x000000010047517c libnixexpr.dylib`nix::EvalState::forceInt(nix::Value&, nix::Pos const&) + 24
    frame #74: 0x00000001004f9e7c libnixexpr.dylib`nix::prim_elemAt(nix::EvalState&, nix::Pos const&, nix::Value**, nix::Value&) + 40
    frame #75: 0x0000000100471978 libnixexpr.dylib`nix::EvalState::callPrimOp(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 516
    frame #76: 0x0000000100470fb4 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 188
    frame #77: 0x0000000100470ec8 libnixexpr.dylib`nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) + 120
    frame #78: 0x00000001004713f0 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 1272
    frame #79: 0x0000000100470ec8 libnixexpr.dylib`nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) + 120
    frame #80: 0x00000001004ed378 libnixexpr.dylib`nix::EvalState::forceList(nix::Value&, nix::Pos const&) + 132
    frame #81: 0x00000001004fa838 libnixexpr.dylib`nix::prim_length(nix::EvalState&, nix::Pos const&, nix::Value**, nix::Value&) + 32
    frame #82: 0x0000000100471978 libnixexpr.dylib`nix::EvalState::callPrimOp(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 516
    frame #83: 0x0000000100470fb4 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 188
    frame #84: 0x0000000100470ec8 libnixexpr.dylib`nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) + 120
    frame #85: 0x00000001004fbec8 libnixexpr.dylib`nix::prim_sub(nix::EvalState&, nix::Pos const&, nix::Value**, nix::Value&) + 148
    frame #86: 0x0000000100471978 libnixexpr.dylib`nix::EvalState::callPrimOp(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 516
    frame #87: 0x0000000100470fb4 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 188
    frame #88: 0x0000000100470ec8 libnixexpr.dylib`nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) + 120
    frame #89: 0x000000010046f758 libnixexpr.dylib`nix::EvalState::forceValue(nix::Value&, nix::Pos const&) + 144
    frame #90: 0x000000010047517c libnixexpr.dylib`nix::EvalState::forceInt(nix::Value&, nix::Pos const&) + 24
    frame #91: 0x00000001004f9e7c libnixexpr.dylib`nix::prim_elemAt(nix::EvalState&, nix::Pos const&, nix::Value**, nix::Value&) + 40
    frame #92: 0x0000000100471978 libnixexpr.dylib`nix::EvalState::callPrimOp(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 516
    frame #93: 0x0000000100470fb4 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 188
    frame #94: 0x0000000100470ec8 libnixexpr.dylib`nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) + 120
    frame #95: 0x00000001004713f0 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 1272
    frame #96: 0x0000000100470ec8 libnixexpr.dylib`nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) + 120
    frame #97: 0x00000001004713f0 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 1272
    frame #98: 0x0000000100470ec8 libnixexpr.dylib`nix::ExprApp::eval(nix::EvalState&, nix::Env&, nix::Value&) + 120
    frame #99: 0x00000001004737d4 libnixexpr.dylib`nix::ExprOpAnd::eval(nix::EvalState&, nix::Env&, nix::Value&) + 80
    frame #100: 0x00000001004713f0 libnixexpr.dylib`nix::EvalState::callFunction(nix::Value&, nix::Value&, nix::Value&, nix::Pos const&) + 1272
    frame #101: 0x0000000100508754 libnixexpr.dylib`std::__1::__function::__func<nix::addPath(nix::EvalState&, nix::Pos const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, nix::Value*, nix::FileIngestionMethod, std::__1::optional<nix::Hash>, nix::Value&)::$_7, std::__1::allocator<nix::addPath(nix::EvalState&, nix::Pos const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, nix::Value*, nix::FileIngestionMethod, std::__1::optional<nix::Hash>, nix::Value&)::$_7>, bool (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)>::operator()(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 248
    frame #102: 0x0000000100c489b4 libnixutil.dylib`nix::dump(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, nix::Sink&, std::__1::function<bool (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)>&) + 1948
    frame #103: 0x0000000100c48b64 libnixutil.dylib`nix::dump(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, nix::Sink&, std::__1::function<bool (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)>&) + 2380
    frame #104: 0x0000000100c48b64 libnixutil.dylib`nix::dump(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, nix::Sink&, std::__1::function<bool (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)>&) + 2380
    frame #105: 0x0000000100c98b84 libnixutil.dylib`void boost::context::detail::fiber_entry<boost::context::detail::fiber_record<boost::context::fiber, nix::VirtualStackAllocator, boost::coroutines2::detail::pull_coroutine<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::control_block::control_block<nix::VirtualStackAllocator, nix::sinkToSource(std::__1::function<void (nix::Sink&)>, std::__1::function<void ()>)::SinkToSource::read(char*, unsigned long)::'lambda'(boost::coroutines2::detail::push_coroutine<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&)>(boost::context::preallocated, nix::VirtualStackAllocator&&, nix::sinkToSource(std::__1::function<void (nix::Sink&)>, std::__1::function<void ()>)::SinkToSource::read(char*, unsigned long)::'lambda'(boost::coroutines2::detail::push_coroutine<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >&)&&)::'lambda'(boost::context::fiber&&)> >(boost::context::detail::transfer_t) + 232
    frame #106: 0x0000000100ea7338 libboost_context.dylib`make_fcontext + 24
    ```

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions