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

feat: backwardcpp test #6796

Closed
wants to merge 3 commits into from
Closed

feat: backwardcpp test #6796

wants to merge 3 commits into from

Conversation

xmfcx
Copy link
Contributor

@xmfcx xmfcx commented Apr 11, 2024

Description

This is for demonstration of backward-cpp with backward_ros package with autoware.

Also recommended by Nav 2 Guide and Davide Faconti 😄

@TakaHoribe this is continuation from:

Please test in both branches:

glog

export AUTOWARE_DIR=~/workspace/autoware
cd $AUTOWARE_DIR/src/universe/autoware.universe
git checkout feat/backward-test-glog
cd $AUTOWARE_DIR
colcon build --symlink-install  --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_EXPORT_COMPILE_COMMANDS=1  --packages-select  map_based_prediction

source $AUTOWARE_DIR/install/setup.bash
# map_based_prediction will crash in 10 seconds
# quickly put a vehicle and a goal with P and G keys in rviz to reduce unnecessary logs
ros2 launch autoware_launch planning_simulator.launch.xml map_path:=$HOME/autoware_map/sample-map-planning vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit

Crash logs with glog:

Click to expand
[map_based_prediction-47] Countdown: 2
[map_based_prediction-47] Countdown: 1
[map_based_prediction-47] *** Aborted at 1712864144 (unix time) try "date -d @1712864144" if you are using GNU date ***
[map_based_prediction-47] PC: @                0x0 (unknown)
[map_based_prediction-47] *** SIGSEGV (@0x2a) received by PID 1423297 (TID 0x7a458e290640) from PID 42; stack trace: ***
[map_based_prediction-47]     @     0x7a4593377046 (unknown)
[map_based_prediction-47]     @     0x7a4594a42520 (unknown)
[map_based_prediction-47]     @     0x7a459393aa3b _ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJZN20map_based_prediction22MapBasedPredictionNodeC4ERKN6rclcpp11NodeOptionsEEUlvE_EEEEE6_M_runEv
[map_based_prediction-47]     @     0x7a4594edc253 (unknown)
[map_based_prediction-47]     @     0x7a4594a94ac3 (unknown)
[map_based_prediction-47]     @     0x7a4594b26850 (unknown)
[map_based_prediction-47]     @                0x0 (unknown)

backward-cpp

export AUTOWARE_DIR=~/workspace/autoware
cd $AUTOWARE_DIR/src/universe/autoware.universe
git checkout feat/backwardcpp-test
cd $AUTOWARE_DIR

# do only once to make sure `ros-humble-backward-ros` is installed
rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO

colcon build --symlink-install  --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_EXPORT_COMPILE_COMMANDS=1  --packages-select  map_based_prediction

source $AUTOWARE_DIR/install/setup.bash
# map_based_prediction will crash in 10 seconds
# quickly put a vehicle and a goal with P and G keys in rviz to reduce unnecessary logs
ros2 launch autoware_launch planning_simulator.launch.xml map_path:=$HOME/autoware_map/sample-map-planning vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit

Crash logs with backward-cpp:

Click to expand
[map_based_prediction-47] Countdown: 2
[map_based_prediction-47] Countdown: 1
[map_based_prediction-47] Stack trace (most recent call last) in thread 1436033:
[map_based_prediction-47] #4    Object "", at 0xffffffffffffffff, in 
[map_based_prediction-47] #3    Source "../sysdeps/unix/sysv/linux/x86_64/clone3.S", line 81, in __clone3 [0x74d905b2684f]
[map_based_prediction-47] #2    Source "./nptl/pthread_create.c", line 442, in start_thread [0x74d905a94ac2]
[map_based_prediction-47] #1    Object "/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.30", at 0x74d905edc252, in 
[map_based_prediction-47] #0  | Source "/usr/include/c++/11/bits/std_thread.h", line 211, in operator()
[map_based_prediction-47]     |   210: 	void
[map_based_prediction-47]     | > 211: 	_M_run() { _M_func(); }
[map_based_prediction-47]     |   212:       };
[map_based_prediction-47]     | Source "/usr/include/c++/11/bits/std_thread.h", line 266, in _M_invoke<0>
[map_based_prediction-47]     |   264: 	  using _Indices
[map_based_prediction-47]     |   265: 	    = typename _Build_index_tuple<tuple_size<_Tuple>::value>::__type;
[map_based_prediction-47]     | > 266: 	  return _M_invoke(_Indices());
[map_based_prediction-47]     |   267: 	}
[map_based_prediction-47]     |   268:       };
[map_based_prediction-47]     | Source "/usr/include/c++/11/bits/std_thread.h", line 259, in __invoke<map_based_prediction::MapBasedPredictionNode::MapBasedPredictionNode(const rclcpp::NodeOptions&)::<lambda()> >
[map_based_prediction-47]     |   257: 	  typename __result<_Tuple>::type
[map_based_prediction-47]     |   258: 	  _M_invoke(_Index_tuple<_Ind...>)
[map_based_prediction-47]     | > 259: 	  { return std::__invoke(std::get<_Ind>(std::move(_M_t))...); }
[map_based_prediction-47]     |   260: 
[map_based_prediction-47]     |   261: 	typename __result<_Tuple>::type
[map_based_prediction-47]     | Source "/usr/include/c++/11/bits/invoke.h", line 96, in __invoke_impl<void, map_based_prediction::MapBasedPredictionNode::MapBasedPredictionNode(const rclcpp::NodeOptions&)::<lambda()> >
[map_based_prediction-47]     |    94:       using __type = typename __result::type;
[map_based_prediction-47]     |    95:       using __tag = typename __result::__invoke_type;
[map_based_prediction-47]     | >  96:       return std::__invoke_impl<__type>(__tag{}, std::forward<_Callable>(__fn),
[map_based_prediction-47]     |    97: 					std::forward<_Args>(__args)...);
[map_based_prediction-47]     |    98:     }
[map_based_prediction-47]     | Source "/usr/include/c++/11/bits/invoke.h", line 61, in operator()
[map_based_prediction-47]     |    59:     constexpr _Res
[map_based_prediction-47]     |    60:     __invoke_impl(__invoke_other, _Fn&& __f, _Args&&... __args)
[map_based_prediction-47]     | >  61:     { return std::forward<_Fn>(__f)(std::forward<_Args>(__args)...); }
[map_based_prediction-47]     |    62: 
[map_based_prediction-47]     |    63:   template<typename _Res, typename _MemFun, typename _Tp, typename... _Args>
[map_based_prediction-47]     | Source "/home/mfc/projects/autoware/src/universe/autoware.universe/perception/map_based_prediction/src/map_based_prediction_node.cpp", line 830, in operator()
[map_based_prediction-47]     |   828:       std::this_thread::sleep_for(std::chrono::seconds(1));
[map_based_prediction-47]     |   829:     }
[map_based_prediction-47]     | > 830:     int v = you_shall_not_pass();
[map_based_prediction-47]     |   831:     std::cout << "v=" << v << std::endl;
[map_based_prediction-47]     |   832:   });
[map_based_prediction-47]       Source "/home/mfc/projects/autoware/src/universe/autoware.universe/perception/map_based_prediction/src/map_based_prediction_node.cpp", line 822, in _M_run [0x74d9035f39fb]
[map_based_prediction-47]         819:   std::thread thread([]() {
[map_based_prediction-47]         820:     const auto you_shall_not_pass = []() {
[map_based_prediction-47]         821:       char * ptr = (char *)42;
[map_based_prediction-47]       > 822:       int v = *ptr;
[map_based_prediction-47]         823:       return v;
[map_based_prediction-47]         824:     };
[map_based_prediction-47]         825:     // print countdown
[map_based_prediction-47] Segmentation fault (Address not mapped to object [0x2a])

Effects on system behavior

  • When something crashes, you get very detailed crash logs.
  • Almost no effort to include, no source code change is needed.
  • There shouldn't be a performance hit but I didn't test it.

Pre-review checklist for the PR author

The PR author must check the checkboxes below when creating the PR.

In-review checklist for the PR reviewers

The PR reviewers must check the checkboxes below before approval.

Post-review checklist for the PR author

The PR author must check the checkboxes below before merging.

  • There are no open discussions or they are tracked via tickets.

After all checkboxes are checked, anyone who has write access can merge the PR.

@github-actions github-actions bot added the component:perception Advanced sensor data processing and environment understanding. (auto-assigned) label Apr 11, 2024
@xmfcx xmfcx requested a review from TakaHoribe April 11, 2024 19:58
@xmfcx xmfcx mentioned this pull request Apr 11, 2024
7 tasks
@xmfcx xmfcx self-assigned this Apr 11, 2024
@TakaHoribe
Copy link
Contributor

TakaHoribe commented Apr 15, 2024

@xmfcx Thank you, Fatih. This looks great. I have two questions:

I set backwardcpp in the behavior_path_planner, but it didn't provide any stack trace. I suspect the ros-container, but are you familiar with how to make it work in the container?

Additionally, when I set the following code in the map_based_prediction.cpp code,

  std::vector<int> v;
  std::cerr << "v = " << v.back() << std::endl;

I've got this stack trace from backwardcpp. I expected the stack trace expands v.back() part in the log, but I didn't. Is this a correct behavior of the backwardcpp?

Note: I built these packages with RelWithDebInfo option.

Click to expand
[map_based_prediction-47] #11   Object "", at 0xffffffffffffffff, in 
[map_based_prediction-47] #10   Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 704, in _start [0x5591f7dfdc94]
[map_based_prediction-47]         702:       ~__shared_count() noexcept
[map_based_prediction-47]         703:       {
[map_based_prediction-47]       > 704: 	if (_M_pi != nullptr)
[map_based_prediction-47]         705: 	  _M_pi->_M_release();
[map_based_prediction-47]         706:       }
[component_container_mt-35] [INFO 1713177534.898345228] [control.control_container] create_component_factory(): Load Library: /home/horibe/workspace/pilot-auto.latest/install/glog_component/lib/libglog_component.so:(L114)
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/default_ad_api/node/vehicle_door' in container '/default_ad_api/container'
[component_container_mt-35] [INFO 1713177534.901246627] [control.control_container] create_component_factory(): Found class: rclcpp_components::NodeFactoryTemplate<GlogComponent>:(L127)
[component_container_mt-35] [INFO 1713177534.901291257] [control.control_container] create_component_factory(): Instantiate class: rclcpp_components::NodeFactoryTemplate<GlogComponent>:(L129)
[component_container_mt-31] [INFO 1713177534.921614005] [planning.scenario_planning.lane_driving.motion_planning.motion_planning_container] create_component_factory(): Found class: rclcpp_components::NodeFactoryTemplate<obstacle_velocity_limiter::ObstacleVelocityLimiterNode>:(L127)
[component_container_mt-31] [INFO 1713177534.921693457] [planning.scenario_planning.lane_driving.motion_planning.motion_planning_container] create_component_factory(): Instantiate class: rclcpp_components::NodeFactoryTemplate<obstacle_velocity_limiter::ObstacleVelocityLimiterNode>:(L129)
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/control/glog_component' in container '/control/control_container'
[map_based_prediction-47] #9    Source "../csu/libc-start.c", line 392, in __libc_start_main_impl [0x7fbd74b7de3f]
[map_based_prediction-47] #8    Source "../sysdeps/nptl/libc_start_call_main.h", line 58, in __libc_start_call_main [0x7fbd74b7dd8f]
[component_container_mt-25] [INFO 1713177534.959873559] [planning.mission_planning.mission_planner] check_initialization(): waiting odometry... Route API is not ready.:(L100)
[map_based_prediction-47] #7    Source "rclcpp_components/node_main_map_based_prediction.cpp", line 65, in main [0x5591f7dfd50f]
[map_based_prediction-47] #6    Source "../../src/rclcpp/rclcpp/src/rclcpp/executors/single_threaded_executor.cpp", line 37, in spin [0x7fbd7516574f]
[map_based_prediction-47] #5    Source "../../src/rclcpp/rclcpp/src/rclcpp/executor.cpp", line 518, in execute_any_executable [0x7fbd7515ece1]
[map_based_prediction-47] #4    Source "../../src/rclcpp/rclcpp/src/rclcpp/executor.cpp", line 638, in execute_subscription [0x7fbd7515d7ab]
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/planning/scenario_planning/lane_driving/motion_planning/obstacle_velocity_limiter' in container '/planning/scenario_planning/lane_driving/motion_planning/motion_planning_container'
[INFO] [launch_ros.actions.load_composable_nodes]: Loaded node '/planning/scenario_planning/lane_driving/behavior_planning/behavior_path_planner' in container '/planning/scenario_planning/lane_driving/behavior_planning/behavior_planning_container'
[component_container_mt-30] [INFO 1713177535.120320243] [planning.scenario_planning.lane_driving.behavior_planning.behavior_planning_container] create_component_factory(): Load Library: /home/horibe/workspace/pilot-auto.latest/install/behavior_velocity_planner/lib/libbehavior_velocity_planner_lib.so:(L114)
[component_container_mt-30] [INFO 1713177535.130237235] [planning.scenario_planning.lane_driving.behavior_planning.behavior_planning_container] create_component_factory(): Found class: rclcpp_components::NodeFactoryTemplate<behavior_velocity_planner::BehaviorVelocityPlannerNode>:(L127)
[component_container_mt-30] [INFO 1713177535.130275218] [planning.scenario_planning.lane_driving.behavior_planning.behavior_planning_container] create_component_factory(): Instantiate class: rclcpp_components::NodeFactoryTemplate<behavior_velocity_planner::BehaviorVelocityPlannerNode>:(L129)
[map_based_prediction-47] #3  | Source "../../install/rclcpp/include/rclcpp/rclcpp/subscription.hpp", line 343, in dispatch
[map_based_prediction-47]     | Source "../../install/rclcpp/include/rclcpp/rclcpp/any_subscription_callback.hpp", line 504, in visit<rclcpp::AnySubscriptionCallback<autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> >, std::allocator<void> >::dispatch(std::shared_ptr<autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >, const rclcpp::MessageInfo&)::<lambda(auto:24&&)>, std::variant<std::function<void(const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> >&)>, std::function<void(const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> >&, const rclcpp::MessageInfo&)>, std::function<void(const rclcpp::SerializedMessage&)>, std::function<void(const rclcpp::SerializedMessage&, const rclcpp::MessageInfo&)>, std::function<void(std::unique_ptr<autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> >, std::default_delete<autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > > >)>, std::function<void(std::unique_ptr<autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> >, std::default_delete<autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > > >, const rclcpp::MessageInfo&)>, std::function<void(std::unique_ptr<rclcpp::SerializedMessage, std::default_delete<rclcpp::SerializedMessage> >)>, std::function<void(std::unique_ptr<rclcpp::SerializedMessage, std::default_delete<rclcpp::SerializedMessage> >, const rclcpp::MessageInfo&)>, std::function<void(std::shared_ptr<const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >)>, std::function<void(std::shared_ptr<const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >, const rclcpp::MessageInfo&)>, std::function<void(std::shared_ptr<const rclcpp::SerializedMessage>)>, std::function<void(std::shared_ptr<const rclcpp::SerializedMessage>, const rclcpp::MessageInfo&)>, std::function<void(const std::shared_ptr<const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >&)>, std::function<void(const std::shared_ptr<const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >&, const rclcpp::MessageInfo&)>, std::function<void(const std::shared_ptr<const rclcpp::SerializedMessage>&)>, std::function<void(const std::shared_ptr<const rclcpp::SerializedMessage>&, const rclcpp::MessageInfo&)>, std::function<void(std::shared_ptr<autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >)>, std::function<void(std::shared_ptr<autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >, const rclcpp::MessageInfo&)>, std::function<void(std::shared_ptr<rclcpp::SerializedMessage>)>, std::function<void(std::shared_ptr<rclcpp::SerializedMessage>, const rclcpp::MessageInfo&)> >&>
[map_based_prediction-47]     | Source "/usr/include/c++/11/variant", line 1761, in __do_visit<std::__detail::__variant::__deduce_visit_result<void>, rclcpp::AnySubscriptionCallback<autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> >, std::allocator<void> >::dispatch(std::shared_ptr<autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >, const rclcpp::MessageInfo&)::<lambda(auto:24&&)>, std::variant<std::function<void(const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> >&)>, std::function<void(const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> >&, const rclcpp::MessageInfo&)>, std::function<void(const rclcpp::SerializedMessage&)>, std::function<void(const rclcpp::SerializedMessage&, const rclcpp::MessageInfo&)>, std::function<void(std::unique_ptr<autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> >, std::default_delete<autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > > >)>, std::function<void(std::unique_ptr<autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> >, std::default_delete<autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > > >, const rclcpp::MessageInfo&)>, std::function<void(std::unique_ptr<rclcpp::SerializedMessage, std::default_delete<rclcpp::SerializedMessage> >)>, std::function<void(std::unique_ptr<rclcpp::SerializedMessage, std::default_delete<rclcpp::SerializedMessage> >, const rclcpp::MessageInfo&)>, std::function<void(std::shared_ptr<const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >)>, std::function<void(std::shared_ptr<const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >, const rclcpp::MessageInfo&)>, std::function<void(std::shared_ptr<const rclcpp::SerializedMessage>)>, std::function<void(std::shared_ptr<const rclcpp::SerializedMessage>, const rclcpp::MessageInfo&)>, std::function<void(const std::shared_ptr<const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >&)>, std::function<void(const std::shared_ptr<const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >&, const rclcpp::MessageInfo&)>, std::function<void(const std::shared_ptr<const rclcpp::SerializedMessage>&)>, std::function<void(const std::shared_ptr<const rclcpp::SerializedMessage>&, const rclcpp::MessageInfo&)>, std::function<void(std::shared_ptr<autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >)>, std::function<void(std::shared_ptr<autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >, const rclcpp::MessageInfo&)>, std::function<void(std::shared_ptr<rclcpp::SerializedMessage>)>, std::function<void(std::shared_ptr<rclcpp::SerializedMessage>, const rclcpp::MessageInfo&)> >&>
[map_based_prediction-47]     |  1759: 	    }
[map_based_prediction-47]     |  1760: 	  else
[map_based_prediction-47]     | >1761: 	    return std::__do_visit<_Tag>(
[map_based_prediction-47]     |  1762: 	      std::forward<_Visitor>(__visitor),
[map_based_prediction-47]     |  1763: 	      static_cast<_Vp>(__variants)...);
[map_based_prediction-47]       Source "/usr/include/c++/11/variant", line 1727, in handle_message [0x7fbd72531f8e]
[map_based_prediction-47]        1724: 	_Result_type, _Visitor&&, _Variants&&...>::_S_vtable;
[map_based_prediction-47]        1725: 
[map_based_prediction-47]        1726:       auto __func_ptr = __vtable._M_access(__variants.index()...);
[map_based_prediction-47]       >1727:       return (*__func_ptr)(std::forward<_Visitor>(__visitor),
[map_based_prediction-47]        1728: 			   std::forward<_Variants>(__variants)...);
[map_based_prediction-47]        1729:     }
[map_based_prediction-47]        1730:   /// @endcond
[map_based_prediction-47] #2  | Source "/usr/include/c++/11/variant", line 1016, in __invoke<rclcpp::AnySubscriptionCallback<autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> >, std::allocator<void> >::dispatch(std::shared_ptr<autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >, const rclcpp::MessageInfo&)::<lambda(auto:24&&)>, std::function<void(std::shared_ptr<const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >)>&>
[map_based_prediction-47]     |  1014: 	else if constexpr (_Array_type::__result_is_deduced::value)
[map_based_prediction-47]     |  1015: 	  // For the usual std::visit case deduce the return value:
[map_based_prediction-47]     | >1016: 	  return std::__invoke(std::forward<_Visitor>(__visitor),
[map_based_prediction-47]     |  1017: 	      __element_by_index_or_cookie<__indices>(
[map_based_prediction-47]     |  1018: 		std::forward<_Variants>(__vars))...);
[map_based_prediction-47]     | Source "/usr/include/c++/11/bits/invoke.h", line 96, in __invoke_impl<void, rclcpp::AnySubscriptionCallback<autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> >, std::allocator<void> >::dispatch(std::shared_ptr<autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >, const rclcpp::MessageInfo&)::<lambda(auto:24&&)>, std::function<void(std::shared_ptr<const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >)>&>
[map_based_prediction-47]     |    94:       using __type = typename __result::type;
[map_based_prediction-47]     |    95:       using __tag = typename __result::__invoke_type;
[map_based_prediction-47]     | >  96:       return std::__invoke_impl<__type>(__tag{}, std::forward<_Callable>(__fn),
[map_based_prediction-47]     |    97: 					std::forward<_Args>(__args)...);
[map_based_prediction-47]     |    98:     }
[map_based_prediction-47]     | Source "/usr/include/c++/11/bits/invoke.h", line 61, in operator()<std::function<void(std::shared_ptr<const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >)>&>
[map_based_prediction-47]     |    59:     constexpr _Res
[map_based_prediction-47]     |    60:     __invoke_impl(__invoke_other, _Fn&& __f, _Args&&... __args)
[map_based_prediction-47]     | >  61:     { return std::forward<_Fn>(__f)(std::forward<_Args>(__args)...); }
[map_based_prediction-47]     |    62: 
[map_based_prediction-47]     |    63:   template<typename _Res, typename _MemFun, typename _Tp, typename... _Args>
[map_based_prediction-47]     | Source "../../install/rclcpp/include/rclcpp/rclcpp/any_subscription_callback.hpp", line 556, in operator()
[map_based_prediction-47]       Source "/usr/include/c++/11/bits/std_function.h", line 590, in __visit_invoke [0x7fbd724ebb31]
[map_based_prediction-47]         587:       {
[map_based_prediction-47]         588: 	if (_M_empty())
[map_based_prediction-47]         589: 	  __throw_bad_function_call();
[map_based_prediction-47]       > 590: 	return _M_invoker(_M_functor, std::forward<_ArgTypes>(__args)...);
[map_based_prediction-47]         591:       }
[map_based_prediction-47]         592: 
[map_based_prediction-47]         593: #if __cpp_rtti
[ERROR] [component_container_mt-30]: process has died [pid 293984, exit code -11, cmd '/home/horibe/workspace/pilot-auto.latest/install/rclcpp_components/lib/rclcpp_components/component_container_mt --ros-args -r __node:=behavior_planning_container -r __ns:=/planning/scenario_planning/lane_driving/behavior_planning -p use_sim_time:=False -p wheel_radius:=0.383 -p wheel_width:=0.235 -p wheel_base:=2.79 -p wheel_tread:=1.64 -p front_overhang:=1.0 -p rear_overhang:=1.1 -p left_overhang:=0.128 -p right_overhang:=0.128 -p vehicle_height:=2.5 -p max_steer_angle:=0.7'].
[component_container_mt-30] v = 
[map_based_prediction-47] #1  | Source "/usr/include/c++/11/bits/std_function.h", line 290, in __invoke_r<void, std::_Bind<void (map_based_prediction::MapBasedPredictionNode::*(map_based_prediction::MapBasedPredictionNode*, std::_Placeholder<1>))(std::shared_ptr<const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >)>&, std::shared_ptr<const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > > >
[map_based_prediction-47]     |   288:       _M_invoke(const _Any_data& __functor, _ArgTypes&&... __args)
[map_based_prediction-47]     |   289:       {
[map_based_prediction-47]     | > 290: 	return std::__invoke_r<_Res>(*_Base::_M_get_pointer(__functor),
[map_based_prediction-47]     |   291: 				     std::forward<_ArgTypes>(__args)...);
[map_based_prediction-47]     |   292:       }
[map_based_prediction-47]     | Source "/usr/include/c++/11/bits/invoke.h", line 111, in __invoke_impl<void, std::_Bind<void (map_based_prediction::MapBasedPredictionNode::*(map_based_prediction::MapBasedPredictionNode*, std::_Placeholder<1>))(std::shared_ptr<const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >)>&, std::shared_ptr<const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > > >
[map_based_prediction-47]     |   109:       using __tag = typename __result::__invoke_type;
[map_based_prediction-47]     |   110:       if constexpr (is_void_v<_Res>)
[map_based_prediction-47]     | > 111: 	std::__invoke_impl<__type>(__tag{}, std::forward<_Callable>(__fn),
[map_based_prediction-47]     |   112: 					std::forward<_Args>(__args)...);
[map_based_prediction-47]     |   113:       else
[map_based_prediction-47]     | Source "/usr/include/c++/11/bits/invoke.h", line 61, in operator()<std::shared_ptr<const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > > >
[map_based_prediction-47]     |    59:     constexpr _Res
[map_based_prediction-47]     |    60:     __invoke_impl(__invoke_other, _Fn&& __f, _Args&&... __args)
[map_based_prediction-47]     | >  61:     { return std::forward<_Fn>(__f)(std::forward<_Args>(__args)...); }
[map_based_prediction-47]     |    62: 
[map_based_prediction-47]     |    63:   template<typename _Res, typename _MemFun, typename _Tp, typename... _Args>
[map_based_prediction-47]     | Source "/usr/include/c++/11/functional", line 503, in __call<void, std::shared_ptr<const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >&&, 0, 1>
[map_based_prediction-47]     |   501: 	operator()(_Args&&... __args)
[map_based_prediction-47]     |   502: 	{
[map_based_prediction-47]     | > 503: 	  return this->__call<_Result>(
[map_based_prediction-47]     |   504: 	      std::forward_as_tuple(std::forward<_Args>(__args)...),
[map_based_prediction-47]     |   505: 	      _Bound_indexes());
[map_based_prediction-47]     | Source "/usr/include/c++/11/functional", line 420, in __invoke<void (map_based_prediction::MapBasedPredictionNode::*&)(std::shared_ptr<const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >), map_based_prediction::MapBasedPredictionNode*&, std::shared_ptr<const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > > >
[map_based_prediction-47]     |   418: 	__call(tuple<_Args...>&& __args, _Index_tuple<_Indexes...>)
[map_based_prediction-47]     |   419: 	{
[map_based_prediction-47]     | > 420: 	  return std::__invoke(_M_f,
[map_based_prediction-47]     |   421: 	      _Mu<_Bound_args>()(std::get<_Indexes>(_M_bound_args), __args)...
[map_based_prediction-47]     |   422: 	      );
[map_based_prediction-47]     | Source "/usr/include/c++/11/bits/invoke.h", line 96, in __invoke_impl<void, void (map_based_prediction::MapBasedPredictionNode::*&)(std::shared_ptr<const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > >), map_based_prediction::MapBasedPredictionNode*&, std::shared_ptr<const autoware_auto_perception_msgs::msg::TrackedObjects_<std::allocator<void> > > >
[map_based_prediction-47]     |    94:       using __type = typename __result::type;
[map_based_prediction-47]     |    95:       using __tag = typename __result::__invoke_type;
[map_based_prediction-47]     | >  96:       return std::__invoke_impl<__type>(__tag{}, std::forward<_Callable>(__fn),
[map_based_prediction-47]     |    97: 					std::forward<_Args>(__args)...);
[map_based_prediction-47]     |    98:     }
[map_based_prediction-47]       Source "/usr/include/c++/11/bits/invoke.h", line 74, in _M_invoke [0x7fbd724ec9b6]
[map_based_prediction-47]          71:     __invoke_impl(__invoke_memfun_deref, _MemFun&& __f, _Tp&& __t,
[map_based_prediction-47]          72: 		  _Args&&... __args)
[map_based_prediction-47]          73:     {
[map_based_prediction-47]       >  74:       return ((*std::forward<_Tp>(__t)).*__f)(std::forward<_Args>(__args)...);
[map_based_prediction-47]          75:     }
[map_based_prediction-47]          76: 
[map_based_prediction-47]          77:   template<typename _Res, typename _MemPtr, typename _Tp>
[map_based_prediction-47] #0    Source "../../src/autoware/universe/perception/map_based_prediction/src/map_based_prediction_node.cpp", line 902, in objectsCallback [0x7fbd724cf3e9]
[map_based_prediction-47] Segmentation fault (Address not mapped to object [0xfffffffffffffffc])

@TakaHoribe
Copy link
Contributor

Note: I can check the error logger with kill command: kill -SIGABRT <PID>

This is the output for the map_based_prediction.

Click to expand
[map_based_prediction-47] Stack trace (most recent call last):
[map_based_prediction-47] #14   Object "", at 0xffffffffffffffff, in 
[map_based_prediction-47] #13   Source "/usr/include/c++/11/bits/shared_ptr_base.h", line 704, in _start [0x5588cdb2bc94]
[map_based_prediction-47]         702:       ~__shared_count() noexcept
[map_based_prediction-47]         703:       {
[map_based_prediction-47]       > 704: 	if (_M_pi != nullptr)
[map_based_prediction-47]         705: 	  _M_pi->_M_release();
[map_based_prediction-47]         706:       }
[map_based_prediction-47] #12   Source "../csu/libc-start.c", line 392, in __libc_start_main_impl [0x7f343bf74e3f]
[map_based_prediction-47] #11   Source "../sysdeps/nptl/libc_start_call_main.h", line 58, in __libc_start_call_main [0x7f343bf74d8f]
[map_based_prediction-47] #10   Source "rclcpp_components/node_main_map_based_prediction.cpp", line 65, in main [0x5588cdb2b50f]
[map_based_prediction-47] #9    Source "../../src/rclcpp/rclcpp/src/rclcpp/executors/single_threaded_executor.cpp", line 36, in spin [0x7f343c55c740]
[map_based_prediction-47] #8    Source "../../src/rclcpp/rclcpp/src/rclcpp/executor.cpp", line 906, in get_next_executable [0x7f343c558312]
[map_based_prediction-47] #7    Source "../../src/rclcpp/rclcpp/src/rclcpp/executor.cpp", line 750, in wait_for_work [0x7f343c557d6a]
[map_based_prediction-47] #6    Object "/opt/ros/humble/lib/librcl.so", at 0x7f343beb5847, in rcl_wait
[map_based_prediction-47] #5    Object "/opt/ros/humble/lib/librmw_cyclonedds_cpp.so", at 0x7f343bbe274e, in rmw_wait
[map_based_prediction-47] #4    Object "/opt/ros/humble/lib/x86_64-linux-gnu/libddsc.so.0.10.4", at 0x7f343bb2645c, in 
[map_based_prediction-47] #3    Object "/opt/ros/humble/lib/x86_64-linux-gnu/libddsc.so.0.10.4", at 0x7f343bb3fb54, in ddsrt_cond_waituntil
[map_based_prediction-47] #2    Object "/opt/ros/humble/lib/x86_64-linux-gnu/libddsc.so.0.10.4", at 0x7f343bb3fa8c, in ddsrt_cond_wait
[map_based_prediction-47] #1  | Source "./nptl/pthread_cond_wait.c", line 627, in __pthread_cond_wait_common
[map_based_prediction-47]       Source "./nptl/pthread_cond_wait.c", line 503, in ___pthread_cond_wait [0x7f343bfdea40]
[map_based_prediction-47] #0  | Source "./nptl/futex-internal.c", line 139, in __futex_abstimed_wait_common
[map_based_prediction-47]     | Source "./nptl/futex-internal.c", line 87, in __futex_abstimed_wait_common64
[map_based_prediction-47]       Source "./nptl/futex-internal.c", line 57, in __futex_abstimed_wait_cancelable64 [0x7f343bfdc117]
[map_based_prediction-47] Aborted (Signal sent by kill() 21198 1000)

@xmfcx
Copy link
Contributor Author

xmfcx commented Apr 15, 2024

@TakaHoribe did you compile with debug flags? (--cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo)

From your post:

[map_based_prediction-47] #0 Source "../../src/autoware/universe/perception/map_based_prediction/src/map_based_prediction_node.cpp", line 902, in objectsCallback [0x7fbd724cf3e9]

It says you got the error on line 902. Could you share the commit so we can analyze?

@xmfcx
Copy link
Contributor Author

xmfcx commented Apr 15, 2024

I set backwardcpp in the behavior_path_planner, but it didn't provide any stacktrace. I suspect the ros-container, but are you familiar with how to make it work in the container?

I will look into it, I didn't try it with a container before.

@TakaHoribe
Copy link
Contributor

@xmfcx Thank you for your fast reply...!

Oh, I didn't see this part line 902. It is exactly where I put an error code.

This is the branch I'm working on: https://github.com/tier4/autoware.universe/blob/backwardcpp-prediction-test/perception/map_based_prediction/src/map_based_prediction_node.cpp/#L902

@xmfcx
Copy link
Contributor Author

xmfcx commented Apr 15, 2024

Also, did you compile with debug flags? (--cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo)

This is what I used:
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_EXPORT_COMPILE_COMMANDS=1 --packages-select map_based_prediction

@TakaHoribe
Copy link
Contributor

@xmfcx

Also, did you compile with debug flags?

Yes, I tested with -DCMAKE_BUILD_TYPE=RelWithDebInfo. Could you see the detailed stack trace in your environment?

@TakaHoribe
Copy link
Contributor

@xmfcx In my test,

  • backward-ros provides better information in both Release and RelWithDebInfo.
  • backward-ros does not work for a container (I'm investigating now), but glog does.
    • (I added backward-ros in rclcpp_components pkg, but it didn't work.)

So, if there is a way to use backward-ros, the backward-ros is preferred.


Release

glog: only function name information

image

backward-ros: only function name information

image

RelWithDebInfo

glog: only function name information, same as Release build

image

backward-ros: function name and line information (don't know why but I couldn't get the source code info)

image

Note: setting both glog and backward-ros provides only glog information.

@TakaHoribe
Copy link
Contributor

And I don't know why but still, I can not get the source code info. It only provides the file and line.

The build command is like this:

colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --catkin-skip-building-tests

image

@kminoda
Copy link
Contributor

kminoda commented Jun 14, 2024

@xmfcx Hi, is this PR still intended to be open?

@xmfcx xmfcx closed this Jun 14, 2024
@mitsudome-r mitsudome-r deleted the feat/backwardcpp-test branch December 13, 2024 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:perception Advanced sensor data processing and environment understanding. (auto-assigned)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants