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

Serial port segmentation fault #89

Closed
ernstnaezer opened this issue Jan 9, 2019 · 7 comments
Closed

Serial port segmentation fault #89

ernstnaezer opened this issue Jan 9, 2019 · 7 comments

Comments

@ernstnaezer
Copy link
Contributor

ernstnaezer commented Jan 9, 2019

Just did a fresh download of "espruino": "^0.1.23" & ESP32 firmware flash on my Mac and I get a segfault when trying to connect to the device. My node version is v8.14.1.

Steps to reproduce:

npm install espruino in a fresh / empty folder after npm init builds with the following output:

> node-gyp rebuild

  CXX(target) Release/obj.target/binding/src/XpcConnection.o
../src/XpcConnection.cpp:143:44: warning: 'GetRealNamedProperty' is deprecated [-Wdeprecated-declarations]
      Local<Value> propertyValue = object->GetRealNamedProperty(propertyName->ToString());
                                           ^
/Users/enix/.node-gyp/8.14.1/include/node/v8.h:3453:3: note: 'GetRealNamedProperty' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version",
  ^
/Users/enix/.node-gyp/8.14.1/include/node/v8config.h:321:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
../src/XpcConnection.cpp:254:12: warning: 'MakeCallback' is deprecated [-Wdeprecated-declarations]
      Nan::MakeCallback(Nan::New<Object>(this->This), Nan::New("emit").ToLocalChecked(), 2, argv);
           ^
../../nan/nan.h:980:3: note: 'MakeCallback' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
  ^
../../nan/nan.h:103:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
../src/XpcConnection.cpp:263:12: warning: 'MakeCallback' is deprecated [-Wdeprecated-declarations]
      Nan::MakeCallback(Nan::New<Object>(this->This), Nan::New("emit").ToLocalChecked(), 2, argv);
           ^
../../nan/nan.h:980:3: note: 'MakeCallback' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
  ^
../../nan/nan.h:103:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^

 warnings generated.
  SOLINK_MODULE(target) Release/binding.node

> @serialport/[email protected] install /Users/enix/projects/crash-test/node_modules/@serialport/bindings
> prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild

> [email protected] install /Users/enix/projects/crash-test/node_modules/websocket
> (node-gyp rebuild 2> builderror.log) || (exit 0)

  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/bufferutil.node
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/validation.node

I then run node_modules/.bin/espruino --port /dev/tty.SLAB_USBtoUART -v which:

0.1.23
Espruino Command-line Tool 0.1.23
-----------------------------------

Acorn library not found - you'll need it for compiled code
Found /Users/enix/projects/crash-test/node_modules/espruino/espruino.js
Found /Users/enix/projects/crash-test/node_modules/espruino/core/codeWriter.js
Found /Users/enix/projects/crash-test/node_modules/espruino/core/config.js
Found /Users/enix/projects/crash-test/node_modules/espruino/core/env.js
Found /Users/enix/projects/crash-test/node_modules/espruino/core/flasher.js
Found /Users/enix/projects/crash-test/node_modules/espruino/core/modules.js
Found /Users/enix/projects/crash-test/node_modules/espruino/core/notifications.js
Found /Users/enix/projects/crash-test/node_modules/espruino/core/serial.js
Found /Users/enix/projects/crash-test/node_modules/espruino/core/serial_chrome_serial.js
No chrome.serial - Chrome Serial disabled
Found /Users/enix/projects/crash-test/node_modules/espruino/core/serial_chrome_socket.js
No chrome.sockets - Chrome Socket disabled
Found /Users/enix/projects/crash-test/node_modules/espruino/core/serial_frame.js
Found /Users/enix/projects/crash-test/node_modules/espruino/core/serial_noble.js
Found /Users/enix/projects/crash-test/node_modules/espruino/core/serial_node_serial.js
Found /Users/enix/projects/crash-test/node_modules/espruino/core/serial_node_socket.js
Found /Users/enix/projects/crash-test/node_modules/espruino/core/serial_web_audio.js
Found /Users/enix/projects/crash-test/node_modules/espruino/core/serial_web_bluetooth.js
Found /Users/enix/projects/crash-test/node_modules/espruino/core/serial_websocket_local.js
Found /Users/enix/projects/crash-test/node_modules/espruino/core/serial_websocket_relay.js
Found /Users/enix/projects/crash-test/node_modules/espruino/core/serial_winnus.js
Not on Windows, Winnus not needed
Found /Users/enix/projects/crash-test/node_modules/espruino/core/terminal.js
Found /Users/enix/projects/crash-test/node_modules/espruino/core/utils.js
Found /Users/enix/projects/crash-test/node_modules/espruino/plugins/assembler.js
Found /Users/enix/projects/crash-test/node_modules/espruino/plugins/boardJSON.js
Found /Users/enix/projects/crash-test/node_modules/espruino/plugins/compiler.js
Found /Users/enix/projects/crash-test/node_modules/espruino/plugins/getGitHub.js
Found /Users/enix/projects/crash-test/node_modules/espruino/plugins/localModules.js
Found /Users/enix/projects/crash-test/node_modules/espruino/plugins/minify.js
Found /Users/enix/projects/crash-test/node_modules/espruino/plugins/saveOnSend.js
Found /Users/enix/projects/crash-test/node_modules/espruino/plugins/setTime.js
Found /Users/enix/projects/crash-test/node_modules/espruino/plugins/unicode.js
Found /Users/enix/projects/crash-test/node_modules/espruino/plugins/versionChecker.js
Initialising CodeWriter
Initialising Config
Initialising Env
Initialising Flasher
Initialising Modules
Initialising Notifications
Initialising Serial
  - Initialising Serial Noble Bluetooth LE
  - Initialising Serial Node Serial
  - Initialising Serial Node Socket
  - Initialising Serial Web Bluetooth
