pc-ble-driver-js 2.8.2 + pc-ble-driver 4.1.4 + node 14.19.1 - SIGSEGV on linux, but success on windows

Hi,
We have a central app running pc-ble-driver-js 2.7.2 with dongles burnt with 4.1.2 firmware, on node 12.x.x, which has been running successfully on windows + ubuntu + debian + rhel for a while now, with the upcoming production aimed for linux distros only.
We are now trying to upgrade to node 14, pc-ble-driver-js 2.8.2, and with dongles burnt with 4.1.4 firmware, but are running into segmentation faults in linux only.

The PCs are all x64, running node 14.19.1 x64, and were installed and rebuilt via "yarn install" from scratch.
On the Windows PC, all is well - the app continues to run after opening the adapter, and succeeds in connecting to our nrf peripherals with no issues so far.

On both linux PCs (1 rhel and 1 ubuntu focal fossa), the driver fails with a segmentation fault (SIGSEGV).
By adding segfault-handler to our code (https://httptoolkit.tech/blog/how-to-debug-node-segfaults/), I was able to narrow down the problem on our ubuntu PC:

PID 40997 received SIGSEGV for address: 0x0
error: [libs/bleAdapter] BLE Received SERIALIZATION_RESPONSE but command did not provide a buffer for the reply.
/central/code/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x3785)[0x7f9c06abe785]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x143c0)[0x7f9c067573c0]
/central/code/node_modules/pc-ble-driver-js/build/Release/pc-ble-driver-js-sd_api_v5.node(_Z13encode_decodeP9adapter_tRKSt8functionIFjPhPjEERKS1_IFjS2_jS3_EE+0x454)[0x7f9bfd286554]
/central/code/node_modules/pc-ble-driver-js/build/Release/pc-ble-driver-js-sd_api_v5.node(sd_ble_cfg_set+0xaa)[0x7f9bfd25089a]
/central/code/node_modules/pc-ble-driver-js/build/Release/pc-ble-driver-js-sd_api_v5.node(_ZN7Adapter9enableBLEEP9adapter_tP19enable_ble_params_t+0x2c)[0x7f9bfd1ee5ac]
/central/code/node_modules/pc-ble-driver-js/build/Release/pc-ble-driver-js-sd_api_v5.node(_ZN7Adapter4OpenEP9uv_work_s+0x23f)[0x7f9bfd1ee93f]
/usr/local/bin/node[0x13bbc14]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x8609)[0x7f9c0674b609]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x43)[0x7f9c06670163]
Segmentation fault (core dumped)
error Command failed with exit code 139.
After googling the underscored and bolded line, I was able to find it in the pc-ble-driver cpp code: lines 229 and 230 in master (https://github.com/NordicSemiconductor/pc-ble-driver/blob/master/src/common/transport/serialization_transport.cpp).
What is the solution to this?
Thanks,
Roi
Parents
  • Hello,

    I will have to forward this to our serialization team. I will let you know when I hear from them.

    Best regards,

    Edvin

  • Hi,
    Just an update that we also tried to build both pc-ble-driver and pc-ble-driver-js from source, and we still receive the same error both on api v2 and v5:

    1. ​cloning pc-ble-driver + git checkout v4.1.4
    2. cloning pc-ble-driver-js + git checkout v2.8.2
    3. Add to CMakeLists in pc-ble-driver repo (so that the targets.cmake file is created):
      export(TARGETS nrf_ble_driver_sd_api_v2_static NAMESPACE nrf:: FILE nrf-ble-driverTargets.cmake)
      export(TARGETS nrf_ble_driver_sd_api_v3_static NAMESPACE nrf:: APPEND FILE nrf-ble-driverTargets.cmake)
      export(TARGETS nrf_ble_driver_sd_api_v5_static NAMESPACE nrf:: APPEND FILE nrf-ble-driverTargets.cmake)
      export(TARGETS nrf_ble_driver_sd_api_v6_static NAMESPACE nrf:: APPEND FILE nrf-ble-driverTargets.cmake)
      export(TARGETS nrf_ble_driver_sd_api_v2_shared NAMESPACE nrf:: APPEND FILE nrf-ble-driverTargets.cmake)
      export(TARGETS nrf_ble_driver_sd_api_v3_shared NAMESPACE nrf:: APPEND FILE nrf-ble-driverTargets.cmake)
      export(TARGETS nrf_ble_driver_sd_api_v5_shared NAMESPACE nrf:: APPEND FILE nrf-ble-driverTargets.cmake)
      export(TARGETS nrf_ble_driver_sd_api_v6_shared NAMESPACE nrf:: APPEND FILE nrf-ble-driverTargets.cmake)
    4. Run cmake within build folder: sudo cmake -Dspdlog_DIR=/vcpkg/packages/spdlog_x64-linux/share/spdlog -Dfmt_DIR=/vcpkg/packages/fmt_x64-linux/share/fmt -DASIO_INCLUDE_DIR=/vcpkg/packages/asio_x64-linux/include -DCatch2_DIR=/vcpkg/packages/catch2_x64-linux/share/catch2 -DNRF_BLE_DRIVER_VERSION=4.1.4 -G Ninja ..
    5. Build: sudo cmake --build .
    6. Change CMakeLists.txt in pc-ble-driver-js to only build v5 (by changing the foreach).
    7. sudo node build.js --CDnrf-ble-driver_DIR="/pc-ble-driver/build" --CDCMAKE_CXX_FLAGS="-I /pc-ble-driver/include/ -I /pc-ble-driver/include/common -I /pc-ble-driver/include/common/sdk_compat -I /pc-ble-driver/include/common/config -I /pc-ble-driver/include/sd_api_v5"
    8. Remove CMakeCache.txt from build
    9. Change CMakeLists.txt in pc-ble-driver-js to only build v2 (by changing the foreach).
    10. sudo node build.js --CDnrf-ble-driver_DIR="/pc-ble-driver/build" --CDCMAKE_CXX_FLAGS="-I /pc-ble-driver/include/ -I /pc-ble-driver/include/common -I /pc-ble-driver/include/common/sdk_compat -I /pc-ble-driver/include/common/config -I /pc-ble-driver/include/sd_api_v2"
    11. After this, build/Release will hold both node bindings files. Move them to the node_modules/pc-ble-driver-js/build/Release folder.

    After this, we still receive the same serialization error.

    Roi

  • Hi,
    An additional update: with the same build logic above (for node 14 on linux), we are able to run the dongle and connect to our peripherals with a dongle burnt with 4.1.2:

    1. Go through the process above to compile and create the node bindings files for pc-ble-driver-js v2.8.2 and pc-ble-driver 4.1.4
    2. Unzip our typescript code
    3. "sudo yarn install" to install all our packages, including pc-ble-driver-js.
    4. Replace the bindings files in node_modules/pc-ble-driver-js/build/Release with the bindings files we built in step 1.
    5. Run our central - so far, we have been able to open the adapter, and connect to our peripherals with no issues.

    Is this expected? Should a node bindings file compiled against a 4.1.4 pc-ble-driver work with a 4.1.2 dongle?
    Has this been tested before?
    Roi

Reply
  • Hi,
    An additional update: with the same build logic above (for node 14 on linux), we are able to run the dongle and connect to our peripherals with a dongle burnt with 4.1.2:

    1. Go through the process above to compile and create the node bindings files for pc-ble-driver-js v2.8.2 and pc-ble-driver 4.1.4
    2. Unzip our typescript code
    3. "sudo yarn install" to install all our packages, including pc-ble-driver-js.
    4. Replace the bindings files in node_modules/pc-ble-driver-js/build/Release with the bindings files we built in step 1.
    5. Run our central - so far, we have been able to open the adapter, and connect to our peripherals with no issues.

    Is this expected? Should a node bindings file compiled against a 4.1.4 pc-ble-driver work with a 4.1.2 dongle?
    Has this been tested before?
    Roi

Children
No Data
Related