ika-rwth-aachen / mqtt_client

ROS / ROS 2 C++ Node for bi-directionally bridging messages between ROS and MQTT
MIT License
195 stars 42 forks source link

mqtt_client Crashes with Serialization Errors and Fails to Connect to Broker in ROS 2 #66

Open ge97yib opened 5 months ago

ge97yib commented 5 months ago

- Our docker environment

Distributor ID: Ubuntu Description: Ubuntu 22.04.4 LTS Release: 22.04 Codename: jammy

- Upon launching, I received the same output with your example

[WARN] [1718284220.913448933] [mqtt_client]: Parameter 'broker.tls.enabled' not set, defaulting to '0'
...
[WARN] [1718284220.913723206] [mqtt_client]: Parameter 'client.max_inflight' not set, defaulting to '65535'
[INFO] [1718284220.915197966] [mqtt_client]: Connecting to broker at 'tcp://localhost:1883' ...
[INFO] [1718284220.916620694] [mqtt_client]: Connected to broker at 'tcp://localhost:1883'

- However, the following errors led to process termination:


[mqtt_client-1] >>> [rcutils|error_handling.c:108] rcutils_set_error_state()
[mqtt_client-1] This error state is being overwritten:
[mqtt_client-1] 
[mqtt_client-1]   'Handle's typesupport identifier (rosidl_typesupport_cpp) is not supported by this library, at ./src/type_support_dispatch.hpp:111'
[mqtt_client-1] 
[mqtt_client-1] with this new error message:
[mqtt_client-1] 
[mqtt_client-1]   'Fast CDR exception deserializing message of type mqtt_client_interfaces::msg::dds_::RosMsgType_., at ./src/type_support_common.cpp:118'
[mqtt_client-1] 
[mqtt_client-1] rcutils_reset_error() should be called after error handling to avoid this.
[mqtt_client-1] <<<
[mqtt_client-1] terminate called after throwing an instance of 'rclcpp::exceptions::RCLError'
[mqtt_client-1]   what():  Failed to deserialize ROS message.: Fast CDR exception deserializing message of type mqtt_client_interfaces::msg::dds_::RosMsgType_., at ./src/type_support_common.cpp:118
[ERROR] [mqtt_client-1]: process has died [pid 439, exit code -6, cmd '/opt/ros/humble/lib/mqtt_client/mqtt_client --ros-args -r __node:=mqtt_client -r __ns:=/ --params-file /opt/ros/humble/share/mqtt_client/config/params.ros2.yaml'].

- When we try to run:"docker run --rm -it --net=host ghcr.io/ika-rwth-aachen/mqtt_client:ros2", we got similar error:

[mqtt_client-1] [INFO] [1718285748.276804192] [mqtt_client]: Connecting to broker at 'tcp://localhost:1883' ...
[mqtt_client-1] [INFO] [1718285748.378020076] [mqtt_client]: Connected to broker at 'tcp://localhost:1883'
[mqtt_client-1] [INFO] [1718285748.378163469] [mqtt_client]: Subscribed MQTT topic 'mqtt_client/ros_msg_type/pingpong/ros'
[mqtt_client-1] 
[mqtt_client-1] >>> [rcutils|error_handling.c:108] rcutils_set_error_state()
[mqtt_client-1] This error state is being overwritten:
[mqtt_client-1] 
[mqtt_client-1]   'Handle's typesupport identifier (rosidl_typesupport_cpp) is not supported by this library, at ./src/type_support_dispatch.hpp:111'
[mqtt_client-1] 
[mqtt_client-1] with this new error message:
[mqtt_client-1] 
[mqtt_client-1]   'rmw_serialize: invalid data size, at ./src/rmw_node.cpp:1727'
[mqtt_client-1] 
[mqtt_client-1] rcutils_reset_error() should be called after error handling to avoid this.
[mqtt_client-1] <<<
[mqtt_client-1] terminate called after throwing an instance of 'rclcpp::exceptions::RCLError'
[mqtt_client-1]   what():  Failed to deserialize ROS message.: rmw_serialize: invalid data size, at ./src/rmw_node.cpp:1727
[ERROR] [mqtt_client-1]: process has died [pid 53, exit code -6, cmd '/docker-ros/ws/install/mqtt_client/lib/mqtt_client/mqtt_client --ros-args -r __node:=mqtt_client -r __ns:=/ --params-file /docker-ros/ws/install/mqtt_client/share/mqtt_client/config/params.ros2.yaml'].

- We have successfully utilized ROS 1, where everything functions correctly, including the ability to switch between different message types within std_msgs.

Could you please give me some hints or suggestions on how to resolve this issue?

lreiher commented 5 months ago

Please share your exact setup. What is your config? How do you publish messages?