Initialising Utils
Initialising Status
Initialising Assembler
Initialising BoardJSON
Initialising Compiler
Initialising GetGitHub
Initialising LocalModules
Initialising Minify
Initialising SaveOnSend
Initialising SetTime
Initialising Unicode
Initialising VersionChecker
Connecting to '/dev/tty.SLAB_USBtoUART'
Noble: getPorts - not initialised
No navigator.bluetooth - Web Bluetooth not enabled
Noble: stateChange -> poweredOn
Noble: Disable Web Bluetooth as we have Noble instead
Noble: Starting scan
[1]    16287 segmentation fault  node_modules/.bin/espruino --port /dev/tty.SLAB_USBtoUART -v
@ernstnaezer
Copy link
Contributor Author

ernstnaezer commented Jan 9, 2019

After installing the node-segfault-handler this is the stack trace I got. I've disabled BLE using the --no-ble flag and it still bombs. Something OpenBaton - that is the serial port driver.

PID 32203 received SIGSEGV for address: 0x1958
0   segfault-handler.node               0x00000001035f4338 _ZL16segfault_handleriP9__siginfoPv + 312
1   libsystem_platform.dylib            0x00007fff5b369b3d _sigtramp + 29
2   ???                                 0x0000000104a000b0 0x0 + 4372562096
3   bindings.node                       0x0000000104f82955 _ZN3Nan3imp7FactoryIN2v86ObjectEE3NewEv + 21
4   bindings.node                       0x0000000104f804cd _ZN3Nan3NewIN2v86ObjectEEENS_3imp7FactoryIT_E8return_tEv + 13
5   bindings.node                       0x0000000104f819d0 _ZN22ConnectionOptionsBatonC2Ev + 32
6   bindings.node                       0x0000000104f7ee95 _ZN22ConnectionOptionsBatonC1Ev + 21
7   bindings.node                       0x0000000104f846b7 _Z5setupiP9OpenBaton + 1095
8   bindings.node                       0x0000000104f8423b _Z8EIO_OpenP9uv_work_s + 155
9   node                                0x000000010068056a worker + 278
10  libsystem_pthread.dylib             0x00007fff5b372305 _pthread_body + 126
11  libsystem_pthread.dylib             0x00007fff5b37526f _pthread_start + 70
12  libsystem_pthread.dylib             0x00007fff5b371415 thread_start + 13

@ernstnaezer
Copy link
Contributor Author

Looks like it is this issue - serialport/node-serialport#1771

@ernstnaezer ernstnaezer changed the title Noble: Starting scan segmentation fault Serial port segmentation fault Jan 9, 2019
@ernstnaezer
Copy link
Contributor Author

Downgrading by running npm i [email protected] inside the node_modules/espruino folder fixes the crash.

@gfwilliams
Copy link
Member

Thanks for the report - this looks like quite a new issue with node-serialport (in the release 2 days ago?) so I'd hope that it would be fixed pretty soon - it's great that you found a downgrade would fix it though.

@ernstnaezer
Copy link
Contributor Author

This PR seems to fix the crash. serialport/node-serialport#1772

@ernstnaezer
Copy link
Contributor Author

#90

@gfwilliams
Copy link
Member

Thanks!

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

2 participants