Skip to content

bun crashes when loading re2 #20454

Closed

Description

@trashhalo

How can we reproduce the crash?

  1. grab this file https://gist.github.com/trashhalo/3fd7de9fc3425a974744e273bdabb095
  2. chmod +x ./check-dependency-updates.ts
  3. if you have mise run mise exec bun@latest -- ./check-dependency-updates.ts

Relevant log output

Crashed while loading native module: /Users/stephensolka/dev/renovate/node_modules/re2/build/Release/re2.node
oh no: Bun has crashed. This indicates a bug in Bun, not your code.

To send a redacted crash report to Bun's team,
please file a GitHub issue using the link below:

 https://bun.report/1.2.14/Ma16a363a3OiggQ__2yi+iB_______A2AA

Stack Trace (bun.report)

Bun v1.2.14 (6a363a3) on macos aarch64 [RunAsNodeCommand]

Segmentation fault at address 0x00000000

  • 2 unknown/js code
  • node_module_register

Features: transpiler_cache, tsconfig, process_dlopen, Bun.stderr, Bun.stdin, Bun.stdout, jsc

Sentry Issue: BUN-DCM

Activity

  1. added
    crash
    on Jun 17, 2025
  2. added
    macOS
    on Jun 17, 2025
  3. github-actions commented on Jun 17, 2025

    @github-actions
    Contributor

    @trashhalo, the latest version of Bun is v1.2.16, but this crash was reported on Bun v1.2.14.

    Are you able to reproduce this crash on the latest version of Bun?

    bun upgrade
  4. added
    napi
    on Jun 18, 2025
  5. RiskyMH commented on Jun 18, 2025

    @RiskyMH
    Contributor

    Can confirm. Just needed to ensure bun runtime for install (bunx --bun bun install renovate). So wouldn't be suprised if node-gyp doesn't work well under bun's runtime as it works well when installed using actual node installed.

    Also ASAN trace:

    AddressSanitizer:DEADLYSIGNAL
    =================================================================
    ==33500==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x000000000000 bp 0x00016b4efb70 sp 0x00016b4efb20 T0)
    ==33500==Hint: pc points to the zero page.
    ==33500==The signal is caused by a READ memory access.
    ==33500==Hint: address points to the zero page.
        #0 0x000000000000  (<unknown module>)
        #1 0x000105610118 in node_module_register node.cpp:93
        #2 0x000188deaef8 in invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const+0x1b8 (dyld:arm64+0xfffffffffff56ef8)
        #3 0x000188e2763c  (<unknown module>)
        #4 0x000188e47588  (<unknown module>)
        #5 0x000188e44314  (<unknown module>)
        #6 0x000188e45a54  (<unknown module>)
        #7 0x000188e1cb5c  (<unknown module>)
        #8 0x000188e272dc  (<unknown module>)
        #9 0x000188deacb0 in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const+0xac (dyld:arm64+0xfffffffffff56cb0)
        #10 0x000188df266c  (<unknown module>)
        #11 0x000188deb45c in dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&, dyld3::Array<dyld4::Loader const*>&) const+0x130 (dyld:arm64+0xfffffffffff5745c)
        #12 0x000188defbec  (<unknown module>)
        #13 0x000188deb778 in dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const+0x2c8 (dyld:arm64+0xfffffffffff57778)
        #14 0x000188e0f100  (<unknown module>)
        #15 0x000188e03f58  (<unknown module>)
        #16 0x000188e03a3c  (<unknown module>)
        #17 0x00011e20ab0c in dlopen+0x140 (libclang_rt.asan_osx_dynamic.dylib:arm64+0x3eb0c)
        #18 0x000104ddb7c4 in Bun::Process_functionDlopen(JSC::JSGlobalObject*, JSC::CallFrame*) BunProcess.cpp:504
        #19 0x000300010038  (<unknown module>)
        #20 0x000111c54f70 in jsc_llint_commonCallOp__llintOpWithMetadata__llintOpWithReturn__llintOp__commonOp__fn__fn__makeReturn__fn__fn__fn__844_callHelper__dispatch_LowLevelInterpreter64_asm_2535+0x0 (bun-debug:arm64+0x10d36cf70)
        #21 0x000300030168  (<unknown module>)
        #22 0x000111c539d8 in jsc_llint_commonCallOp__llintOpWithMetadata__llintOpWithReturn__llintOp__commonOp__fn__fn__makeReturn__fn__fn__fn__826_callHelper__dispatch_LowLevelInterpreter64_asm_2535+0x0 (bun-debug:arm64+0x10d36b9d8)
        #23 0x000111c2a454 in llint_call_javascript+0x4 (bun-debug:arm64+0x10d342454)
        #24 0x00010ef836a4 in JSC::Interpreter::executeCallImpl(JSC::VM&, JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) Interpreter.cpp:1322
        #25 0x00010ef84038 in JSC::Interpreter::executeCall(JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) Interpreter.cpp:1337
        #26 0x00010f6052dc in JSC::call(JSC::JSGlobalObject*, JSC::JSValue, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) CallData.cpp:57
        #27 0x00010f605a30 in JSC::profiledCall(JSC::JSGlobalObject*, JSC::ProfilingReason, JSC::JSValue, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) CallData.cpp:78
        #28 0x0001050beb00 in Bun::evaluateCommonJSModuleOnce(JSC::VM&, Zig::GlobalObject*, Bun::JSCommonJSModule*, JSC::JSString*, JSC::JSValue) JSCommonJSModule.cpp:206
        #29 0x0001050d1b7c in Bun::JSCommonJSModule::evaluate(Zig::GlobalObject*, WTF::String const&, ResolvedSource&, bool) JSCommonJSModule.cpp:1358
        #30 0x0001051c2298 in Bun::JSCommonJSModule::evaluate(Zig::GlobalObject*, WTF::String const&, ResolvedSource&) JSCommonJSModule.h:96
        #31 0x0001051c0a14 in JSC::JSValue Bun::fetchCommonJSModuleNonBuiltin<false>(void*, JSC::VM&, Zig::GlobalObject*, BunString*, JSC::JSValue, BunString*, BunString*, ErrorableResolvedSource*, Bun::JSCommonJSModule*, WTF::String, unsigned char, JSC::ThrowScope&) ModuleLoader.cpp:748
        #32 0x0001051c9aa4 in Bun::fetchCommonJSModule(Zig::GlobalObject*, Bun::JSCommonJSModule*, JSC::JSValue, WTF::String, BunString*, BunString*) ModuleLoader.cpp:725
        #33 0x0001050cfd48 in Bun::jsFunctionRequireCommonJS(JSC::JSGlobalObject*, JSC::CallFrame*) JSCommonJSModule.cpp:1277
        #34 0x000300010038  (<unknown module>)
        #35 0x0003000630a0  (<unknown module>)
        #36 0x000300030168  (<unknown module>)
        #37 0x000111c539d8 in jsc_llint_commonCallOp__llintOpWithMetadata__llintOpWithReturn__llintOp__commonOp__fn__fn__makeReturn__fn__fn__fn__826_callHelper__dispatch_LowLevelInterpreter64_asm_2535+0x0 (bun-debug:arm64+0x10d36b9d8)
        #38 0x000111c2a454 in llint_call_javascript+0x4 (bun-debug:arm64+0x10d342454)
        #39 0x00010ef836a4 in JSC::Interpreter::executeCallImpl(JSC::VM&, JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) Interpreter.cpp:1322
        #40 0x00010ef84038 in JSC::Interpreter::executeCall(JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) Interpreter.cpp:1337
        #41 0x00010f6052dc in JSC::call(JSC::JSGlobalObject*, JSC::JSValue, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) CallData.cpp:57
        #42 0x00010f605a30 in JSC::profiledCall(JSC::JSGlobalObject*, JSC::ProfilingReason, JSC::JSValue, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) CallData.cpp:78
        #43 0x0001050beb00 in Bun::evaluateCommonJSModuleOnce(JSC::VM&, Zig::GlobalObject*, Bun::JSCommonJSModule*, JSC::JSString*, JSC::JSValue) JSCommonJSModule.cpp:206
        #44 0x0001050d1b7c in Bun::JSCommonJSModule::evaluate(Zig::GlobalObject*, WTF::String const&, ResolvedSource&, bool) JSCommonJSModule.cpp:1358
        #45 0x0001051c2298 in Bun::JSCommonJSModule::evaluate(Zig::GlobalObject*, WTF::String const&, ResolvedSource&) JSCommonJSModule.h:96
        #46 0x0001051c0a14 in JSC::JSValue Bun::fetchCommonJSModuleNonBuiltin<false>(void*, JSC::VM&, Zig::GlobalObject*, BunString*, JSC::JSValue, BunString*, BunString*, ErrorableResolvedSource*, Bun::JSCommonJSModule*, WTF::String, unsigned char, JSC::ThrowScope&) ModuleLoader.cpp:748
        #47 0x0001051c9aa4 in Bun::fetchCommonJSModule(Zig::GlobalObject*, Bun::JSCommonJSModule*, JSC::JSValue, WTF::String, BunString*, BunString*) ModuleLoader.cpp:725
        #48 0x0001050cfd48 in Bun::jsFunctionRequireCommonJS(JSC::JSGlobalObject*, JSC::CallFrame*) JSCommonJSModule.cpp:1277
        #49 0x000300010038  (<unknown module>)
        #50 0x0003000630a0  (<unknown module>)
        #51 0x000300030168  (<unknown module>)
        #52 0x000111c539d8 in jsc_llint_commonCallOp__llintOpWithMetadata__llintOpWithReturn__llintOp__commonOp__fn__fn__makeReturn__fn__fn__fn__826_callHelper__dispatch_LowLevelInterpreter64_asm_2535+0x0 (bun-debug:arm64+0x10d36b9d8)
        #53 0x000111c2a454 in llint_call_javascript+0x4 (bun-debug:arm64+0x10d342454)
        #54 0x00010ef836a4 in JSC::Interpreter::executeCallImpl(JSC::VM&, JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) Interpreter.cpp:1322
        #55 0x00010ef84038 in JSC::Interpreter::executeCall(JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) Interpreter.cpp:1337
        #56 0x00010f6052dc in JSC::call(JSC::JSGlobalObject*, JSC::JSValue, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) CallData.cpp:57
        #57 0x00010f605a30 in JSC::profiledCall(JSC::JSGlobalObject*, JSC::ProfilingReason, JSC::JSValue, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) CallData.cpp:78
        #58 0x0001050beb00 in Bun::evaluateCommonJSModuleOnce(JSC::VM&, Zig::GlobalObject*, Bun::JSCommonJSModule*, JSC::JSString*, JSC::JSValue) JSCommonJSModule.cpp:206
        #59 0x0001050d1b7c in Bun::JSCommonJSModule::evaluate(Zig::GlobalObject*, WTF::String const&, ResolvedSource&, bool) JSCommonJSModule.cpp:1358
        #60 0x0001051c2298 in Bun::JSCommonJSModule::evaluate(Zig::GlobalObject*, WTF::String const&, ResolvedSource&) JSCommonJSModule.h:96
        #61 0x0001051c0a14 in JSC::JSValue Bun::fetchCommonJSModuleNonBuiltin<false>(void*, JSC::VM&, Zig::GlobalObject*, BunString*, JSC::JSValue, BunString*, BunString*, ErrorableResolvedSource*, Bun::JSCommonJSModule*, WTF::String, unsigned char, JSC::ThrowScope&) ModuleLoader.cpp:748
        #62 0x0001051c9aa4 in Bun::fetchCommonJSModule(Zig::GlobalObject*, Bun::JSCommonJSModule*, JSC::JSValue, WTF::String, BunString*, BunString*) ModuleLoader.cpp:725
        #63 0x0001050cfd48 in Bun::jsFunctionRequireCommonJS(JSC::JSGlobalObject*, JSC::CallFrame*) JSCommonJSModule.cpp:1277
        #64 0x000300010038  (<unknown module>)
        #65 0x0003000630a0  (<unknown module>)
        #66 0x000300030168  (<unknown module>)
        #67 0x000111c539d8 in jsc_llint_commonCallOp__llintOpWithMetadata__llintOpWithReturn__llintOp__commonOp__fn__fn__makeReturn__fn__fn__fn__826_callHelper__dispatch_LowLevelInterpreter64_asm_2535+0x0 (bun-debug:arm64+0x10d36b9d8)
        #68 0x000111c2a454 in llint_call_javascript+0x4 (bun-debug:arm64+0x10d342454)
        #69 0x00010ef836a4 in JSC::Interpreter::executeCallImpl(JSC::VM&, JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) Interpreter.cpp:1322
        #70 0x00010ef84038 in JSC::Interpreter::executeCall(JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) Interpreter.cpp:1337
        #71 0x00010f6052dc in JSC::call(JSC::JSGlobalObject*, JSC::JSValue, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) CallData.cpp:57
        #72 0x00010f605a30 in JSC::profiledCall(JSC::JSGlobalObject*, JSC::ProfilingReason, JSC::JSValue, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) CallData.cpp:78
        #73 0x0001050beb00 in Bun::evaluateCommonJSModuleOnce(JSC::VM&, Zig::GlobalObject*, Bun::JSCommonJSModule*, JSC::JSString*, JSC::JSValue) JSCommonJSModule.cpp:206
        #74 0x0001050d1b7c in Bun::JSCommonJSModule::evaluate(Zig::GlobalObject*, WTF::String const&, ResolvedSource&, bool) JSCommonJSModule.cpp:1358
        #75 0x0001051c2298 in Bun::JSCommonJSModule::evaluate(Zig::GlobalObject*, WTF::String const&, ResolvedSource&) JSCommonJSModule.h:96
        #76 0x0001051c0a14 in JSC::JSValue Bun::fetchCommonJSModuleNonBuiltin<false>(void*, JSC::VM&, Zig::GlobalObject*, BunString*, JSC::JSValue, BunString*, BunString*, ErrorableResolvedSource*, Bun::JSCommonJSModule*, WTF::String, unsigned char, JSC::ThrowScope&) ModuleLoader.cpp:748
        #77 0x0001051c9aa4 in Bun::fetchCommonJSModule(Zig::GlobalObject*, Bun::JSCommonJSModule*, JSC::JSValue, WTF::String, BunString*, BunString*) ModuleLoader.cpp:725
        #78 0x0001050cfd48 in Bun::jsFunctionRequireCommonJS(JSC::JSGlobalObject*, JSC::CallFrame*) JSCommonJSModule.cpp:1277
        #79 0x000300010038  (<unknown module>)
        #80 0x0003000630a0  (<unknown module>)
        #81 0x000300030168  (<unknown module>)
        #82 0x000111c539d8 in jsc_llint_commonCallOp__llintOpWithMetadata__llintOpWithReturn__llintOp__commonOp__fn__fn__makeReturn__fn__fn__fn__826_callHelper__dispatch_LowLevelInterpreter64_asm_2535+0x0 (bun-debug:arm64+0x10d36b9d8)
        #83 0x000111c2a454 in llint_call_javascript+0x4 (bun-debug:arm64+0x10d342454)
        #84 0x00010ef836a4 in JSC::Interpreter::executeCallImpl(JSC::VM&, JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) Interpreter.cpp:1322
        #85 0x00010ef84038 in JSC::Interpreter::executeCall(JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) Interpreter.cpp:1337
        #86 0x00010f6052dc in JSC::call(JSC::JSGlobalObject*, JSC::JSValue, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) CallData.cpp:57
        #87 0x00010f605a30 in JSC::profiledCall(JSC::JSGlobalObject*, JSC::ProfilingReason, JSC::JSValue, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) CallData.cpp:78
        #88 0x0001050beb00 in Bun::evaluateCommonJSModuleOnce(JSC::VM&, Zig::GlobalObject*, Bun::JSCommonJSModule*, JSC::JSString*, JSC::JSValue) JSCommonJSModule.cpp:206
        #89 0x0001050d1b7c in Bun::JSCommonJSModule::evaluate(Zig::GlobalObject*, WTF::String const&, ResolvedSource&, bool) JSCommonJSModule.cpp:1358
        #90 0x0001051c2298 in Bun::JSCommonJSModule::evaluate(Zig::GlobalObject*, WTF::String const&, ResolvedSource&) JSCommonJSModule.h:96
        #91 0x0001051c0a14 in JSC::JSValue Bun::fetchCommonJSModuleNonBuiltin<false>(void*, JSC::VM&, Zig::GlobalObject*, BunString*, JSC::JSValue, BunString*, BunString*, ErrorableResolvedSource*, Bun::JSCommonJSModule*, WTF::String, unsigned char, JSC::ThrowScope&) ModuleLoader.cpp:748
        #92 0x0001051c9aa4 in Bun::fetchCommonJSModule(Zig::GlobalObject*, Bun::JSCommonJSModule*, JSC::JSValue, WTF::String, BunString*, BunString*) ModuleLoader.cpp:725
        #93 0x0001050cfd48 in Bun::jsFunctionRequireCommonJS(JSC::JSGlobalObject*, JSC::CallFrame*) JSCommonJSModule.cpp:1277
        #94 0x000300010038  (<unknown module>)
        #95 0x000111c539d8 in jsc_llint_commonCallOp__llintOpWithMetadata__llintOpWithReturn__llintOp__commonOp__fn__fn__makeReturn__fn__fn__fn__826_callHelper__dispatch_LowLevelInterpreter64_asm_2535+0x0 (bun-debug:arm64+0x10d36b9d8)
        #96 0x000300030168  (<unknown module>)
        #97 0x000111c539d8 in jsc_llint_commonCallOp__llintOpWithMetadata__llintOpWithReturn__llintOp__commonOp__fn__fn__makeReturn__fn__fn__fn__826_callHelper__dispatch_LowLevelInterpreter64_asm_2535+0x0 (bun-debug:arm64+0x10d36b9d8)
        #98 0x000111c2a454 in llint_call_javascript+0x4 (bun-debug:arm64+0x10d342454)
        #99 0x00010ef836a4 in JSC::Interpreter::executeCallImpl(JSC::VM&, JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) Interpreter.cpp:1322
        #100 0x00010ef84038 in JSC::Interpreter::executeCall(JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) Interpreter.cpp:1337
        #101 0x00010f6052dc in JSC::call(JSC::JSGlobalObject*, JSC::JSValue, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) CallData.cpp:57
        #102 0x00010f605a30 in JSC::profiledCall(JSC::JSGlobalObject*, JSC::ProfilingReason, JSC::JSValue, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) CallData.cpp:78
        #103 0x0001050beb00 in Bun::evaluateCommonJSModuleOnce(JSC::VM&, Zig::GlobalObject*, Bun::JSCommonJSModule*, JSC::JSString*, JSC::JSValue) JSCommonJSModule.cpp:206
        #104 0x0001050e34d8 in Bun::createCommonJSModule(Zig::GlobalObject*, JSC::JSString*, ResolvedSource&, bool)::$_0::operator()(JSC::JSGlobalObject*, JSC::Identifier const&, WTF::Vector<JSC::Identifier, 4ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>&, JSC::MarkedVector<JSC::JSValue, 8ul, WTF::RecordOverflow>&) const JSCommonJSModule.cpp:1483
        #105 0x0001050e2f84 in WTF::Detail::CallableWrapper<Bun::createCommonJSModule(Zig::GlobalObject*, JSC::JSString*, ResolvedSource&, bool)::$_0, void, JSC::JSGlobalObject*, JSC::Identifier, WTF::Vector<JSC::Identifier, 4ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>&, JSC::MarkedVector<JSC::JSValue, 8ul, WTF::RecordOverflow>&>::call(JSC::JSGlobalObject*, JSC::Identifier, WTF::Vector<JSC::Identifier, 4ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>&, JSC::MarkedVector<JSC::JSValue, 8ul, WTF::RecordOverflow>&) Function.h:53
        #106 0x00010fa3641c in JSC::moduleLoaderParseModule(JSC::JSGlobalObject*, JSC::CallFrame*) JSModuleLoader.cpp:381
        #107 0x000300010038  (<unknown module>)
        #108 0x000111c539d8 in jsc_llint_commonCallOp__llintOpWithMetadata__llintOpWithReturn__llintOp__commonOp__fn__fn__makeReturn__fn__fn__fn__826_callHelper__dispatch_LowLevelInterpreter64_asm_2535+0x0 (bun-debug:arm64+0x10d36b9d8)
        #109 0x000111c539d8 in jsc_llint_commonCallOp__llintOpWithMetadata__llintOpWithReturn__llintOp__commonOp__fn__fn__makeReturn__fn__fn__fn__826_callHelper__dispatch_LowLevelInterpreter64_asm_2535+0x0 (bun-debug:arm64+0x10d36b9d8)
        #110 0x000111c54f70 in jsc_llint_commonCallOp__llintOpWithMetadata__llintOpWithReturn__llintOp__commonOp__fn__fn__makeReturn__fn__fn__fn__844_callHelper__dispatch_LowLevelInterpreter64_asm_2535+0x0 (bun-debug:arm64+0x10d36cf70)
        #111 0x000111c54f70 in jsc_llint_commonCallOp__llintOpWithMetadata__llintOpWithReturn__llintOp__commonOp__fn__fn__makeReturn__fn__fn__fn__844_callHelper__dispatch_LowLevelInterpreter64_asm_2535+0x0 (bun-debug:arm64+0x10d36cf70)
        #112 0x000111c2a454 in llint_call_javascript+0x4 (bun-debug:arm64+0x10d342454)
        #113 0x00010ef836a4 in JSC::Interpreter::executeCallImpl(JSC::VM&, JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) Interpreter.cpp:1322
        #114 0x00010ef84038 in JSC::Interpreter::executeCall(JSC::JSObject*, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) Interpreter.cpp:1337
        #115 0x00010f6052dc in JSC::call(JSC::JSGlobalObject*, JSC::JSValue, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) CallData.cpp:57
        #116 0x00010f605a30 in JSC::profiledCall(JSC::JSGlobalObject*, JSC::ProfilingReason, JSC::JSValue, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) CallData.cpp:78
        #117 0x00010fa311e8 in JSC::runJSMicrotask(JSC::JSGlobalObject*, WTF::ObjectIdentifierGeneric<JSC::MicrotaskIdentifierType, WTF::ObjectIdentifierThreadSafeAccessTraits<unsigned long long>, unsigned long long>, JSC::JSValue, std::__1::span<JSC::JSValue const, 18446744073709551615ul>) JSMicrotask.cpp:67
        #118 0x000110167970 in JSC::VM::drainMicrotasks() VM.cpp:1354
        #119 0x000105fb1bb8 in Zig::GlobalObject::drainMicrotasks() ZigGlobalObject.cpp:3764
        #120 0x000105fb1cdc in JSC__JSGlobalObject__drainMicrotasks ZigGlobalObject.cpp:3769
        #121 0x00010777ab50 in bun.js.event_loop.drainMicrotasksWithGlobal event_loop.zig:114
        #122 0x000107d07540 in bun.js.event_loop.Task.tickQueueWithCount Task.zig:493
        #123 0x00010777aa84 in bun.js.event_loop.tickWithCount event_loop.zig:190
        #124 0x000107296164 in bun.js.event_loop.tick event_loop.zig:462
        #125 0x000107476fdc in bun.js.event_loop.waitForPromise event_loop.zig:484
        #126 0x000106e08dd0 in bun.js.VirtualMachine.waitForPromise VirtualMachine.zig:766
        #127 0x0001079a57b4 in bun.js.VirtualMachine.loadEntryPoint VirtualMachine.zig:2123
        #128 0x000107451e00 in bun_js.Run.start bun_js.zig:323
        #129 0x000106dd5b10 in bun.js.jsc.OpaqueWrap__anon_31358__struct_240880.callback jsc.zig:240
        #130 0x000104a34dd8 in JSC__VM__holdAPILock bindings.cpp:5235
        #131 0x0001067bfe9c in bun.js.bindings.VM.VM.holdAPILock VM.zig:41
        #132 0x000106d0f1b0 in bun_js.Run.boot bun_js.zig:274
        #133 0x000106d1600c in cli.run_command.RunCommand._bootAndHandleError run_command.zig:1248
        #134 0x000106d15388 in cli.run_command.RunCommand.maybeOpenWithBunJS run_command.zig:1332
        #135 0x000106d10030 in cli.run_command.RunCommand.exec run_command.zig:1377
        #136 0x000106d34874 in cli.Command.start cli.zig:2300
        #137 0x0001066d57a8 in cli.Cli.start cli.zig:59
        #138 0x0001066d1a88 in main.main main.zig:66
        #139 0x0001066d1854 in main start.zig:635
        #140 0x000188dceb94 in start+0x17b8 (dyld:arm64+0xfffffffffff3ab94)
    
    ==33500==Register values:
     x[0] = 0x00006130001c1018   x[1] = 0x00006130001c1030   x[2] = 0x00000004000c4410   x[3] = 0x000061000004bacc
     x[4] = 0x0000000000000000   x[5] = 0x0000000000000018   x[6] = 0x0000000000000000   x[7] = 0x0000000000000001
     x[8] = 0x000000016b4efb20   x[9] = 0x0000619000230608  x[10] = 0x000000016b4efb20  x[11] = 0x0000000000000004
    x[12] = 0x00000c2000009759  x[13] = 0x0000000000000000  x[14] = 0xfa00000000000000  x[15] = 0x000010700001ffff
    x[16] = 0x0000000000000000  x[17] = 0x00000000000008fd  x[18] = 0x0000000000000000  x[19] = 0x00006130001c1030
    x[20] = 0x00006130001c1018  x[21] = 0x00000001f7006f20  x[22] = 0x0000000121ed8368  x[23] = 0x0000000121e30290
    x[24] = 0x0000000121e30330  x[25] = 0x0000000121e30290  x[26] = 0x0000000000000010  x[27] = 0x00000001f7006f20
    x[28] = 0xfffe000000000002     fp = 0x000000016b4efb70     lr = 0x0000000121e3157c     sp = 0x000000016b4efb20
    AddressSanitizer can not provide additional info.
    SUMMARY: AddressSanitizer: SEGV (<unknown module>)
    ==33500==ABORTING
    zsh: abort      bun-debug ./check-dependency-updates.ts
    risky@Mac 20454 %
  6. added
    confirmed bug
    on Jun 18, 2025
  7. github-actions commented on Nov 25, 2025

    @github-actions
    Contributor

    Found 3 possible duplicate issues:

    1. Segfault w.r.t. sqlite native module on apple silicon #22031
    2. Bun segfaults when trying to load @confluentinc/kafka-javascript@1.6.0 native modules #23756
    3. [server] panic(main thread): Segmentation fault at address 0x0 #23786

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

  8. github-actions commented on Nov 28, 2025

    @github-actions
    Contributor

    Duplicate of #22031.

    This issue has been automatically closed as a duplicate.

    If this is incorrect, please re-open this issue or create a new one.

    🤖 Generated with Claude Code

  9. kirillmarkelov commented on Mar 2, 2026

    @kirillmarkelov
    Contributor

    Reproduced on 1.2.14, can't reproduce on bun 1.3.10

    $ bun index.ts                                                                                                                                                                        133 ↵
    Usage: bun run check-dependency-updates.ts [options]
    
    Required options:
      -d, --datasource <datasource>    Datasource to use (e.g., docker, npm, pypi)
      -p, --package <package>          Package name to check
      -v, --current-value <version>    Current version/value
    
    Optional:
      --registry-url <url>             Registry URL
      --show-all-versions              Include all available versions in output
      --pretty                         Pretty print JSON output
      -h, --help                       Show help
    
    Examples:
      bun run check-dependency-updates.ts -d docker -p redis -v 7.2.1
      bun run check-dependency-updates.ts -d npm -p express -v "4.18.0" --pretty
      bun run check-dependency-updates.ts -d pypi -p django -v "4.2.0" --show-all-versions
    
  10. nojaf commented on Aug 27, 2026

    @nojaf

    Posted by Claude (an LLM), on behalf of @nojaf, from a coredump analysis run on their machine. The commands, stack traces and disassembly quoted below are real output from that machine; the two clearly-marked speculative sections are the model's inference, not verified.

    Still reproduces on Linux x64 with Bun 1.4.0, and I was able to symbolize it. Root cause looks like an ordering bug in Bun's node_module_register, not anything specific to re2.

    Environment: Bun 1.4.0 (34cbb9a), Linux x64, glibc 2.44, libstdc++ 16, re2 1.26.1 (NODE_MODULE_VERSION 147)

    Repro:

    bun -e 'require("re2")'
    
    panic(main thread): Floating point error at address 0x7F7CFBEADD91
    Crashed while loading native module: .../re2/build/Release/re2.node
    

    Root cause

    Bun invokes the addon's registration callback synchronously from inside node_module_register, while ld.so is still walking the addon's .init_array. The stack shows this directly:

    #6  re2.node+0x4cd91  setAddonData(v8::Isolate*, AddonData*)   addon.cc:21
    #7  re2.node+0x4d070  WrappedRE2::Init()                       addon.cc:80
    #8  re2.node+0x4f4ad  node_register_module_v147                addon.cc:126
    #9  bun+0x2404c5b     node_module_register            <-- calls the init fn immediately
    #10 ld-linux-x86-64.so.2+0x61ef                       <-- still inside call_init
    #11 ld-linux-x86-64.so.2+0x62cd
    ...
    #20 libc.so.6+0x945eb dlopen
    

    re2's .init_array is ordered like this:

    [0] frame_dummy
    [1] _register_re2                                              <-- calls node_module_register
    [2] std::_Hashtable<v8::Isolate*, AddonData*>::_Hashtable()    <-- ctor for addonDataMap
    

    Entry [1] is the NODE_C_CTOR from NODE_MODULE_INIT(). Entry [2] constructs the file-scope static std::unordered_map<v8::Isolate*, AddonData*> addonDataMap (addon.cc:9). Because Bun runs the init function from entry [1], addonDataMap is still zeroed .bss when setAddonData() touches it.

    The faulting instruction is the bucket-index computation on that not-yet-constructed map:

    re2.node+0x4cd91:  div %rdi     # rdi <- <addonDataMap+0x8>, the bucket count
    

    _M_bucket_count == 0 (a default-constructed unordered_map has 1), so hash % bucket_count is an integer divide by zero -> SIGFPE.

    Note the recorded signal is misleading in the coredump: si_code is SI_TKILL and frame 0 is tgkill inside glibc raise() — that is Bun's own crash handler re-raising. The real fault is below the signal trampoline.

    Why Node doesn't hit this

    Node's node_module_register only appends the module to its pending list and returns; nm_register_func / nm_context_register_func is invoked later from DLOpen, after dlopen() has returned and every .init_array entry has run. Verified on the same machine — real Node 26.7.0 loads the exact same re2.node fine:

    $ node -e 'require("re2")'   # OK
    $ bun  -e 'require("re2")'   # panic, 100% of the time
    

    Note on the macOS report above

    I suspect the original SIGSEGV at 0x0 on macOS is the same bug: libc++'s unordered_map dereferences the null bucket array pointer instead of dividing by a zero bucket count, so the same uninitialized-map access surfaces as a null deref rather than SIGFPE.

    That would also explain the cluster of similar "Crashed while loading native module" reports against other addons that keep file-scope C++ globals — #23757 (better-sqlite3), #22474 (@pyroscope/nodejs), #20149 (node-pcsclite), #22630 (newrelic). I haven't verified those, so that part is a guess.

    Suggested fix

    Defer the register callback until after dlopen() returns, matching Node's modpending behaviour, rather than calling it from within node_module_register. Any addon whose registration constructor is ordered before its other file-scope constructors is currently exposed.

  11. nojaf commented on Sep 3, 2026

    @nojaf

    @robobun would a fix be accepted for this?

  12. robobun commented on Sep 16, 2026

    @robobun
    Collaborator

    @nojaf Your analysis is correct. #42960 makes node_module_register only queue the module. process.dlopen then runs the init function after dlopen() returns, as Node does.

    With that change, require("re2") no longer crashes in setAddonData. re2 1.26.1 does not load yet. The next stop is undefined symbol: _ZN2v86Object21SetNativeDataProperty..., a V8 function that Bun does not export. That gap is separate from the crash in this issue.

  13. added a commit that references this issue on Oct 20, 2026
    9b4284f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed bugcrashmacOSnapiruntime

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions