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

NAPI Argon2 Segfault #5848

Closed
JoeyEamigh opened this issue Sep 21, 2023 · 10 comments · Fixed by #7765
Closed

NAPI Argon2 Segfault #5848

JoeyEamigh opened this issue Sep 21, 2023 · 10 comments · Fixed by #7765
Labels
bug Something isn't working crash An issue that could cause a crash napi Compatibility with the native layer of Node.js

Comments

@JoeyEamigh
Copy link

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 JoeyEamigh added the bug Something isn't working label Sep 21, 2023
@JoeyEamigh
Copy link
Author

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
Copy link
Contributor

trnxdev commented Sep 21, 2023

Duplicate of #2550?

@JoeyEamigh
Copy link
Author

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

@trnxdev
Copy link
Contributor

trnxdev commented Sep 21, 2023

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
Copy link
Author

JoeyEamigh commented Sep 21, 2023

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
Copy link

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
Copy link

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

@Electroid Electroid added napi Compatibility with the native layer of Node.js crash An issue that could cause a crash labels Sep 21, 2023
@capaj
Copy link
Contributor

capaj commented Oct 11, 2023

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

@pablodelamerced
Copy link

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
Copy link
Collaborator

Jarred-Sumner commented Dec 5, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working crash An issue that could cause a crash napi Compatibility with the native layer of Node.js
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants