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 napi panic #13253

Open
Miosp opened this issue Aug 12, 2024 · 6 comments
Open

Bun napi panic #13253

Miosp opened this issue Aug 12, 2024 · 6 comments
Labels
bug Something isn't working needs triage

Comments

@Miosp
Copy link

Miosp commented Aug 12, 2024

What version of Bun is running?

1.1.22

What platform is your computer?

Microsoft Windows NT 10.0.22631.0 x64 (also linux on fedora 40)

What steps can reproduce the bug?

Run my vite dev server with bunx --bun vite dev. After that the dev server starts and displays initial message normally but after opening the link in the browser it crashes.

Unfortunately the bug is not reproducible with bun's vite demo.

What is the expected behavior?

Dev server serves requests.

What do you see instead?

thread '' panicked at napi\src\threadsafe_function.rs:235:57:
called Result::unwrap() on an Err value: Error { status: InvalidArg, reason: "expect Function, got: Object", maybe_raw: 0x0 }
stack backtrace:
0: 0x7ffc5fd383dd - napi_register_module_v1
1: 0x7ffc5f558fad -
2: 0x7ffc5fd2dbb1 - napi_register_module_v1
3: 0x7ffc5fd3a1ca - napi_register_module_v1
4: 0x7ffc5fd39a99 - napi_register_module_v1
5: 0x7ffc5fd3a900 - napi_register_module_v1
6: 0x7ffc5fd3a3f9 - napi_register_module_v1
7: 0x7ffc5fd3a339 - napi_register_module_v1
8: 0x7ffc5fd3a322 - napi_register_module_v1
9: 0x7ffc5fd3c367 - napi_register_module_v1
10: 0x7ffc5fd3c8b3 - napi_register_module_v1
11: 0x7ffc5fcffba1 -
12: 0x7ff7688f58c8 - napi_remove_async_cleanup_hook
13: 0x7ff7688f2cfb - napi_remove_async_cleanup_hook
14: 0x7ff768497174 -
15: 0x7ff7683c75d5 -
16: 0x7ff76aa8d77b - uv_getnameinfo
17: 0x7ff76834a975 -
18: 0x7ff7684b0573 -
19: 0x7ff76834e242 -
20: 0x7ff768303aba -
21: 0x7ff768302da0 -
22: 0x7ff7680621bc -
23: 0x7ff76806117b -
24: 0x7ff76ad7e74c - node::RemoveEnvironmentCleanupHook
25: 0x7ffd3408257d - BaseThreadInitThunk
26: 0x7ffd3500af28 - RtlUserThreadStart
error: script "dev" exited with code 9

Additional information

The behavior on my linux machine is the same.

I upgraded from Bun 1.1.17, which had no issues.

@Miosp Miosp added bug Something isn't working needs triage labels Aug 12, 2024
@Jarred-Sumner
Copy link
Collaborator

Does this still occur in Bun v1.1.27?

@Miosp
Copy link
Author

Miosp commented Sep 10, 2024

I think it v1.1.27 fixed the issue both on windows and linux. Nice!

@Miosp Miosp closed this as completed Sep 10, 2024
@Miosp
Copy link
Author

Miosp commented Sep 11, 2024

Sorry, for the confusion. It actually still happens. Just this time it is a bit delayed, so in my quick testing the issue did not occur (middle of the night).

@Miosp Miosp reopened this Sep 11, 2024
@haxibami
Copy link

I have a similar problem with the following sample project, which uses Astro & lightningcss.

https://github.com/haxibami/bun-sample

When I remove lightningcss or just use bun run dev (instead of bun --bun run dev), the error disappears. It also doesn't happen with Bun v1.1.20 or lower.

thread '<unnamed>' panicked at napi/src/threadsafe_function.rs:235:57:
called `Result::unwrap()` on an `Err` value: Error { status: InvalidArg, reason: "expect Function, got: Object", maybe_raw: 0x0 }
stack backtrace:
   0:      0x98379637713 - <unknown>
   1:      0x98378e47ad0 - <unknown>
   2:      0x9837960b722 - <unknown>
   3:      0x983796391ee - <unknown>
   4:      0x98379638970 - <unknown>
   5:      0x98379639b37 - <unknown>
   6:      0x98379639540 - <unknown>
   7:      0x98379639496 - <unknown>
   8:      0x9837963948f - <unknown>
   9:      0x98378e29414 - <unknown>
  10:      0x98378e298c2 - <unknown>
  11:      0x983795e2dbe - <unknown>
  12:          0x3330fbc - <unknown>
  13:          0x332e94c - <unknown>
  14:          0x2f0fe3a - <unknown>
  15:          0x2e22c15 - <unknown>
  16:          0x3dd9bab - <unknown>
error: script "dev" was terminated by signal SIGABRT (Abort)
zsh: IOT instruction (core dumped)  RUST_BACKTRACE=full bun --bun run dev

@Miosp
Copy link
Author

Miosp commented Sep 12, 2024

i use lightning css too, so that may be a good starting point

@haxibami
Copy link

#13771 (pure Vite + lightningcss) looks similar, but the error seems to be caused by adding css.lightningcss.visitor in Vite config, not just using lightningcss (css.transformer).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

3 participants