oven-sh / bun

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

NAPI Argon2 Segfault #5848

Closed JoeyEamigh closed 9 months ago

JoeyEamigh commented 1 year ago

What version of Bun is running?

1.0.3 (main branch ac19c7c)

What platform is your computer?

Linux 6.5.3-arch1-1 x86_64 unknown

What steps can reproduce the bug?

  1. git clone https://github.com/ranisalt/node-argon2.git
  2. bun install
  3. bun run --bun mocha test/test.js

What is the expected behavior?

No segfault!

What do you see instead?

[napi] napi_get_typedarray_info
[napi] napi_get_typedarray_info
[napi] napi_get_buffer_info
[napi] napi_get_typedarray_info
[napi] napi_get_typedarray_info
[napi] napi_get_buffer_info
[napi] napi_coerce_to_number
[napi] napi_get_value_uint32
[napi] napi_coerce_to_number
[napi] napi_get_value_uint32
[napi] napi_coerce_to_number
[napi] napi_get_value_uint32
[napi] napi_coerce_to_number
[napi] napi_get_value_uint32
[napi] napi_coerce_to_number
[napi] napi_get_value_uint32
[napi] napi_coerce_to_number
[napi] napi_get_value_int32
[napi] napi_create_string_latin1
[napi] napi_create_async_work
[napi] napi_queue_async_work
[Loop] ref
[napi] napi_get_undefined
[Loop] ref
[napi] napi_open_handle_scope
[napi] napi_open_handle_scope
[napi] napi_get_undefined
[napi] napi_create_buffer_copy: 32
[napi] napi_get_typedarray_info
[napi] napi_get_typedarray_info
[napi] napi_open_escapable_handle_scope
[napi] napi_get_undefined
[napi] napi_escape_handle
[napi] napi_close_escapable_handle_scope
[napi] napi_close_handle_scope
[napi] napi_close_handle_scope
[napi] napi_delete_async_work
[Loop] unref
[Loop] unref
[uws] Timer.deinit()
      βœ” hash with argon2i
error: "mocha" exited with code 11 (SIGSEGV)

Additional information

I am not sure the best way to debug zig as I have never used it before, but I am happy to be of any assistance I can!

JoeyEamigh commented 1 year ago

I am not sure if this is very important as one can just use the hashing functions built into the bun runtime, but it may be worth looking at in case there is something bigger going on here!

trnxdev commented 1 year ago

Duplicate of #2550?

JoeyEamigh commented 1 year ago

I don't think so since #2550 appears to be related to #5472.

trnxdev commented 1 year ago

I don't think so since #2550 appears to be related to #5472.

In my comment on #2550 I said that it fails because of napi, but maybe you are right.

JoeyEamigh commented 1 year ago

Ah I had missed that. I am getting opaque errors on the debug build that are unrelated to having a missing module when there are missing modules so it could be a duplicate for sure.

minkoonim commented 1 year ago

same here.

I'm using bun with nuxt3 on ubuntu, for bun nuxi dev everything is fine, but after building, argon2 gives segmentation fault

minkoonim commented 1 year ago

and I found out '@node-rs/argon2' works!

capaj commented 12 months ago

thanks a lot @minkoonim @node-rs/argon2 certainly does work fine. Very pleasant surprise.

pablodelamerced commented 10 months ago

Hello everyone,

I'm encountering an issue with the @node-rs/argon2 package in a specific scenario. When running the commands bun run build and bun --hot run src/index.ts, everything works flawlessly. However, the problem arises when attempting to build using any of the following commands:

bun build ./src/index.ts --target bun bun build ./src/index.ts --target node bun build --compile ./src/index.ts --outfile=server

In these cases, I consistently receive the following error message:

uh-oh: Internal error: missing asset file
bun will crash now 😭😭😭

----- bun meta -----
Bun v1.0.15 (b3bdf22e) macOS Silicon 22.5.0
BuildCommand: dotenv 
Elapsed: 59ms | User: 149ms | Sys: 76ms
RSS: 0.17GB | Peak: 0.17GB | Commit: 0.21GB | Faults: 0
----- bun meta -----

0   0x1011c968c
1   ???
2   ???

Thanks!

Jarred-Sumner commented 10 months ago

Hello everyone,

I'm encountering an issue with the @node-rs/argon2 package in a specific scenario. When running the commands bun run build and bun --hot run src/index.ts, everything works flawlessly. However, the problem arises when attempting to build using any of the following commands:

bun build ./src/index.ts --target bun bun build ./src/index.ts --target node bun build --compile ./src/index.ts --outfile=server

In these cases, I consistently receive the following error message:

uh-oh: Internal error: missing asset file
bun will crash now 😭😭😭

----- bun meta -----
Bun v1.0.15 (b3bdf22e) macOS Silicon 22.5.0
BuildCommand: dotenv 
Elapsed: 59ms | User: 149ms | Sys: 76ms
RSS: 0.17GB | Peak: 0.17GB | Commit: 0.21GB | Faults: 0
----- bun meta -----

0   0x1011c968c
1   ???
2   ???

Thanks!

@pablodelamerced This is caused by #3903, and unrelated to this issue