oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.26k stars 2.69k forks source link

Intermittent Segmentation Fault when Running TypeScript Script with Bun #13475

Open masaru-1998 opened 1 month ago

masaru-1998 commented 1 month ago

How can we reproduce the crash?

  1. Create a TypeScript project with a script that generates OpenAPI schema.
  2. Set up a package.json with a script to run the TypeScript file: "scripts": { "generate:schema": "bun run ./scripts/api/generate-open-api.ts" }
  3. Run the command bun run generate:schema multiple times.
  4. Observe that sometimes the script executes successfully, while other times it crashes with a Segmentation Fault.

Note: The crash seems to occur randomly and is not consistently reproducible, which makes it challenging to debug.

Relevant log output

$ bun run -r tsconfig-paths/register ./scripts/api/generate-open-api.ts
============================================================
Bun v1.1.17 (bb66bba1) macOS Silicon
macOS v14.6.1
Args: "bun" "run" "./scripts/api/generate-open-api.ts"
Features: jsc Bun.stdin(2) bunfig dotenv(2) transpiler_cache(4) tsconfig_paths tsconfig(5) 
Builtins: "bun:main" "node:assert" "node:buffer" "node:fs" "node:http" "node:https" "node:net" "node:os" "node:path" "node:perf_hooks" "node:process" "node:stream" "node:string_decoder" "node:tls" "node:tty" "node:url" "node:util" "node:util/types" "node-fetch" 
Elapsed: 101ms | User: 108ms | Sys: 27ms
RSS: 105.41MB | Peak: 105.41MB | Commit: 1.07GB | Faults: 51
panic(main thread): Segmentation fault at address 0x1A
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.17/Mr1bb66bbaAqqgggH___mr4rqCu30q1B2lxw9BmqjqhCuiqkc_u1r1qCA2A0B
error: script "generate:schema" was terminated by signal SIGTRAP (Trace or breakpoint trap)

Stack Trace (bun.report)

Bun v1.1.17 (bb66bba) on macos aarch64 [RunCommand]

Segmentation fault at address 0x0000001A

github-actions[bot] commented 1 month ago

@masaru-1998, the latest version of Bun is v1.1.24, but this crash was reported on Bun v1.1.17.

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

bun upgrade
github-actions[bot] commented 2 weeks ago

Hello @masaru-1998. Please provide a minimal reproduction using a GitHub repository, Replit, or CodeSandbox. Issues marked with needs repro will be closed if they have no activity within 3 days.