oven-sh / bun

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

Segmentation fault using Bun with Systemd Unit #12540

Open sistematico opened 1 month ago

sistematico commented 1 month ago

How can we reproduce the crash?

Unit: https://github.com/somdomato/somdomato/blob/main/ansible/files/etc/systemd/system/somdomato-hono.service

index.ts:

Run manually, everything works just fine.

Tried with Bun 1.1.19, 1.1.20 and 1.1.20-canary, using nginx and root user.

Bun is running under Oracle VPS(amd64):

nginx@ananke:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.4 LTS
Release:        22.04
Codename:       jammy

Relevant log output

Jul 13 10:25:35 ananke systemd[1]: somdomato-hono.service: Main process exited, code=dumped, status=4/ILL

Jul 13 10:34:01 ananke bun[1157]: ============================================================
Jul 13 10:34:01 ananke bun[1157]: Bun v1.1.18 (5a0b9352) Linux x64
Jul 13 10:34:01 ananke bun[1157]: Linux Kernel v6.5.0 | glibc v2.35
Jul 13 10:34:01 ananke bun[1157]: Args: "/root/.bun/bin/bun" "run" "/var/www/somdomato/backend/src/index.ts"
Jul 13 10:34:01 ananke bun[1157]: Elapsed: 2ms | User: 0ms | Sys: 6ms
Jul 13 10:34:01 ananke bun[1157]: RSS: 1.07GB | Peak: 10.62MB | Commit: 1.07GB | Faults: 0
Jul 13 10:34:01 ananke bun[1157]: panic(main thread): Segmentation fault at address 0x7FFEE66337D8
Jul 13 10:34:01 ananke bun[1157]: oh no: Bun has crashed. This indicates a bug in Bun, not your code.
Jul 13 10:34:01 ananke bun[1157]: To send a redacted crash report to Bun's team,
Jul 13 10:34:01 ananke bun[1157]: please file a GitHub issue using the link below:
Jul 13 10:34:01 ananke bun[1157]:  https://bun.report/1.1.18/lr15a0b935AA+xyQsiwt9Cmjmu9C0li23C+gq13CA28//BxikzzZ
Jul 13 10:34:01 ananke systemd[1]: Started Hono api.somdomato.com.


### Stack Trace (bun.report)

Bun v1.1.18 ([`5a0b935`](<https://github.com/oven-sh/bun/tree/5a0b93523134ca0043ee7ae84f01003aa4b7ff69>)) on linux x86_64 [RunCommand]

Segmentation fault at address 0x7FFFB1B9A558

- `??`
- [`bun_js.zig:145`](<https://github.com/oven-sh/bun/blob/5a0b93523134ca0043ee7ae84f01003aa4b7ff69/src/bun_js.zig#L145>): `src.bun_js.Run.boot`
- [`run_command.zig:1399`](<https://github.com/oven-sh/bun/blob/5a0b93523134ca0043ee7ae84f01003aa4b7ff69/src/cli/run_command.zig#L1399>): `src.cli.run_command.RunCommand.exec__anon_72440`
- [`cli.zig:1801`](<https://github.com/oven-sh/bun/blob/5a0b93523134ca0043ee7ae84f01003aa4b7ff69/src/cli.zig#L1801>): `src.cli.Cli.start`
- [`main.zig:50`](<https://github.com/oven-sh/bun/blob/5a0b93523134ca0043ee7ae84f01003aa4b7ff69/src/main.zig#L50>): `main`

<!-- from bun.report: KzR4sKMZhvSinpb6jXBy -->
github-actions[bot] commented 1 month ago

@sistematico, the latest version of Bun is v1.1.20, but this crash was reported on Bun v1.1.18.

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

bun upgrade
sistematico commented 1 month ago
bun upgrade
Jul 13 10:37:44 ananke bun[1376]: ============================================================
Jul 13 10:37:44 ananke bun[1376]: Bun v1.1.20 (ae194892) Linux x64
Jul 13 10:37:44 ananke bun[1376]: Linux Kernel v6.5.0 | glibc v2.35
Jul 13 10:37:44 ananke bun[1376]: CPU: sse42 popcnt avx avx2
Jul 13 10:37:44 ananke bun[1376]: Args: "/home/nginx/.bun/bin/bun" "run" "/var/www/somdomato/backend/src/index.ts"
Jul 13 10:37:44 ananke bun[1376]: Features: jsc
Jul 13 10:37:44 ananke bun[1376]: Elapsed: 4ms | User: 38ms | Sys: 38ms
Jul 13 10:37:44 ananke bun[1376]: RSS: 1.07GB | Peak: 13.37MB | Commit: 1.07GB | Faults: 0
Jul 13 10:37:44 ananke bun[1376]: panic(main thread): Segmentation fault at address 0x7FFE1E936238
Jul 13 10:37:44 ananke bun[1376]: oh no: Bun has crashed. This indicates a bug in Bun, not your code.
Jul 13 10:37:44 ananke bun[1376]: To send a redacted crash report to Bun's team,
Jul 13 10:37:44 ananke bun[1376]: please file a GitHub issue using the link below:
Jul 13 10:37:44 ananke bun[1376]:  https://bun.report/1.1.20/lr1ae19489AC+xyQgn7v3Cw6vw8Cqv878Cmux88C6uil3C+gqk3CA28//Bwjxtye
Jul 13 10:37:45 ananke systemd[1]: somdomato-hono.service: Main process exited, code=dumped, status=4/ILL

Same.