Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bun crashes when using fillText @napi-rs/canvas #15372

Closed
taro445 opened this issue Nov 23, 2024 · 2 comments
Closed

Bun crashes when using fillText @napi-rs/canvas #15372

taro445 opened this issue Nov 23, 2024 · 2 comments
Labels
crash An issue that could cause a crash napi Compatibility with the native layer of Node.js runtime windows An issue that is known to occur on Windows

Comments

@taro445
Copy link

taro445 commented Nov 23, 2024

How can we reproduce the crash?

I am experiencing a crash in Bun when using ctx['fillText']("Big smile!", 10, 90) with @napi-rs/canvas while integrating with Elysia on Bun.

Relevant log output

node_modules\@napi-rs\canvas-win32-x64-msvc\icudtl.dat.
SkIcuLoader: datafile missing: C:\Users\...\AppData\Roaming\npm\node_modules\bun\bin\icudtl.dat.
../../modules/skparagraph/src/ParagraphBuilderImpl.cpp(252): fatal error: "check(fUnicode)"
============================================================
Bun v1.1.36 (ededc168) Windows x64
Windows v.win10_fe
CPU: sse42 avx avx2 avx512
Args: "C:\Users\...\AppData\Roaming\npm\\node_modules\bun\bin\bun.exe" "run" "--watch" "./src/app.ts"
Features: Bun.stdin(2) dotenv http_server jsc transpiler_cache(12) tsconfig(14) tsconfig_paths(2) process_dlopen
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:process" "node:querystring" "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"
Elapsed: 2690ms | User: 578ms | Sys: 281ms
RSS: 0.51GB | Peak: 0.51GB | Commit: 0.77GB | Faults: 130554

panic(main thread): Illegal instruction at address 0x7FFD829BA420
oh no: Bun has crashed. This indicates a bug in Bun, not your code.

Stack Trace (bun.report)

Bun v1.1.36 (ededc16) on windows x86_64 [RunCommand]

Illegal instruction at address 0x7FFD829BA420

  • ??? at 0x1ea420 in skia.win32-x64-msvc.node
  • ??? at 0x20e3e9 in skia.win32-x64-msvc.node
  • ??? at 0x20e3b8 in skia.win32-x64-msvc.node
  • ??? at 0x17e5b8 in skia.win32-x64-msvc.node
  • ??? at 0x1eb85 in skia.win32-x64-msvc.node
  • ??? at 0x1ad29 in skia.win32-x64-msvc.node
  • ??? at 0x1a94f in skia.win32-x64-msvc.node
  • ??? at 0x23ad7 in skia.win32-x64-msvc.node
  • ??? at 0x3b819 in skia.win32-x64-msvc.node
  • napi.cpp:452: NAPIFunction::call

Features: process_dlopen, Bun.stdin, dotenv, http_server, jsc, transpiler_cache, tsconfig, tsconfig_paths, tsconfig_paths

Sentry Issue: BUN-8TN

@taro445 taro445 added the crash An issue that could cause a crash label Nov 23, 2024
@github-actions github-actions bot added runtime windows An issue that is known to occur on Windows labels Nov 23, 2024
@AceLikesGhosts
Copy link

AceLikesGhosts commented Nov 24, 2024

Can reproduce on Bun 1.1.34 and Windows 10
Edit: The underlying issue which caused this for the library was fixed, although Bun should not be dying like this.

@RiskyMH RiskyMH added the napi Compatibility with the native layer of Node.js label Nov 26, 2024
@190n
Copy link
Contributor

190n commented Dec 3, 2024

I reproduced this crash with a small example using @napi-rs/canvas v0.1.63, and it's fixed after upgrading to v0.1.64. @AceLikesGhosts if your code still runs into errors even after upgrading, please re-open this issue.

although Bun should not be dying like this.

There isn't really anything better we can do when third-party native code crashes. While in this specific case it may have worked to, say, unwind the stack up to the last JavaScript code and raise some kind of exception:

  • it's much harder to implement that behavior (especially cross-platform and cross-architecture) than to describe it
  • we can't assume, after encountering a segmentation fault or an illegal instruction, that the process is in a state fit to continue running. There may be unrecoverable memory corruption, and trying to keep executing code could just crash in a different, harder-to-debug way.

@190n 190n closed this as completed Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash An issue that could cause a crash napi Compatibility with the native layer of Node.js runtime windows An issue that is known to occur on Windows
Projects
None yet
Development

No branches or pull requests

4 participants