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

bad_alloc after getting goal response #2

Closed
hsd-dev opened this issue Jul 11, 2019 · 2 comments
Closed

bad_alloc after getting goal response #2

hsd-dev opened this issue Jul 11, 2019 · 2 comments

Comments

@hsd-dev
Copy link
Owner

hsd-dev commented Jul 11, 2019

For my reference: https://github.com/ipa-hsd/action_bridge/tree/dashing-devel

ros2 run --prefix=gdb action_bridge action_bridge_fibonacci_node   

GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/hsd/dev/bridge_ws/install/action_bridge/lib/action_bridge/action_bridge_fibonacci_node...(no debugging symbols found)...done.
(gdb) run
Starting program: /home/hsd/dev/bridge_ws/install/action_bridge/lib/action_bridge/action_bridge_fibonacci_node 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffed9b3700 (LWP 537)]
[New Thread 0x7fffed1b2700 (LWP 538)]
[New Thread 0x7fffec9b1700 (LWP 539)]
[New Thread 0x7fffe7fff700 (LWP 540)]
[New Thread 0x7fffe5c7b700 (LWP 541)]
[New Thread 0x7fffe547a700 (LWP 542)]
[New Thread 0x7fffe4c79700 (LWP 543)]
[New Thread 0x7fffd7fff700 (LWP 544)]
[New Thread 0x7fffd77fe700 (LWP 545)]
[New Thread 0x7fffd6ffd700 (LWP 546)]
[New Thread 0x7fffd63de700 (LWP 547)]
[New Thread 0x7fffd55cb700 (LWP 548)]
[New Thread 0x7fffd4dca700 (LWP 549)]
[New Thread 0x7fffbffff700 (LWP 550)]
[New Thread 0x7fffbf7fe700 (LWP 551)]
[INFO] [action_bridge_fibonacci]: Sending goal
[New Thread 0x7fffbeffd700 (LWP 568)]
[New Thread 0x7fffbe7fc700 (LWP 569)]
goal accepted
[Thread 0x7fffbeffd700 (LWP 568) exited]
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

Thread 1 "action_bridge_f" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6)
    at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff5698801 in __GI_abort () at abort.c:79
#2  0x00007ffff5ced957 in ?? ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff5cf3ab6 in ?? ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff5cf3af1 in std::terminate() ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff5cf3d24 in __cxa_throw ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff5cf429c in operator new(unsigned long) ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x00007ffff5d85bc7 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
---Type <return> to continue, or q <return> to quit---
#8  0x00007ffff5d85f19 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#9  0x000055555557f45f in actionlib_msgs::GoalID_<std::allocator<void> >::operator=(actionlib_msgs::GoalID_<std::allocator<void> > const&) ()
#10 0x000055555557f489 in actionlib_msgs::GoalStatus_<std::allocator<void> >::operator=(actionlib_msgs::GoalStatus_<std::allocator<void> > const&) ()
#11 0x00005555555aa90e in actionlib::ActionServer<actionlib_tutorials::FibonacciAction_<std::allocator<void> > >::publishFeedback(actionlib_msgs::GoalStatus_<std::allocator<void> > const&, actionlib_tutorials::FibonacciFeedback_<std::allocator<void> > const&) ()
#12 0x0000555555583508 in actionlib::ServerGoalHandle<actionlib_tutorials::FibonacciAction_<std::allocator<void> > >::publishFeedback(actionlib_tutorials::FibonacciFeedback_<std::allocator<void> > const&) ()
#13 0x000055555557d5bd in ActionBridge<actionlib_tutorials::FibonacciAction_<std::allocator<void> >, example_interfaces::action::Fibonacci>::GoalHandler::handle()::{lambda(std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >, auto:1)#2}::operator()<std::shared_ptr<example_interfaces::action::Fibonacci_Feedback_<std::allocator<void> > const> > ()
#14 0x0000555555591e9f in std::_Function_handler<void (std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >, std::shared_ptr<example_interfaces::action::Fibonacci_Feedback_<std::allocator<void> > const>), ActionBridge<actionlib_tutorials::FibonacciAction_<std::allocator<void> >, example_interfaces::action::Fibonacci>::GoalHandler::handle()::{lambda(std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >, auto:1)#2}>::_M_invoke(std::_Any_data const&, std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >&&, std::shared_ptr<example_interfaces::action::Fibonacci_Feedback_<std::allocator<void> > const>&&) ()
#15 0x00005555555afb7d in std::function<void (std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >, std::shared_ptr<example_interfaces::action::Fibonacci_Feedback_<std::allocator<void> > const>)>::operator()(std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >, std::shared_ptr<example_interfaces::action::Fibonacci_Feedback_<std::allocator<void> > const>) const ()
#16 0x00005555555acac9 in rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci>::call_feedback_callback(std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >, std::shared_ptr<example_interfaces::action::Fibonacci_Feedback_<std::allocator<void> > const>) ()
#17 0x00005555555a9e64 in rclcpp_action::Client<example_interfaces::action::Fibonacci>::handle_feedback_message(std::shared_ptr<void>) ()
#18 0x00007ffff696403f in rclcpp_action::ClientBase::execute() () from /opt/ros/dashing/lib/librclcpp_action.so
#19 0x00007ffff669cc7f in rclcpp::executor::Executor::execute_any_executable(rclcpp::executor::AnyExecutable&) ()
   from /opt/ros/dashing/lib/librclcpp.so
