Skip to content

Check failed: node->IsInUse() #1393

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

Closed
jansivans opened this issue May 27, 2024 · 10 comments
Closed

Check failed: node->IsInUse() #1393

jansivans opened this issue May 27, 2024 · 10 comments

Comments

@jansivans
Copy link

Hi,
I have an application running in Docker that executes scripts in different threads using a worker pool. Here is the simplest code I use:

const ssh = require('ssh2');

When I execute this code once, everything works fine.
However, the second time I run it, the Node.js app crashes with the following message:

#
# Fatal error in , line 0
# Check failed: node->IsInUse().
#
#
#
#FailureMessage Object: 0x40614b4200
----- Native stack trace -----

 1: 0xd36311  [node]
 2: 0x216a841 V8_Fatal(char const*, ...) [node]
 3: 0x1091169 v8::internal::GlobalHandles::Destroy(unsigned long*) [node]
 4: 0x42e94d2152 init(v8::Local<v8::Object>) [/app/generated/node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node]
 5: 0xc7b1bc  [node]
 6: 0xc27b77 node::Environment::TryLoadAddon(char const*, int, std::function<bool (node::binding::DLib*)> const&) [node]
 7: 0xc7a43f node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&) [node]
 8: 0xf5596f v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [node]
 9: 0xf561dd  [node]
10: 0xf566a5 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
11: 0x1960df6  [node]
qemu: uncaught target signal 5 (Trace/breakpoint trap) - core dumped
Trace/breakpoint trap

Has anyone encountered this issue?

@mscdex
Copy link
Owner

mscdex commented May 27, 2024

I'm not able to reproduce the issue (tested on Linux with node v20.12.0 and nan 2.19.0). What version of node are you using and do you have a simple way of reproducing the error?

@jansivans
Copy link
Author

I have narrowed down my issue to sshcrypto.node file.
If I remove it, everything works fine.
However, it automatically gets installed in my CI.
Is it possible to prevent installation of this file?

@mscdex
Copy link
Owner

mscdex commented May 28, 2024

Is it possible to prevent installation of this file?

You can tell your package manager to ignore scripts when installing ssh2, but if you can supply the information I requested I'd rather try to fix the issue...

Additionally if you can use npm ls (or similar command if you're using some other package manager) to determine what version of nan is being used, that would be helpful as well.

@mscdex mscdex closed this as not planned Won't fix, can't repro, duplicate, stale Jul 23, 2024
@Crunkstar
Copy link

Hello, I've encountered the same problem as jansivans.

Please check my reproduction repository: https://github.com/Crunkstar/ssh2-1393-repro

I tested with Node.js version v20.16.0 and ssh2 version 1.15.0 (as seen in the repository), additionally I tested commit be9165b (most recent commit at the time of writing this) but received the same error.

Sometimes the reproduction script segfauls without error message.

As mentioned by jansivans, the problem does not occur after deleting sshcrypto.node.

Output of npm ls --all

[email protected] /ssh2-1393-repro
└─┬ [email protected]
  ├─┬ [email protected]
  │ └── [email protected]
  ├─┬ [email protected]
  │ └── [email protected]
  ├─┬ [email protected]
  │ ├── [email protected]
  │ └── [email protected] deduped
  └── [email protected]

image

#
# Fatal error in , line 0
# Check failed: node->IsInUse().
#
#
#
#FailureMessage Object: 0x7f8aed6486c0
----- Native stack trace -----

 1: 0xd39331  [node]
 2: 0x21702c1 V8_Fatal(char const*, ...) [node]
 3: 0x1094879 v8::internal::GlobalHandles::Destroy(unsigned long*) [node]
 4: 0x7f8af04b1bcb init(v8::Local<v8::Object>) [/ssh2-1393-repro/node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node]
 5: 0xc7d9ec  [node]
 6: 0xc29bf7 node::Environment::TryLoadAddon(char const*, int, std::function<bool (node::binding::DLib*)> const&) [node]
 7: 0xc7cc6f node::binding::DLOpen(v8::FunctionCallbackInfo<v8::Value> const&) [node]
 8: 0xf5907f v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [node]
 9: 0xf598ed  [node]
10: 0xf59db5 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
11: 0x1964df6  [node]
Trace/breakpoint trap (core dumped)

@harshSE
Copy link

harshSE commented Aug 17, 2024

We are facing the same issue with node version 20.15.0 and ssh2 version 2.15.0.

@thrillp
Copy link

thrillp commented Aug 19, 2024

@mscdex
same here with node 20.16.0 and ssh2 version 2.15.0.

@0xAl3xH
Copy link

0xAl3xH commented Feb 1, 2025

I've run into this with node 18.13.0 and ssh2 version 1.16.0 as well.

PID 19882 received SIGSEGV for address: 0x0
/.../node_modules/segfault-handler/build/Release/segfault-handler.node(+0x372d)[0x7f169105e72d]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7f16939b5520]
node(_ZN2v88internal13GlobalHandles9NodeSpaceINS1_4NodeEE7ReleaseEPS3_+0x2a)[0xed4eaa]
/.../node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node(_Z4initN2v85LocalINS_6ObjectEEE+0x392)[0x7f169104c152]
node[0xb34597]
node(_ZN4node11Environment12TryLoadAddonEPKciRKSt8functionIFbPNS_7binding4DLibEEE+0x73)[0xaf1de3]
node(_ZN4node7binding6DLOpenERKN2v820FunctionCallbackInfoINS1_5ValueEEE+0x254)[0xb339e4]
node[0xdb0230]
node(_ZN2v88internal21Builtin_HandleApiCallEiPmPNS0_7IsolateE+0xaf)[0xdb176f]
node[0x16ef579]
Segmentation fault (core dumped)

Deleting node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node has made this issue go away completely. @mscdex if we are not getting a fix soon can you confirm that deleting this is a viable workaround and won't break other functionalities? Thanks

mscdex pushed a commit that referenced this issue Feb 5, 2025
@SarcevicAntonio
Copy link

Awesome and exciting to see the fix get merged! I'm curious to hear when can we expect a new version with this fix included to be published to npm?

@liben96
Copy link

liben96 commented Mar 25, 2025

Any updates on this matter?

@mscdex
Copy link
Owner

mscdex commented Mar 25, 2025

@liben96 The fixed landed in dd5510c. A new version should be released soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants