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

NW.js crashes while using Johnny-Five starting with v0.36.0 #7022

Closed
djipco opened this issue Mar 22, 2019 · 4 comments
Closed

NW.js crashes while using Johnny-Five starting with v0.36.0 #7022

djipco opened this issue Mar 22, 2019 · 4 comments
Assignees

Comments

@djipco
Copy link

djipco commented Mar 22, 2019

This test page works in NW.js v0.36.0-beta1 and prior versions but it stopped working with v0.36.0 and later versions:

<!DOCTYPE html>

<html lang="en">

  <body>
    <script>

      nw.require("nwjs-j5-fix").fix();

      const five = nw.require("johnny-five");

      const board = new five.Board(); // Mac
      // const board = new five.Board({port: "COM6"}); // Windows

      board.on("ready", () => console.log("Board ready!"));

    </script>
  </body>

</html>

In version 0.36.0 and later, NW.js crashes. Here is the info from the console (macOS Mojave) after the crash:

node[11464]: ../../third_party/node-nw/src/inspector_agent.cc:769:std::unique_ptr<InspectorSession> node::inspector::Agent::Connect(std::unique_ptr<InspectorSessionDelegate>, bool): Assertion `(client_) != nullptr' failed.
 1: 0x1124b8bcf node::Abort() [/Applications/nwjs.app/Contents/Versions/73.0.3683.86/nwjs Framework.framework/libnode.dylib]
 2: 0x1124b8b0c node::PrintErrorString(char const*, ...) [/Applications/nwjs.app/Contents/Versions/73.0.3683.86/nwjs Framework.framework/libnode.dylib]
 3: 0x112545c73 node::inspector::Agent::Connect(std::__1::unique_ptr<node::inspector::InspectorSessionDelegate, std::__1::default_delete<node::inspector::InspectorSessionDelegate> >, bool) [/Applications/nwjs.app/Contents/Versions/73.0.3683.86/nwjs Framework.framework/libnode.dylib]
 4: 0x11254cf3a node::inspector::(anonymous namespace)::JSBindingsConnection::New(v8::FunctionCallbackInfo<v8::Value> const&) [/Applications/nwjs.app/Contents/Versions/73.0.3683.86/nwjs Framework.framework/libnode.dylib]
 5: 0x10995ae0f v8::internal::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, v8::internal::BasicBlockProfiler const&) [/Applications/nwjs.app/Contents/Versions/73.0.3683.86/nwjs Framework.framework/Versions/A/nwjs Framework]
 6: 0x10995a0d3 v8::internal::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, v8::internal::BasicBlockProfiler const&) [/Applications/nwjs.app/Contents/Versions/73.0.3683.86/nwjs Framework.framework/Versions/A/nwjs Framework]
 7: 0x1099599b7 v8::internal::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, v8::internal::BasicBlockProfiler const&) [/Applications/nwjs.app/Contents/Versions/73.0.3683.86/nwjs Framework.framework/Versions/A/nwjs Framework]
 8: 0x10a2bd6ab v8_inspector::V8StackTraceId::IsInvalid() const [/Applications/nwjs.app/Contents/Versions/73.0.3683.86/nwjs Framework.framework/Versions/A/nwjs Framework]
 9: 0x10a219100 v8_inspector::V8StackTraceId::IsInvalid() const [/Applications/nwjs.app/Contents/Versions/73.0.3683.86/nwjs Framework.framework/Versions/A/nwjs Framework]
Received signal 6
 [0x00010ae5b8a9]
 [0x00010ad7ffd3]
 [0x00010ae5b7c1]
 [0x7fff6eda2b3d]
 [0x7fb5d9815b10]
 [0x7fff6ec601c9]
 [0x0001124b8bdc]
 [0x0001124b8b0c]
 [0x000112545c73]
 [0x00011254cf3a]
 [0x00010995ae0f]
 [0x00010995a0d3]
 [0x0001099599b7]
 [0x00010a2bd6ab]
 [0x00010a219100]
[end of stack trace]
[0321/211252.308505:WARNING:process_memory_mac.cc(93)] mach_vm_read(0x7ffeec6dc000, 0x2000): (os/kern) invalid address (1)

It also crashes on Windows 10.

This is the content of my package.json file:

{
  "name": "test",
  "main": "index.html",
  "dependencies": {
    "johnny-five": "^1.0.0",
    "nwjs-j5-fix": "^1.0.3"
  }
}

Thank you for looking into this.

@ffanny
Copy link
Member

ffanny commented Mar 25, 2019

Does the use of johnny-five need to connect specific hardware? Or can there be any method to test without hardware?

I tried with your code and the ready event is not emitted and there is no crash.

@djipco
Copy link
Author

djipco commented Mar 25, 2019

In my example, Johnny-Five tries to connect to an Arduino board. I don't know if it does the same with other boards. Unfortunately, I do not know of a way to replicate this problem without the hardware.

When no Arduino is connected, the connection is not established and the ready event is never fired. This is the expected behaviour.

@ffanny
Copy link
Member

ffanny commented Apr 1, 2019

I can reproduce this with nwjs-sdk-linux-v0.37.1&v0.36.3. And it works well with v0.36.0-beta1&v0.35.3.
(I use Arduino UNO R3 board.)

v37 1

@rogerwang
Copy link
Member

This is fixed in git and will be available in the next nightly build.

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

3 participants