#20 0x00007ffff66a2f2f in rclcpp::executors::SingleThreadedExecutor::spin() () from /opt/ros/dashing/lib/librclcpp.so
#21 0x00007ffff669fc32 in rclcpp::spin(std::shared_ptr<rclcpp::node_interfaces::NodeBaseInterface>) () from /opt/ros/dashing/lib/librclcpp.so
#22 0x00007ffff669feeb in rclcpp::spin(std::shared_ptr<rclcpp::Node>) () from /opt/ros/dashing/lib/librclcpp.so
#23 0x00005555555747ce in ActionBridge<actionlib_tutorials::FibonacciAction_<std::allocator<void> >, example_interfaces::action::Fibonacci>::main(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, char**) ()
#24 0x000055555556d093 in main ()

On the ROS1 action client side, I get:

$ rosrun actionlib_tutorials fibonacci_client
[ INFO] [1562932615.221419967]: Waiting for action server to start.
[ INFO] [1562932615.608441769]: Action server started, sending goal.
[ WARN] [1562932621.009234296]: Transitioning goal to LOST
[ INFO] [1562932621.009466688]: Action finished: LOST
@hsd-dev
Copy link
Owner Author

hsd-dev commented Jul 12, 2019

I guess these 2 lines made the goal handle go out of scope:
https://github.com/ipa-hsd/action_bridge/blob/2b7e4d5a27d4774e9129ed8172461672df9cc3ce/include/action_bridge/action_bridge.hpp#L197-L201

Now changed that to:
https://github.com/ipa-hsd/action_bridge/blob/9145a1ad9717f24acf36bd24f20b1e33e6dc8a16/include/action_bridge/action_bridge.hpp#L195-L200

Now on the ROS1 action client side, I get:

$ rosrun actionlib_tutorials fibonacci_client
[ INFO] [1562934360.270788181]: Waiting for action server to start.
[ INFO] [1562934360.629783900]: Action server started, sending goal.
[ INFO] [1562934379.633558543]: Action finished: SUCCEEDED

But,

Starting program: /home/hsd/dev/bridge_ws/install/action_bridge/lib/action_bridge/action_bridge_fibonacci_node 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffed9b3700 (LWP 19173)]
[New Thread 0x7fffed1b2700 (LWP 19174)]
[New Thread 0x7fffec9b1700 (LWP 19175)]
[New Thread 0x7fffe7fff700 (LWP 19176)]
[New Thread 0x7fffe5c7b700 (LWP 19177)]
[New Thread 0x7fffe547a700 (LWP 19178)]
[New Thread 0x7fffe4c79700 (LWP 19179)]
[New Thread 0x7fffd7fff700 (LWP 19181)]
[New Thread 0x7fffd77fe700 (LWP 19182)]
[New Thread 0x7fffd6ffd700 (LWP 19183)]
[New Thread 0x7fffd63de700 (LWP 19184)]
[New Thread 0x7fffd55cb700 (LWP 19185)]
[New Thread 0x7fffd4dca700 (LWP 19186)]
[New Thread 0x7fffbffff700 (LWP 19187)]
[New Thread 0x7fffb7fff700 (LWP 19188)]
[INFO] [action_bridge_fibonacci]: Sending goal
[New Thread 0x7fffbf7fe700 (LWP 19206)]
[New Thread 0x7fffbeffd700 (LWP 19207)]
[Thread 0x7fffbf7fe700 (LWP 19206) exited]
terminate called after throwing an instance of 'std::future_error'
  what():  std::future_error: Promise already satisfied

