bun icon indicating copy to clipboard operation
bun copied to clipboard

Bun consistently crashes during hot reload on Windows

Open martinkri opened this issue 5 months ago • 3 comments
trafficstars

How can we reproduce the crash?

All I did was create a React project with a Shadcn + TailwindCSS template using bun init, and made minor changes to src/App.tsx (e.g. removing logos, changing text). It crashes during every second reload.

Relevant log output

Bun v1.2.15 (df017990) Windows x64
Windows v.win11_dt
CPU: sse42 avx avx2 avx512
Args: "C:\Users\REDACTED\.bun\bin\bun.exe" "--hot" "src/index.tsx"
Features: Bun.stderr(2) Bun.stdout(2) bunfig http_server jsc dev_server tsconfig(9) tsconfig_paths(9) process_dlopen
Builtins: "bun:main" "node:assert" "node:constants" "node:crypto" "node:fs" "node:fs/promises" "node:module" "node:os" "node:path" "node:perf_hooks" "node:process" "node:stream" "node:tty" "node:url" "node:util" "node:vm" "node:v8"
Elapsed: 132776ms | User: 484ms | Sys: 156ms
RSS: 0.37GB | Peak: 0.45GB | Commit: 0.56GB | Faults: 122148

panic(main thread): Assertion failure: null != 7
oh no: Bun has crashed. This indicates a bug in Bun, not your code.

Stack Trace (bun.report)

Bun v1.2.15 (df01799) on windows x86_64 [AutoCommand]

panic: Assertion failure: null != 9

Features: tsconfig, tsconfig_paths, process_dlopen, Bun.stderr, Bun.stdout, bunfig, http_server, jsc, dev_server

Sentry Issue: BUN-H02

martinkri avatar Jun 07 '25 13:06 martinkri

Please run bun upgrade --canary and let me know if you're still running into this. @connerlphillippi may have fixed this

Jarred-Sumner avatar Jun 07 '25 13:06 Jarred-Sumner

Please run bun upgrade --canary and let me know if you're still running into this. @connerlphillippi may have fixed this

Just tried it with the canary version, still happens on every second reload. New log:

Bun Canary v1.2.16-canary.119 (c9761d4a) Windows x64 Windows v.win11_dt CPU: sse42 avx avx2 avx512 Args: "C:\Users\REDACTED.bun\bin\bun.exe" "--hot" "src/index.tsx" Features: Bun.stderr(2) Bun.stdout(2) bunfig http_server jsc dev_server tsconfig(7) tsconfig_paths(7) process_dlopen Builtins: "bun:main" "node:assert" "node:constants" "node:crypto" "node:fs" "node:fs/promises" "node:module" "node:os" "node:path" "node:perf_hooks" "node:process" "node:stream" "node:tty" "node:url" "node:util" "node:vm" "node:v8" Elapsed: 9589ms | User: 218ms | Sys: 156ms RSS: 0.46GB | Peak: 0.46GB | Commit: 1.00GB | Faults: 113401

panic(main thread): Assertion failure: null != 7 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.2.16/wa2c9761d4sIqkg0B+y+kXkis9Vkkg+Sqxh1Rmwv8M4rx+Hqri/F2ii+nBqq0lFklnmFA0eNpzLC5OLSrJzM9TSEvMzCktSrVSyCvNyVFQtFUwBwCZmAmr

error: script "dev" exited with code 3

martinkri avatar Jun 07 '25 13:06 martinkri

I didn't try with canary but also crashes for me too. I created a React app with bun init --react as it is documented here.

It doesn't crash when I edit App.tsx but it gives a runtime error (this happens even on first edit too): Uncaught Error: Unknown HMR script: 91f6dc3cf96c2786 at globalThis. (Bun HMR Runtime:1:1) at Bun HMR Runtime:1:1

However, it crashes when I edit index.css second time (works when I saved first time).

This is the crash report I get by clicking the link: Bun v1.2.15 (df01799) on windows x86_64 [AutoCommand]

panic: index out of bounds: index 1, len 1

Features: tsconfig, tsconfig_paths, bunfig, http_server, jsc, dev_server

Sentry Issue: BUN-D23

kaankeskin avatar Jun 07 '25 23:06 kaankeskin

bump. crash when editing css with server.development.hmr=true. if the value is false, this does not happen.

Bun v1.2.17 (282dda6) on windows x86_64 [AutoCommand] Bun v1.2.17 (282dda62) Windows x64 Windows v.win11_ge CPU: sse42 avx avx2 Args: "bun" "run" "--watch" "./src/index.ts" "dev" Features: bunfig(2) http_server jsc dev_server spawn(2) tsconfig(3) tsconfig_paths(3) Builtins: "bun:main" "node:child_process" "node:fs" "node:os" "node:tty" Elapsed: 5176ms | User: 0ms | Sys: 15ms RSS: 0.25GB | Peak: 0.25GB | Commit: 0.66GB | Faults: 60838 panic: index out of bounds: index 1, len 1

array_hash_map.zig:2108: capacity array_list.zig:71: deinit BodyReaderMixin.zig:28: onDataGeneric HttpContext.h:355: uWS::HttpContext<0>::init::<lambda_4>::operator(...) type_traits:1680: std::invoke MoveOnlyFunction.h:254: ofats::any_detail::any_invocable_impl<void *,0,void *,std::basic_string_view<char,std::char_traits >,bool>::call HttpParser.h:980: uWS::HttpParser::consumePostPadded MoveOnlyFunction.h:247: ofats::any_detail::any_invocable_impl<void *,0,void *,uWS::HttpRequest *>::destroy HttpContext.h:225: uWS::HttpContext<0>::init::<lambda_4>::__invoke loop.c:434: us_internal_dispatch_ready_poll

ilyaChuk avatar Jul 02 '25 00:07 ilyaChuk

Looks to be the same issue as #20529 which I have a fix for up

zackradisic avatar Jul 24 '25 00:07 zackradisic