Closed yschroe closed 2 months ago
Managed to crash bun reliably on my system, added repro.
This way sometimes I get a different stack trace (the uv_ip6_addr
crash happens as well, 50/50):
✔ Nuxt Nitro server built in 96 ms nitro 14:55:13
✔ Nuxt Nitro server built in 87 ms nitro 14:55:14
============================================================
Bun v1.1.21 (70ca2b76) Windows x64
CPU: sse42 avx avx2
Args: "node" "C:\Users\yanni\Documents\repos\bun-segfault-nuxt\node_modules\nuxi\bin\nuxi.mjs" "dev"
Features: jsc Bun.stdin(40) Bun.stdout http_server(20) spawn(4) transpiler_cache(144) tsconfig_paths(15) tsconfig(56)
Builtins: "bun:jsc" "bun:main" "detect-libc" "node:assert" "node:async_hooks" "node:buffer" "node:child_process" "node:constants" "node:crypto" "node:dns" "node:events" "node:fs" "node:fs/promises" "node:http" "node:https" "node:module" "node:net" "node:os" "node:path" "node:perf_hooks" "node:process" "node:querystring" "node:readline" "node:stream" "node:stream/promises" "node:string_decoder" "node:tls" "node:tty" "node:url" "node:util" "node:util/types" "node:vm" "node:zlib" "node:worker_threads" "ws" "node:v8"
Elapsed: 11317ms | User: 5890ms | Sys: 1125ms
RSS: 1.58GB | Peak: 1.60GB | Commit: 6.46GB | Faults: 577132
panic(thread 16512): Segmentation fault at address 0x56DAE170130
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.1.21/wn170ca2b7A6ggh0D+i9uCgy0mQm5u4K+t3Mwg1pQqxp6Kyxk6K6h02zCkyr9lB6rg9lBA262Cht/j9xC
error: script "dev" exited with code 3
Bun v1.1.21 (70ca2b7
) on windows x86_64 [RunAsNodeCommand]
Segmentation fault at address 0x52924170130
allocators.zig:172
: atIndexMut
string_immutable.zig:641
: pathWithoutTrailingSlashOne
resolver.zig:370
: addNoteFmt
resolver.zig:1234
: resolveWithoutSymlinks
path.zig:260
: isAbsoluteWindowsImpl
bindings.zig:503
: slice
string.zig:990
: deref
RefPtr.h:60
: WTF::RefPtr<WTF::StringImpl,WTF::RawPtrTraits<WTF::StringImpl>,WTF::DefaultRefDerefTraits<WTF::StringImpl> >::~RefPtr
Ref.h:61
: WTF::DefaultRefDerefTraits<WTF::StringImpl>::derefIfNotNull
ArgList.h:131
: JSC::MarkedVector<JSC::JSValue,8,WTF::RecordOverflow>::MarkedVector
I can also reproduce this crash on mac os. Different stack trace though:
✔ Nuxt Nitro server built in 82 ms nitro 3:25:07 PM
============================================================
Bun Canary v1.1.22-canary.96 (df33f2b2) macOS Silicon
macOS v14.5
Args: "node" "/Users/yannik/Documents/Workspace/xxx/node_modules/.bin/nuxt" "dev"
Features: jsc Bun.stdin(168) Bun.stdout http_server(83) spawn(3) transpiler_cache(468) tsconfig_paths(14) tsconfig(42)
Builtins: "bun:jsc" "bun:main" "detect-libc" "node:assert" "node:async_hooks" "node:buffer" "node:child_process" "node:constants" "node:crypto" "node:dns" "node:events" "node:fs" "node:fs/promises" "node:http" "node:https" "node:module" "node:net" "node:os" "node:path" "node:perf_hooks" "node:process" "node:querystring" "node:readline" "node:stream" "node:stream/promises" "node:string_decoder" "node:tls" "node:tty" "node:url" "node:util" "node:util/types" "node:vm" "node:zlib" "node:worker_threads" "ws" "node:v8"
Elapsed: 24472ms | User: 22625ms | Sys: 2530ms
RSS: 0.91GB | Peak: 0.92GB | Commit: 0.02ZB | Faults: 2491
panic: Segmentation fault at address 0x26
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.1.22/Mn2df33f2bA6ggh0D__uxmhTuz04O+jq2Gui5jT+0/5Omn85Oml0pCu28o+BA2AsC
error: script "dev" was terminated by signal SIGTRAP (Trace or breakpoint trap)
zsh: trace trap bun --bun run dev
Bun v1.1.22 (df33f2b
) on macos aarch64 [AutoCommand]
Segmentation fault at address 0x2505921A388
src.resolver.resolver.Resolver.loadAsFile
src.resolver.resolver.Resolver.loadAsFileOrDirectory
src.resolver.resolver.Resolver.resolveAndAutoInstall
src.bun.js.javascript.VirtualMachine._resolve__anon_117580
src.bun.js.javascript.VirtualMachine.resolveMaybeNeedsTrailingSlash__anon_97891
Zig__GlobalObject__resolve
Zig::GlobalObject::moduleLoaderResolve
JSC::JSModuleLoader::resolve
Looks like it's a crash when terminating a Worker
.
Debug logs:
$ nuxt dev
Nuxt 3.12.4 with Nitro 2.9.7 3:23:19 PM
3:23:19 PM
➜ Local: http://localhost:3000/
➜ Network: use --host to expose
➜ DevTools: press Shift + Option + D in the browser (v1.3.9) 3:23:24 PM
✔ Vite client built in 52ms 3:23:25 PM
✔ Vite server built in 1097ms 3:23:26 PM
✔ Nuxt Nitro server built in 628 ms nitro 3:23:27 PM
ℹ Vite client warmed up in 0ms 3:23:27 PM
ℹ Vite server warmed up in 893ms 3:23:28 PM
✔ Nuxt Nitro server built in 327 ms nitro 3:23:28 PM
ASSERTION FAILED: decontaminate()
src/bun.js/WebKit/Source/JavaScriptCore/runtime/StructureID.h(132) : Structure *JSC::StructureID::decode() const
1 0x1091da490 JSC::slowValidateCell(JSC::JSCell*)
2 0x109407f64 JSC::JSObject::globalObject() const
3 0x1074c3538 Bun::NapiExternal::~NapiExternal()
4 0x1074c35d0 Bun::NapiExternal::~NapiExternal()
5 0x1074c362c Bun::NapiExternal::destroy(JSC::JSCell*)
6 0x108d104d0 JSC::PreciseAllocation::lastChanceToFinalize()
7 0x108d04020 JSC::MarkedSpace::lastChanceToFinalize()
8 0x108ca1a2c JSC::Heap::lastChanceToFinalize()
9 0x1094d9b80 JSC::VM::~VM()
10 0x1073f87d0 WTF::ThreadSafeRefCounted<JSC::VM, (WTF::DestructionThread)0>::deref() const::'lambda'()::operator()() const
11 0x1073f8740 WTF::ThreadSafeRefCounted<JSC::VM, (WTF::DestructionThread)0>::deref() const
12 0x10787d240 WebWorker__dispatchExit
13 0x10662bad0 src.bun.js.web_worker.WebWorker.exitAndDeinit
14 0x106b5e4f4 src.bun.js.web_worker.WebWorker.spin
15 0x10694e728 src.bun.js.javascript.OpaqueWrap__anon_171168__struct_182372.callback
16 0x10745d17c JSC__VM__holdAPILock
17 0x10437b78c src.bun.js.bindings.bindings.VM.holdAPILock
18 0x1061a1ba0 src.bun.js.web_worker.WebWorker.start
19 0x105cc8894 src.bun.js.web_worker.WebWorker.startWithErrorHandling
20 0x10567f9c0 Thread.callFn__anon_134142
21 0x105058704 Thread.PosixThreadImpl.spawn__anon_112453.Instance.entryFn
22 0x19de22f94 _pthread_start
23 0x19de1dd34 thread_start
error: script "dev" was terminated by signal SIGTRAP (Trace or breakpoint trap)
fish: Job 1, 'bun-debug --bun run dev' terminated by signal SIGTRAP (Trace or breakpoint trap)
Unfortunately does still crash for me on v1.1.25 (windows) in the same situation:
============================================================
Bun v1.1.25 (fe62a614) Windows x64
Windows v.win10_fe
CPU: sse42 avx avx2
Args: "node" "C:\Users\yanni\Documents\repos\xxx\node_modules\nuxi\bin\nuxi.mjs" "dev"
Features: jsc Bun.stderr Bun.stdin(60) Bun.stdout http_server(30) spawn(4) transpiler_cache(200) tsconfig_paths(16) tsconfig(58)
Builtins: "bun:jsc" "bun:main" "detect-libc" "node:assert" "node:async_hooks" "node:buffer" "node:child_process" "node:constants" "node:crypto" "node:dns" "node:events" "node:fs" "node:fs/promises" "node:http" "node:https" "node:module" "node:net" "node:os" "node:path" "node:perf_hooks" "node:process" "node:querystring" "node:readline" "node:stream" "node:stream/promises" "node:string_decoder" "node:tls" "node:tty" "node:url" "node:util" "node:util/types" "node:vm" "node:zlib" "node:worker_threads" "ws" "node:v8"
Elapsed: 28775ms | User: 15781ms | Sys: 2562ms
RSS: 1.78GB | Peak: 1.80GB | Commit: 6.73GB | Faults: 799553
panic(thread 2588): Segmentation fault at address 0x3B3103902D8
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.1.25/wn1fe62a61A+ggh0DskwmekvvmeyygvH40zuIqr6oUm83la23xw1CgkwzNCYKERNEL32.DLL63yECSntdll.dllwy3WA2m7BwthknQ
error: script "dev" exited with code 3
Bun v1.1.25 (fe62a61
) on windows x86_64 [RunAsNodeCommand]
Segmentation fault at address 0x3B3103902D8
core.c:109
: uv__loops_add
core.c:299
: uv_loop_init
libuv.zig:2806
: errEnum
event_loop.zig:1562
: ensureWaker
javascript.zig:2663
: reloadEntryPoint
javascript.zig:2718
: loadEntryPointForWebWorker
bindings.cpp:5039
: JSC__VM__holdAPILock
shimmer.zig:197
: cppFn
How can we reproduce the crash?
Edit: Managed to reproduce the crash reliably on my system:
Repro repo: https://github.com/yschroe/bun-segfault-nuxt
bun --bun run dev
.server/api/test.ts
.✔ Nuxt Nitro server built in xx ms
in the console (I am using the prettier Plugin for VS Code - not sure if it is a prerequisite to actually trigger a rebuild due to reformatting).Relevant log output
Stack Trace (bun.report)
Bun v1.1.21 (
70ca2b7
) on windows x86_64 [RunAsNodeCommand]Segmentation fault at address 0x474BE410278
uv-common.c:296
:uv_ip6_addr
ini.zig:1238
:handle _auth
builtin.zig:890
:panicInactiveUnionField
mem.zig:4265
:doNotOptimizeAway
event_loop.zig:1515
:waitForPromiseWithTermination
bindings.cpp:4993
:builtinNameMap
web_worker.zig:220
:start
0x1257d
in KERNEL32.DLL0x5af28
in ntdll.dll