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

rclcpp::spin_some(node) Occasionally crash. #1524

Closed
BaiCai1990 opened this issue Jan 23, 2021 · 6 comments
Closed

rclcpp::spin_some(node) Occasionally crash. #1524

BaiCai1990 opened this issue Jan 23, 2021 · 6 comments
Assignees
Labels
bug Something isn't working more-information-needed Further information is required

Comments

@BaiCai1990
Copy link

BaiCai1990 commented Jan 23, 2021

Bug report

Required Info:

  • Operating System:
    Debian 10 buster
  • Installation type:
    from source
  • Version or commit hash:
    ref: refs/heads/master
  • DDS implementation:
    Fast-RTPS
  • Client library (if applicable):
    rclcpp

Steps to reproduce issue

--This issue is occationally occurs. Blow is the code.
rclcpp::WallRate main_loop(100);     
while(rclcpp::ok)
{
  rclcpp::spin_some(ros_node_);
  current_state = GetCurrentState();
  switch(current_state){
  case IDLE:{
    rclcpp::WallRate r(100);
    while(rclcpp::ok() && GetCurrentState() == IDLE){
    rclcpp::spin_some(ros_node_);                               //!!!!!!!!!!!!!!!!!!!!!!!! **crashed here**!!!!
    // other code
    r.sleep();
    }
    break;
  }
  case WALK:{
    rclcpp::WallRate r(100);
    while(rclcpp::ok() && GetCurrentState() == WALK){
      rclcpp::spin_some(ros_node_);
      // other code
      r.sleep();
    }
    break;
  }

  main_loop.sleep();
}

Expected behavior

run normal

Actual behavior

When state switch from WALK to IDLE, the program will occationally crash in rclcpp::spin_some()

Additional information

In WALK state the loop is time-consumming than IDLE state

#0  0x00007ffff22a2704 in eprosima::fastrtps::rtps::StatefulReader::send_acknack(eprosima::fastrtps::rtps::WriterProxy const*, eprosima::fastrtps::rtps::RTPSMessageSenderInterface const&, bool) ()
   from /opt/ros2_foxy/install/fastrtps/lib/libfastrtps.so.2
#1  0x00007ffff229fc7c in std::_Function_handler<bool (), eprosima::fastrtps::rtps::WriterProxy::WriterProxy(eprosima::fastrtps::rtps::StatefulReader*, eprosima::fastrtps::rtps::RemoteLocatorsAllocationAttributes const&, eprosima::fastrtps::ResourceLimitedContainerConfig const&)::{lambda()#1}>::_M_invoke(std::_Any_data const&) ()
   from /opt/ros2_foxy/install/fastrtps/lib/libfastrtps.so.2
#2  0x00007ffff2273080 in eprosima::fastrtps::rtps::TimedEventImpl::trigger(std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > >, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > >) ()
   from /opt/ros2_foxy/install/fastrtps/lib/libfastrtps.so.2
#3  0x00007ffff2271bbc in eprosima::fastrtps::rtps::ResourceEvent::do_timer_actions() ()
   from /opt/ros2_foxy/install/fastrtps/lib/libfastrtps.so.2
#4  0x00007ffff22720bb in eprosima::fastrtps::rtps::ResourceEvent::event_service() ()
   from /opt/ros2_foxy/install/fastrtps/lib/libfastrtps.so.2
#5  0x00007ffff67e1b2f in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff7e6dfa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
#7  0x00007ffff64c14cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
@wjwwood
Copy link
Member

wjwwood commented Jan 23, 2021

Please use the issue template:

https://raw.githubusercontent.com/ros2/rclcpp/master/.github/ISSUE_TEMPLATE.md

It should have been pre-filled into your description when creating a new issue.

Also, please provide a traceback if you can. Though not specific to rclcpp the ROS Nav2 project has a nice tutorial for how to get this:

https://navigation.ros.org/tutorials/docs/get_backtrace.html

I'll close this until it's fixed up. Please feel free to edit it or comment here, and I can reopen it in the future.

@wjwwood wjwwood closed this as completed Jan 23, 2021
@wjwwood wjwwood added bug Something isn't working more-information-needed Further information is required labels Jan 23, 2021
@BaiCai1990
Copy link
Author

Done.
Thinks for your attention.

@wjwwood wjwwood reopened this Jan 25, 2021
@wjwwood wjwwood removed the more-information-needed Further information is required label Jan 25, 2021
@clalancette
Copy link
Contributor

@BaiCai1990 The information provided is more helpful (it shows us that it is down in the Fast-RTPS layer). But it is much easier for us to debug if you can provide a completely compiling, working example. Could you please do that so we can try to assign it to the right people?

@clalancette clalancette added the more-information-needed Further information is required label Feb 11, 2021
@ivanpauno
Copy link
Member

@BaiCai1990 please also provide a multithreaded traceback (thread apply all bt in gdb), and what exactly was the error message and return code when crashing.

@DensoADAS
Copy link
Contributor

perhaps this is related to #1632 ?
I had at least a similar issue and solved it for me like this

@clalancette
Copy link
Contributor

No response in almost a year, so closing. Please feel free to provide the requested information and reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working more-information-needed Further information is required
Projects
None yet
Development

No branches or pull requests

5 participants