ZettaScaleLabs / rmw_zenoh

RMW for ROS 2 using Zenoh as the middleware
Apache License 2.0
0 stars 0 forks source link

`z_bytes_serialize_from_slice` without `_copy` can cause ROS message deserialization error #1

Closed YuanYuYuan closed 3 months ago

YuanYuYuan commented 3 months ago
2024-07-22T09:48:49.916272Z  INFO ThreadId(02) zenoh::net::runtime: Using ZID: e268ee4e23047b92ed44ee40179000e4
2024-07-22T09:48:49.917845Z  INFO ThreadId(02) zenoh::net::runtime::orchestrator: Zenoh can be reached at: tcp/[::1]:35841
2024-07-22T09:48:49.920066Z  WARN ThreadId(02) zenoh::net::runtime::orchestrator: Scouting delay elapsed before start conditions are met.
[INFO] [rmw_zenoh_cpp]: Successfully connected to a Zenoh router with id 57933e70549d7a6da94aa75db9c15bed. (operator()() at 35)
2024-07-22T09:48:49.916393Z  INFO ThreadId(02) zenoh::net::runtime: Using ZID: cb659f876a513e8c57113607e3765f6d
2024-07-22T09:48:49.917845Z  INFO ThreadId(02) zenoh::net::runtime::orchestrator: Zenoh can be reached at: tcp/[::1]:33501
2024-07-22T09:48:49.920074Z  WARN ThreadId(02) zenoh::net::runtime::orchestrator: Scouting delay elapsed before start conditions are met.
[ERROR] [rmw_zenoh_cpp]: Unable to connect to a Zenoh router. Have you started a router with `ros2 run rmw_zenoh_cpp rmw_zenohd`? (zenoh_router_check() at 53)
[INFO] [rmw_zenoh_cpp]: Successfully connected to a Zenoh router with id 57933e70549d7a6da94aa75db9c15bed. (zenoh_router_check() at 53)

>>> [rcutils|error_handling.c:108] rcutils_set_error_state()
This error state is being overwritten:

  'Fast CDR exception deserializing message of type rcl_interfaces::msg::dds_::ParameterEvent_., at /workspace/src/rmw_zenoh/rmw_zenoh_cpp/src/detail/type_support.cpp:133'

with this new error message:

  'could not deserialize ROS message, at /workspace/src/rmw_zenoh/rmw_zenoh_cpp/src/rmw_zenoh.cpp:1690'

rcutils_reset_error() should be called after error handling to avoid this.
<<<
[ERROR] [rclcpp]: executor taking a message from topic '/parameter_events' unexpectedly failed: could not deserialize ROS message, at /workspace/src/rmw_zenoh/rmw_zenoh_cpp/src/rmw_zenoh.cpp:1690, at ./src/rcl/subscription.c:562 (take_and_do_error_handling() at 501)

>>> [rcutils|error_handling.c:108] rcutils_set_error_state()
This error state is being overwritten:

  'Fast CDR exception deserializing message of type rcl_interfaces::msg::dds_::ParameterEvent_., at /workspace/src/rmw_zenoh/rmw_zenoh_cpp/src/detail/type_support.cpp:133'

with this new error message:

  'could not deserialize ROS message, at /workspace/src/rmw_zenoh/rmw_zenoh_cpp/src/rmw_zenoh.cpp:1690'

rcutils_reset_error() should be called after error handling to avoid this.
<<<
[ERROR] [rclcpp]: executor taking a message from topic '/parameter_events' unexpectedly failed: could not deserialize ROS message, at /workspace/src/rmw_zenoh/rmw_zenoh_cpp/src/rmw_zenoh.cpp:1690, at ./src/rcl/subscription.c:562 (take_and_do_error_handling() at 501)

>>> [rcutils|error_handling.c:108] rcutils_set_error_state()
This error state is being overwritten:

  'Fast CDR exception deserializing message of type rcl_interfaces::msg::dds_::ParameterEvent_., at /workspace/src/rmw_zenoh/rmw_zenoh_cpp/src/detail/type_support.cpp:133'

with this new error message:

  'could not deserialize ROS message, at /workspace/src/rmw_zenoh/rmw_zenoh_cpp/src/rmw_zenoh.cpp:1690'

rcutils_reset_error() should be called after error handling to avoid this.
<<<
[ERROR] [rclcpp]: executor taking a message from topic '/parameter_events' unexpectedly failed: could not deserialize ROS message, at /workspace/src/rmw_zenoh/rmw_zenoh_cpp/src/rmw_zenoh.cpp:1690, at ./src/rcl/subscription.c:562 (take_and_do_error_handling() at 501)

>>> [rcutils|error_handling.c:108] rcutils_set_error_state()
This error state is being overwritten:

  'Fast CDR exception deserializing message of type rcl_interfaces::msg::dds_::ParameterEvent_., at /workspace/src/rmw_zenoh/rmw_zenoh_cpp/src/detail/type_support.cpp:133'

with this new error message:

  'could not deserialize ROS message, at /workspace/src/rmw_zenoh/rmw_zenoh_cpp/src/rmw_zenoh.cpp:1690'

rcutils_reset_error() should be called after error handling to avoid this.
<<<
[ERROR] [rclcpp]: executor taking a message from topic '/parameter_events' unexpectedly failed: could not deserialize ROS message, at /workspace/src/rmw_zenoh/rmw_zenoh_cpp/src/rmw_zenoh.cpp:1690, at ./src/rcl/subscription.c:562 (take_and_do_error_handling() at 501)

>>> [rcutils|error_handling.c:108] rcutils_set_error_state()
This error state is being overwritten:

  'Fast CDR exception deserializing message of type rcl_interfaces::msg::dds_::ParameterEvent_., at /workspace/src/rmw_zenoh/rmw_zenoh_cpp/src/detail/type_support.cpp:133'

with this new error message:

  'could not deserialize ROS message, at /workspace/src/rmw_zenoh/rmw_zenoh_cpp/src/rmw_zenoh.cpp:1690'

rcutils_reset_error() should be called after error handling to avoid this.
<<<
[ERROR] [rclcpp]: executor taking a message from topic '/parameter_events' unexpectedly failed: could not deserialize ROS message, at /workspace/src/rmw_zenoh/rmw_zenoh_cpp/src/rmw_zenoh.cpp:1690, at ./src/rcl/subscription.c:562 (take_and_do_error_handling() at 501)
^C%
YuanYuYuan commented 3 months ago

It turns out that the non-copy version fails due to in-memory data transmission between nodes in the same zenoh session. This issue has been solved since the serialization from a buffer is enforced as a copy now.