oven-sh / bun

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

Bun randomly crashed while running an http server #13826

Open KhanKudo opened 1 week ago

KhanKudo commented 1 week ago

How can we reproduce the crash?

I was reloading the website a few times in relatively quick succession (1-2 seconds in between, 3-4 times in a row) and then it stopped loading.

Code is simple: `fastify.after(() => { if (useAuth) fastify.addHook('onRequest', fastify.basicAuth)

fastify.register(fastifyStatic, {
    root: path.join(__dirname, 'public'),
})
fastify.register(fastifyStatic, {
    root: path.join(__dirname, 'admin'),
    prefix: '/admin',
    prefixAvoidTrailingSlash: true,
    decorateReply: false,
})

})`

just a static serve using fastify.

And I also have some api endpoints, which don't do anything major, just deliver a rest-api and call make some mongoose calls. It crashed while it was partway through loading the files. I'm not sure if the general static-serving or some part of the api-handling caused the crash.

Relevant log output

$ bun run server.ts --port 5000
Server is now listening on http://0.0.0.0:5000
============================================================
Bun v1.1.26 (0a37423b) Windows x64
Windows v.win10_fe
CPU: sse42 avx avx2 avx512
Args: "C:\Users\Luka\.bun\bin\bun.exe" "run" "server.ts" "--port" "5000"
Features: jsc dotenv http_server transpiler_cache(13) tsconfig(14) 
Builtins: "bun:main" "node:assert" "node:async_hooks" "node:buffer" "node:crypto" "node:dns" "node:events" "node:fs" "node:fs/promises" "node:http" "node:https" "node:module" "node:net" "node:os" "node:path" "node:stream" "node:string_decoder" "node:timers" "node:timers/promises" "node:tls" "node:tty" "node:url" "node:util" "node:util/types" "node:zlib" "node:worker_threads" "node:http2" "node:diagnostics_channel"

Elapsed: 22172207ms | User: 10609ms | Sys: 1906ms
RSS: 0.14GB | Peak: 0.32GB | Commit: 0.45GB | Faults: 815345

panic(main thread): cast causes pointer to be null
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.26/wr10a37423AioghwCwik8Lqppve8urwe6lpwew0y9G2sn61C6/57F8ws8F4t6/FqzgBA0eNpLTiwuUUhOLC1OLVYoyM/MK0ktUijJV0hKVcgrzckBAK96CzY

error: script "start" exited with code 3

Stack Trace (bun.report)

Bun v1.1.26 (0a37423) on windows x86_64 [RunCommand]

panic: cast causes pointer to be null

github-actions[bot] commented 1 week ago

@KhanKudo, the latest version of Bun is v1.1.27, but this crash was reported on Bun v1.1.26.

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

bun upgrade
KhanKudo commented 1 week ago

I have just updated and will be on the lookout for crashes, though I've used bun for a while and this is the first time I've encountered such a crash. Might be rare, definitely not a priority, but worth documenting

CosmoMyzrailGorynych commented 6 days ago

I feel like I have a similar or same issue on Windows, in bun 1.1.27, too. I can produce a crash in a packaged app (single-file executable), but not when it is run from sources, and I don't know how to debug it. Piping stdout/stderr with sausage.exe > log.txt 2>&1 doesn't display any crash messages :c