RobotWebTools / rclnodejs

Node.js version of ROS 2.0 client
https://docs.ros.org/en/humble/Concepts/Basic/About-Client-Libraries.html?highlight=rclnodejs#community-maintained
Apache License 2.0
319 stars 70 forks source link

Segfault during generate_messages script #699

Closed ros2jsguy closed 4 years ago

ros2jsguy commented 4 years ago

A user reported an installation failure due to a segmentation fault. See issue #231

[3/3] ⠄ rclnodejs
[-/3] ⠄ waiting...
verbose 98.581956056 Error: /home/workspace/node_modules/rclnodejs: Command failed.
Exit code: 139
Command: node scripts/generate_messages.js
Arguments: 
Directory: /home/workspace/node_modules/rclnodejs
Output:
Start JavaScript message generation...
Generation complete.
Segmentation fault (core dumped)
    at ProcessTermError.ExtendableBuiltin (/usr/lib/node_modules/yarn/lib/cli.js:721:66)
    at ProcessTermError.MessageError (/usr/lib/node_modules/yarn/lib/cli.js:750:123)
    at new ProcessTermError (/usr/lib/node_modules/yarn/lib/cli.js:790:113)
    at ChildProcess.<anonymous> (/usr/lib/node_modules/yarn/lib/cli.js:25884:17)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1021:16)
    at Socket.<anonymous> (internal/child_process.js:443:11)
    at Socket.emit (events.js:315:20)
    at Pipe.<anonymous> (net.js:674:12)
error /home/workspace/node_modules/rclnodejs: Command failed.
Exit code: 139
Command: node scripts/generate_messages.js
Arguments: 
Directory: /home/workspace/node_modules/rclnodejs
Output:
Start JavaScript message generation...
Generation complete.

I've seen this exact problem off and on during installation on Ubuntu 16 & 20 with ROS2 dashing, eloquent and most recently foxy. I used lldb and llnode to investigate the resulting core dump but the info was minimal and did not identify any specific JS code at fault. I found that commenting out the tsd generation the error appeared much less frequent. But even with the segfault occuring the interfaces.d.ts file always generated properly. Ultimately I speculated that something is goofing up, possibly a race condition with the many sync writes, closesync() and the node process terminating on a slow linux machine. I experimented with a 500 ms delay before the process terminates and have not been able to replicate the segfault.