Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Segfault at: spin_until_future_complete #192

Description

@firesurfer

Short description of my program:
static method A: gets a node passed, accesses a parameter server via an AsyncParametersClient
returns some information gained from the parameter server

static method B:gets a node passed: accesses a service that is hosted somewhere.
returns some information gained from the service

Both methods have somewhere a call to rclcpp::spin_until_future_complete.

Example:
When I call method A, A returns succesfully.
When I call method B, B will give me a segfault

Everytime I'm using a the service call in a static method (that succeeds), I cant do a second service call or a call to a parameter server because of a segfault at: rclcpp::spin_until_future_complete

gdb Backtrace:

#0  0x00000000006747b8 in std::__shared_ptr<std::__future_base::_State_baseV2, (__gnu_cxx::_Lock_policy)2>::operator-> (this=0x0) at /usr/include/c++/5/bits/shared_ptr_base.h:1055
#1  0x00007ffff201e263 in std::promise<std::shared_ptr<rcl_interfaces::srv::GetParameters_Response_<std::allocator<void> > > >::set_value(std::shared_ptr<rcl_interfaces::srv::GetParameters_Response_<std::allocator<void> > > const&) () from /home/firesurfer/workspace/ros2_ws/install/lib/librclcpp.so
#2  0x00007ffff201cfbb in rclcpp::client::Client<rcl_interfaces::srv::GetParameters>::handle_response(std::shared_ptr<void>&, std::shared_ptr<void>&) ()
   from /home/firesurfer/workspace/ros2_ws/install/lib/librclcpp.so
#3  0x00007ffff1fcc7f6 in rclcpp::executor::Executor::execute_client(std::shared_ptr<rclcpp::client::ClientBase>) () from /home/firesurfer/workspace/ros2_ws/install/lib/librclcpp.so
#4  0x00007ffff1fcc193 in rclcpp::executor::Executor::execute_any_executable(std::shared_ptr<rclcpp::executor::AnyExecutable>) () from /home/firesurfer/workspace/ros2_ws/install/lib/librclcpp.so
#5  0x00007ffff1fcbdf9 in rclcpp::executor::Executor::spin_once(std::chrono::duration<long, std::ratio<1l, 1000000000l> >) () from /home/firesurfer/workspace/ros2_ws/install/lib/librclcpp.so
#6  0x000000000069d5a1 in rclcpp::executor::Executor::spin_until_future_complete<std::shared_ptr<ros2_components_msg::srv::ListChilds_Response_<std::allocator<void> > >, std::ratio<1l, 1000l> > (
    this=0x7fffffffd3f0, future=..., timeout=...) at /home/firesurfer/workspace/ros2_ws/install/include/rclcpp/executor.hpp:184
#7  0x000000000068c94d in rclcpp::executors::spin_node_until_future_complete<std::shared_ptr<ros2_components_msg::srv::ListChilds_Response_<std::allocator<void> > >, std::ratio<1l, 1000l> > (executor=..., 
    node_ptr=std::shared_ptr (count 12, weak 1) 0x974440, future=..., timeout=...) at /home/firesurfer/workspace/ros2_ws/install/include/rclcpp/executors.hpp:67
#8  0x0000000000679fe9 in rclcpp::spin_until_future_complete<std::shared_ptr<ros2_components_msg::srv::ListChilds_Response_<std::allocator<void> > >, std::ratio<1l, 1000l> > (
    node_ptr=std::shared_ptr (count 12, weak 1) 0x974440, future=..., timeout=...) at /home/firesurfer/workspace/ros2_ws/install/include/rclcpp/executors.hpp:81

gdb output:

Program received signal SIGSEGV, Segmentation fault.
0x00000000006747b8 in std::__shared_ptr<std::__future_base::_State_baseV2, (__gnu_cxx::_Lock_policy)2>::operator-> (this=0x0) at /usr/include/c++/5/bits/shared_ptr_base.h:1055
1055        return _M_ptr;

Edit: Some further research showed that this behavior occurs every time I create a Client and destroy it. When I'm creating a new client afterwards and want to use it, I get a segfault

Edit2: After digging in the ros2 code I think the solution might be to tell the executor that a certain client doenst exist anymore

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions