Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait Set Index Too Big #1381

Open
gkuppa24 opened this issue Nov 26, 2024 · 4 comments
Open

Wait Set Index Too Big #1381

gkuppa24 opened this issue Nov 26, 2024 · 4 comments

Comments

@gkuppa24
Copy link

Bug report

Required Info:

  • Operating System:
    • Ubuntu 22.04
  • Installation type:
    • binaries
  • Version or commit hash: Humble
  • DDS implementation: cyclone_dds
  • Client library (if applicable): rclpy

Steps to reproduce issue

Traceback (most recent call last):
  File "/home/gauravkuppa24/.cache/bazel/_bazel_gauravkuppa24/0f5b194a5c00fda748ae81b2326da879/execroot/baserepo4/bazel-out/k8-fastbuild/bin/robot/task/task_manager/launch_high_level_planner/launch_high_level_planner.runfiles/baserepo4/robot/hardware/easo/lib/single_arm_node.py", line 659, in request_collision_cuboid_update
    self.executor.spin_until_future_complete(self.future,
  File "/home/gauravkuppa24/.cache/bazel/_bazel_gauravkuppa24/0f5b194a5c00fda748ae81b2326da879/execroot/baserepo4/bazel-out/k8-fastbuild/bin/robot/task/task_manager/launch_high_level_planner/launch_high_level_planner.runfiles/baserepo4/external/ros2_rclpy/rclpy/rclpy/executors.py", line 310, in spin_until_future_complete
    self.spin_once_until_future_complete(future, timeout_left)
  File "/home/gauravkuppa24/.cache/bazel/_bazel_gauravkuppa24/0f5b194a5c00fda748ae81b2326da879/execroot/baserepo4/bazel-out/k8-fastbuild/bin/robot/task/task_manager/launch_high_level_planner/launch_high_level_planner.runfiles/baserepo4/external/ros2_rclpy/rclpy/rclpy/executors.py", line 801, in spin_once_until_future_complete
    self._spin_once_impl(timeout_sec, future.done)
  File "/home/gauravkuppa24/.cache/bazel/_bazel_gauravkuppa24/0f5b194a5c00fda748ae81b2326da879/execroot/baserepo4/bazel-out/k8-fastbuild/bin/robot/task/task_manager/launch_high_level_planner/launch_high_level_planner.runfiles/baserepo4/external/ros2_rclpy/rclpy/rclpy/executors.py", line 775, in _spin_once_impl
    handler, entity, node = self.wait_for_ready_callbacks(
  File "/home/gauravkuppa24/.cache/bazel/_bazel_gauravkuppa24/0f5b194a5c00fda748ae81b2326da879/execroot/baserepo4/bazel-out/k8-fastbuild/bin/robot/task/task_manager/launch_high_level_planner/launch_high_level_planner.runfiles/baserepo4/external/ros2_rclpy/rclpy/rclpy/executors.py", line 711, in wait_for_ready_callbacks
    return next(self._cb_iter)
  File "/home/gauravkuppa24/.cache/bazel/_bazel_gauravkuppa24/0f5b194a5c00fda748ae81b2326da879/execroot/baserepo4/bazel-out/k8-fastbuild/bin/robot/task/task_manager/launch_high_level_planner/launch_high_level_planner.runfiles/baserepo4/external/ros2_rclpy/rclpy/rclpy/executors.py", line 630, in _wait_for_ready_callbacks
    if wt in waitables and wt.is_ready(wait_set):
  File "/home/gauravkuppa24/.cache/bazel/_bazel_gauravkuppa24/0f5b194a5c00fda748ae81b2326da879/execroot/baserepo4/bazel-out/k8-fastbuild/bin/robot/task/task_manager/launch_high_level_planner/launch_high_level_planner.runfiles/ros2_rclpy/rclpy/rclpy/qos_event.py", line 90, in is_ready
    if wait_set.is_ready('event', self._event_index):
IndexError: wait set index too big

Expected behavior

Actual behavior

Additional information

I cannot provide the code I am using to allow you to reproduce this bug, but it is a rclpy process that has a single MultiThreadedExecutor. The executor spins three nodes, and always gets hung up on this self.executor.spin_until_future_complete(self.future) with a wait set index bug.

Any advice on how to approach this problem would be much appreciated.


Feature request

Feature description

Implementation considerations

@Barry-Xu-2018
Copy link
Contributor

Could you try using FastDDS (instead of cyclone_dds) to check if the problem still occurs in your environment ?

@gkuppa24
Copy link
Author

gkuppa24 commented Nov 26, 2024

Sure. I can give this a shot. Would service call would cause a QoS event added to the wait set? This seems to be the source of the bug.

@gkuppa24
Copy link
Author

Neither cyclone_dds or fastrtps_cpp works.

@Barry-Xu-2018
Copy link
Contributor

Barry-Xu-2018 commented Nov 27, 2024

Sure. I can give this a shot. Would service call would cause a QoS event added to the wait set? This seems to be the source of the bug.

While creating publisher and subscription, you can set event_callbacks.

BTW, how did you determine it's related to the QoS Event?
Did you confirm the content of entity_type is "event" when "index >= num_entities" occurs?

bool
WaitSet::is_ready(const std::string & entity_type, size_t index)
{
const void ** entities = NULL;
size_t num_entities = 0;
if ("subscription" == entity_type) {
entities = reinterpret_cast<const void **>(rcl_wait_set_->subscriptions);
num_entities = rcl_wait_set_->size_of_subscriptions;
} else if ("client" == entity_type) {
entities = reinterpret_cast<const void **>(rcl_wait_set_->clients);
num_entities = rcl_wait_set_->size_of_clients;
} else if ("service" == entity_type) {
entities = reinterpret_cast<const void **>(rcl_wait_set_->services);
num_entities = rcl_wait_set_->size_of_services;
} else if ("timer" == entity_type) {
entities = reinterpret_cast<const void **>(rcl_wait_set_->timers);
num_entities = rcl_wait_set_->size_of_timers;
} else if ("guard_condition" == entity_type) {
entities = reinterpret_cast<const void **>(rcl_wait_set_->guard_conditions);
num_entities = rcl_wait_set_->size_of_guard_conditions;
} else if ("event" == entity_type) {
entities = reinterpret_cast<const void **>(rcl_wait_set_->events);
num_entities = rcl_wait_set_->size_of_events;
} else {
std::string error_text{"'"};
error_text += entity_type;
error_text += "' is not a known entity";
throw std::runtime_error(error_text);
}
if (!entities) {
std::string error_text{"wait set '"};
error_text += entity_type;
error_text += "' isn't allocated";
throw std::runtime_error(error_text);
}
if (index >= num_entities) {
throw std::out_of_range("wait set index too big");
}
return nullptr != entities[index];
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants