Skip to content

segfault in getDriverStatistics() when connect() has not been called #393

@nouknouk

Description

@nouknouk

Hi,

I face a segfault, apparently when using getDriverStatistics in my node application too early, when driver has not yet been connected.

To reproduce:

  • The driver has been initialized with a let driver = new OpenZwave(driverConfig);
  • At this point the driver.connect(...) has not been called yet.
  • Here, a call to let statistics = driver.getDriverStatistics(); makes a segfault.

To my mind:

  • this is not a big deal, a call to getDriverStatistics() makes no sense before a (successfull) call to connect(). I should (and I will) rather fix the logic in my application to prevent calls to driver before the call to connect

  • on the other hand:

    • maybe the node-openzwave-shared should fail gracefully rather than causing a segfault.
    • it is probably the same for several other functions.

The stack trace:

(grabbed with package segfault-handler)

PID 8530 received SIGSEGV for address: 0x40
/home/nouknouk/git/domonode/core/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x3341)[0x7f5a2df7c341]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x153c0)[0x7f5a330903c0]
/usr/lib/x86_64-linux-gnu/libopenzwave.so.1.6(_ZN9OpenZWave7Manager9GetDriverEj+0x22)[0x7f5a2c41d152]
/usr/lib/x86_64-linux-gnu/libopenzwave.so.1.6(_ZN9OpenZWave7Manager19GetDriverStatisticsEjPNS_6Driver10DriverDataE+0xd)[0x7f5a2c42066d]
/home/nouknouk/git/domonode/plugins/zwave/node_modules/openzwave-shared/build/Release/openzwave_shared.node(_ZN3OZW3OZW19GetDriverStatisticsERKN3Nan20FunctionCallbackInfoIN2v85ValueEEE+0x64)[0x7f5a2c53f9a4]
/home/nouknouk/git/domonode/plugins/zwave/node_modules/openzwave-shared/build/Release/openzwave_shared.node(+0x1e2bc)[0x7f5a2c5342bc]
/usr/lib/x86_64-linux-gnu/libnode.so.64(_ZN2v88internal25FunctionCallbackArguments4CallEPNS0_15CallHandlerInfoE+0x1ba)[0x7f5a3387f2da]
/usr/lib/x86_64-linux-gnu/libnode.so.64(+0x7e17f0)[0x7f5a3387f7f0]
/usr/lib/x86_64-linux-gnu/libnode.so.64(+0x7e24ca)[0x7f5a338804ca]
[0x26d4602d452b]
Segmentation fault (core dumped)

My env:

  • x86 platforms (debian: 10.6, or debian based distributions: bullseye/sid),
  • custom build of (recent) liopenzwave 1.6.1548
  • latest version of openzwave-shared: 1.7.2 (was also the same with an earlier version of openzwave-shared).

Best regards,

And, btw, thanks again for this marvelous work 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions