oven-sh / bun

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

Segmentation fault and EBADF: Bad file descriptor during Playwright tests with WebServer on Bun v1.1.37 (Linux) #15424

Open antoalv19 opened 3 days ago

antoalv19 commented 3 days ago

How can we reproduce the crash?

Hello Bun team,

I’m experiencing a critical issue when running a web server with Bun v1.1.37 on a Linux x64 environment. The process consistently crashes with the following error:

[WebServer] panic(main thread): Segmentation fault at address 0xBEF8 [WebServer] oh no: Bun has crashed. This indicates a bug in Bun, not your code. [WebServer] [WebServer] error: script "dev" was terminated by signal SIGILL (Illegal instruction) [WebServer] Illegal instruction (core dumped)

Additionally, before the crash, I observed intermittent occurrences of:

[WebServer] EBADF: Bad file descriptor [WebServer] errno: -9 [WebServer] syscall: "read"

Reproduction Environment:

•   Bun version: 1.1.37 (commit 8ca0eb83)
•   OS: Linux Kernel 6.5.0
•   glibc: 2.35
•   CPU: Supports sse42, popcnt, avx, avx2
•   Command used: bun run dev (executing Vite from node_modules/.bin/vite)

Observations:

1.  The crash happens consistently during GitHub Actions CI runs.
2.  The segmentation fault and EBADF errors seem related to the WebServer handling in Bun.
3.  System resource usage peaks shortly before the crash (RSS: 0.88GB), and the script is terminated with SIGILL (Illegal instruction).

Steps to Reproduce:

1.  Set up a Bun-powered project with Playwright for testing and Vite as the web server.
2.  Execute bun run dev in a CI environment (Linux Kernel 6.5.0, glibc 2.35).
3.  Run Playwright tests targeting the web server.
4.  Observe the segmentation fault after a few tests or web server interactions.

Relevant log output

Stack Trace (bun.report)

Bun v1.1.37 (8ca0eb8) on linux x86_64_baseline [RunAsNodeCommand]

Segmentation fault at address 0x0000BEF8

Features: process_dlopen, Bun.stdin, http_server, jsc, spawn, tsconfig, tsconfig_paths, tsconfig_paths

github-actions[bot] commented 3 days ago

Thank you for reporting this crash.

For Bun's internal tracking, this issue is BUN-8Z8.