Thread 1 "action_bridge_f" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff5698801 in __GI_abort () at abort.c:79
#2  0x00007ffff5ced957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff5cf3ab6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff5cf3af1 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff5cf3d24 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff5cef929 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x0000555555570ef6 in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) (
    this=0x7fffcc001090, __res=..., __ignore_failure=false) at /usr/include/c++/7/future:408
#8  0x0000555555597dc7 in std::promise<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci>::WrappedResult>::set_value (this=0x555556217fe8, __r=...) at /usr/include/c++/7/future:1110
#9  0x000055555559348f in rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci>::set_result (this=0x555556217fc0, wrapped_result=...)
    at /opt/ros/dashing/include/rclcpp_action/client_goal_handle_impl.hpp:75
#10 0x000055555558d41c in rclcpp_action::Client<example_interfaces::action::Fibonacci>::make_result_aware(std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >)::{lambda(std::shared_ptr<void>)#1}::operator()(std::shared_ptr<void>) (__closure=0x555556218210, 
    response=std::shared_ptr<void> (use count 4, weak count 0) = {...})
    at /opt/ros/dashing/include/rclcpp_action/client.hpp:613
#11 0x000055555559803c in std::_Function_handler<void (std::shared_ptr<void>), rclcpp_action::Client<example_interfaces::action::Fibonacci>::make_result_aware(std::shared_ptr<rclcpp_action::ClientGoalHandle<example_interfaces::action::Fibonacci> >)::{lambda(std::shared_ptr<void>)#1}>::_M_invoke(std::_Any_data const&, std::shared_ptr<void>&&) (__functor=..., __args#0=...)
    at /usr/include/c++/7/bits/std_function.h:316
#12 0x00007ffff69659ee in rclcpp_action::ClientBase::handle_result_response(rmw_request_id_t const&, std::shared_ptr<void>) () from /opt/ros/dashing/lib/librclcpp_action.so
#13 0x00007ffff69640c5 in rclcpp_action::ClientBase::execute() ()
   from /opt/ros/dashing/lib/librclcpp_action.so
---Type <return> to continue, or q <return> to quit---
#14 0x00007ffff669cc7f in rclcpp::executor::Executor::execute_any_executable(rclcpp::executor::AnyExecutable&) () from /opt/ros/dashing/lib/librclcpp.so
#15 0x00007ffff66a2f2f in rclcpp::executors::SingleThreadedExecutor::spin() () from /opt/ros/dashing/lib/librclcpp.so
#16 0x00007ffff669fc32 in rclcpp::spin(std::shared_ptr<rclcpp::node_interfaces::NodeBaseInterface>) () from /opt/ros/dashing/lib/librclcpp.so
#17 0x00007ffff669feeb in rclcpp::spin(std::shared_ptr<rclcpp::Node>) () from /opt/ros/dashing/lib/librclcpp.so
#18 0x00005555555747ce in ActionBridge<actionlib_tutorials::FibonacciAction_<std::allocator<void> >, example_interfaces::action::Fibonacci>::main (action_name="fibonacci", argc=1, argv=0x7fffffffd9d8)
    at /home/hsd/dev/bridge_ws/src/action_bridge/include/action_bridge/action_bridge.hpp:108
#19 0x000055555556d093 in main (argc=1, argv=0x7fffffffd9d8) at /home/hsd/dev/bridge_ws/src/action_bridge/src/action_bridge_fibonacci.cpp:56

Maybe should use:
https://github.com/ros2/rclcpp/blob/bfee90ab7a210657e1dc02c6b7754eb917687513/rclcpp_action/test/test_client.cpp#L447 ?

@hsd-dev
Copy link
Owner Author

hsd-dev commented Aug 22, 2019

Should be fixed as per ros2/rclcpp#783 (comment)
Will check after changes are released.

@hsd-dev hsd-dev closed this as completed Aug 22, 2019
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

1 participant