subscriber crashed when deserialize msg which is send by foxglove_bridge through loaned api
sgf201 opened this issue · 1 comments
Operating system:
Ubuntu 20.04 LTS
Compiler version:
GCC 9.4.0
Eclipse iceoryx version:
2.0.3
rmw_cyclonedds version:
1.3.4
cyclonedds version:
0.10.3
Observed result or behaviour:
loaned api deserialize crash
turn off loaned api it worked
[decodec-1] eclipse-iceoryx/iceoryx#12 Object "/home/admin/5v5r/fsinstall/nov_codec/lib/nov_codec/decodec", at 0xaaaae95184e3, in
[decodec-1] eclipse-iceoryx/iceoryx#11 Object "/lib/aarch64-linux-gnu/libc.so.6", at 0xffff823bfe0f, in __libc_start_main
[decodec-1] eclipse-iceoryx/iceoryx#10 Object "/home/admin/5v5r/fsinstall/nov_codec/lib/nov_codec/decodec", at 0xaaaae9518b57, in main
[decodec-1] eclipse-iceoryx/iceoryx#9 Object "/opt/nros/lib/librclcpp.so", at 0xffff828fad83, in rclcpp::executors::SingleThreadedExecutor::spin()
[decodec-1] eclipse-iceoryx/iceoryx#8 Object "/opt/nros/lib/librclcpp.so", at 0xffff828f42fb, in rclcpp::Executor::execute_any_executable(rclcpp::AnyExecutable&)
[decodec-1] eclipse-iceoryx/iceoryx#7 Object "/opt/nros/lib/librclcpp.so", at 0xffff828f2fcb, in rclcpp::Executor::execute_subscription(std::shared_ptrrclcpp::SubscriptionBase)
[decodec-1] eclipse-iceoryx/iceoryx#6 Object "/opt/nros/lib/librclcpp.so", at 0xffff828f208b, in
[decodec-1] eclipse-iceoryx/iceoryx#5 Object "/opt/nros/lib/librclcpp.so", at 0xffff828f1ee3, in
[decodec-1] eclipse-iceoryx/iceoryx#4 Object "/opt/nros/lib/librcl.so", at 0xffff8233183b, in rcl_take_loaned_message
[decodec-1] eclipse-iceoryx/iceoryx#3 Object "/opt/nros/lib/librmw_cyclonedds_cpp.so", at 0xffff81f7bcd3, in
[decodec-1] eclipse-iceoryx/iceoryx#2 Object "/opt/nros/lib/librmw_cyclonedds_cpp.so", at 0xffff81f7b5a7, in rmw_deserialize
[decodec-1] eclipse-iceoryx/iceoryx#1 Object "/opt/nros/lib/librmw_cyclonedds_cpp.so", at 0xffff81f88b07, in
[decodec-1] #0 Object "/opt/nros/lib/librmw_cyclonedds_cpp.so", at 0xffff81f88a84, in
[decodec-1] Segmentation fault (Address not mapped to object [(nil)])
Expected result or behaviour:
What do you expect to happen?
worked
Conditions where it occurred / Performed steps:
Describe how one can reproduce the bug.
code in foxglove_bridge
// Copy the message payload into a SerializedMessage object
rclcpp::SerializedMessage serializedMessage{message.getLength()};
auto& rclSerializedMsg = serializedMessage.get_rcl_serialized_message();
std::memcpy(rclSerializedMsg.buffer, message.getData(), message.getLength());
rclSerializedMsg.buffer_length = message.getLength();
// Publish the message
publisher->publish(serializedMessage);
root cause found,The loan API actually affects the way some APIs are used in ROS2, and developers who implement it at a slightly lower level need to handle it carefully
foxglove/ros-foxglove-bridge#280