Open LeulAria opened 1 month ago
Same issue using oven/bun:1.1
docker image on linux. Haven't found a way to reproduce it, it just happened after a bit.
============================================================
Bun v1.1.17 (bb66bba1) Linux x64 (baseline)
Linux Kernel v6.8.10 | glibc v2.31
Args: "bun" "run" "--hot" "src/index.ts"
Features: jsc dotenv http_server tsconfig(4)
Builtins: "bun:main" "node:buffer" "node:crypto" "node:fs" "node:net" "node:os" "node:perf_hooks" "node:stream" "node:string_decoder" "node:tls" "node:util/types"
Elapsed: 2728100ms | User: 1348ms | Sys: 342ms
RSS: 0.02ZB | Peak: 0.18GB | Commit: 0.02ZB | Faults: 272
panic(main thread): Segmentation fault at address 0x1A
oh no: Bun has crashed. This indicates a bug in Bun, not your code.
Now it happens all the time. Here's the source code where it happens. Might help with debugging -> https://github.com/notical-run/notical-run
Running bun api dev
should bring the error up or docker compose up
. This seems to be happening right away without running any of the code. It was working fine up until today. My guess is typescript. @LeulAria are you using drizzle? If not, it could be that trpc and drizzle share some type magic that breaks bun.
Edit: More info. After messing around with it. I have narrowed it down in my project to anytime I access any table imported from schema.ts
. Even a console.log(Workspace)
in any module other than schema.ts
breaks bun.
Debug stack trace. It appears to be saving/freeing invalid sourcemap data
❯ bun-debug src/api.ts
============================================================
Bun v1.1.18 (03ea72f0) macOS Silicon
macOS v14.4.1
Args: "bun-debug" "src/api.ts"
Features: jsc dotenv tsconfig
Builtins: "bun:main"
Elapsed: 139ms | User: 94ms | Sys: 83ms
RSS: 1.00GB | Peak: 1.00GB | Commit: 1.07GB | Faults: 51
panic(main thread): Segmentation fault at address 0x20040000000
???:?:?: 0x197567583 in ??? (libsystem_platform.dylib)
???:?:?: 0x4f0f00010488fc53 in ??? (???)
/Users/dylan/code/bun/src/bun.js/javascript.zig:145:35: 0x10521907f in deinit (bun-debug)
default_allocator.free(this.data[0..this.len()]);
^
/Users/dylan/code/bun/src/bun.js/javascript.zig:278:29: 0x105218c23 in putValue (bun-debug)
saved.deinit();
^
/Users/dylan/code/bun/src/bun.js/javascript.zig:264:26: 0x10521919f in putMappings (bun-debug)
try this.putValue(source.path.text, Value.init(bun.cast(*SavedMappings, mappings.list.items.ptr)));
^
/Users/dylan/code/bun/src/bun.js/javascript.zig:235:29: 0x10615e36f in onSourceMapChunk (bun-debug)
try this.putMappings(source, chunk.buffer);
^
/Users/dylan/code/bun/src/js_printer.zig:503:28: 0x105ba6253 in onChunk (bun-debug)
try handler(@as(*Type, @ptrCast(@alignCast(self))), chunk, source);
^
/Users/dylan/code/bun/src/js_printer.zig:497:26: 0x10523514b in onSourceMapChunk (bun-debug)
try self.callback(self.ctx, chunk, source);
^
/Users/dylan/code/bun/src/js_printer.zig:6055:41: 0x105233f53 in printAst__anon_94920 (bun-debug)
try handler.onSourceMapChunk(source_maps_chunk, source.*);
^
/Users/dylan/code/bun/src/bundler.zig:1175:64: 0x10524f6bb in printWithSourceMapMaybe__anon_94919 (bun-debug)
inline else => |is_bun| try js_printer.printAst(
^
fish: Job 1, 'bun-debug src/api.ts' terminated by signal SIGTRAP (Trace or breakpoint trap)
+1
Now it happens all the time. Here's the source code where it happens. Might help with debugging -> https://github.com/notical-run/notical-run
Running
bun api dev
should bring the error up ordocker compose up
. This seems to be happening right away without running any of the code. It was working fine up until today. My guess is typescript. @LeulAria are you using drizzle? If not, it could be that trpc and drizzle share some type magic that breaks bun.Edit: More info. After messing around with it. I have narrowed it down in my project to anytime I access any table imported from
schema.ts
. Even aconsole.log(Workspace)
in any module other thanschema.ts
breaks bun.
Im not using drizzel, but im using MikroORM not sure but MokroORM requires ts-node thats in dependency aswell if that help and it happen when ever i do some db quey codechange or some chang in code then i need to restart.
@paperdave the stack trace above points to a race condition in the sourcemap changes from last month
I've had this issue since version 1.1.13 for over a month or two (#11931 ). It's really frustrating I've been unable to present to shareholders, i really don't want to move away from Bun
I'm on Windows 11, using PrismaORM with this repo.
How can we reproduce the crash?
No response
Relevant log output
Stack Trace (bun.report)
Bun v1.1.8-debug-canary (
89d2580
) on macos aarch64 [RunCommand]Segmentation fault at address 0x0000001A
llint_entry
JSC::Interpreter::prepareForCachedCall
JSC::JSModuleEnvironment::create
JSC::VM::visitAggregate
WebCore::jsReadable_resume
src.bun.js.api.BunObject.Timer.Timeout.TimerReference.runFromJSThread
src.bun.js.webcore.response.Fetch.FetchTasklet.onProgressUpdate
Features: jsc, dotenv, http_server, transpiler_cache, tsconfig_paths, tsconfig