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

Getting a Fatal Error when Working with Large Messages #694

Closed caelinsutch closed 4 years ago

caelinsutch commented 4 years ago

After calling a service to get two large map arrays, I get the following fatal error on some (low compute) machines. Any advice on how to get past this?

#
# Fatal error in , line 0
# Check failed: length == backing_store->byte_length().
#
#
#
#FailureMessage Object: 0x7fcd01b8d0
 1: 0xa57754  [node]
 2: 0x185cb20 V8_Fatal(char const*, ...) [node]
 3: 0xdf85e8 v8::internal::GlobalBackingStoreRegistry::Lookup(void*, unsigned long) [node]
 4: 0xb787d0  [node]
 5: 0xb789e4 v8::ArrayBuffer::New(v8::Isolate*, void*, unsigned long, v8::ArrayBufferCreationMode) [node]
 6: 0x7fa4e95194 rclnodejs::CreateArrayBufferFromAddress(Nan::FunctionCallbackInfo<v8::Value> const&) [/home/bytes/Github/satellitum/packages/robot/node_modules/rclnodejs/build/Release/rclnodejs.node]
 7: 0x7fa4e883fc  [/home/bytes/Github/satellitum/packages/robot/node_modules/rclnodejs/build/Release/rclnodejs.node]
 8: 0xbb7534  [node]
 9: 0xbb85f8  [node]
10: 0xbb8c78 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
11: 0x1329f4c  [node]
[1]    42276 trace trap (core dumped)  ts-node robot.ts

I've found this issue that looks like it might relate? I'm guessing the buffer is too small for the message, but that doesn't make sense considering it works fine on other machines...

minggangw commented 4 years ago

I've found this issue that looks like it might relate? I'm guessing the buffer is too small for the message, but that doesn't make sense considering it works fine on other machines...

It seems that we meet the same case here, using an external buffer to create an ArrayBuffer, is it reproducible stably?

caelinsutch commented 4 years ago

It seems that we meet the same case here, using an external buffer to create an ArrayBuffer, is it reproducible stably?

I'm not using a buffer on my side of things, simply copying data into an object. Running on a Jetson Nano this is reproducible. Whenever any service is called that sends a map array it spits out that error :(

caelinsutch commented 4 years ago

I'm now getting this error:

# Fatal error in , line 0
# Check failed: result.second.

Found this discussion on buffers

minggangw commented 4 years ago

It seems that this problem is not simple to be resolved and I haven't dug into it, maybe it's a hardware related issue? Anyway, we could disable the usage of TypedArray during message serialization, e.g.

https://github.com/RobotWebTools/rclnodejs/blob/b71c8eab85b23b50132bf4d78f2f16bb2b1a1cbf/test/test-disable-typedarray.js#L60-L70

The downside is that you lose the performance. please try it to see if it works.

caelinsutch commented 4 years ago

I was using Node 14, when I switched back to 12 the issue resolved itself, so this isn't necessarily a bug in the supported versions of RCLNodeJS and I've closed the issue.

minggangw commented 4 years ago

good to hear you have a workaround.