-
Notifications
You must be signed in to change notification settings - Fork 177
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
Why is there a segmentation fault here? #37
Comments
I noticed that if I set the value if 'Minimal_Unbalanced_Tree_Size' to INIFINITY in ikd_tree.h, the segmentation fault error stops happening. I think this could indicate an issue with the re-building process in the second thread. I hope this can be useful! |
Experiencing the same issue here. Having the same hypothesis as what @ning-zelin mentioned.
which seems work for me currently. |
|
Stack trace (most recent call last):
#21 Object "/usr/lib/x86_64-linux-gnu/ld-2.31.so", at 0xffffffffffffffff, in
#20 Object "/home/jcwang/code/ws_di-lui-sam/src/di_lui_sam/cmake-build-debug/devel/lib/multi_proxy/multi_proxy_subMapFusion", at 0x555555600ead, in start
#19 Source "../csu/libc-start.c", line 308, in libc_start_main [0x7ffff45e6082]
#18 Source "/home/jcwang/code/ws_di-lui-sam/src/di_lui_sam/src/subMapFusion.cpp", line 2235, in main [0x555555601305]
2232: std::thread OptThread(&SubMapFusion::globalOptimizationThread, &SubMapF);
2233: std::thread pubLoopThread(&SubMapFusion::publishSCWithCloudThread, &SubMapF);
2234:
>2235: ros::spin();
2236:
2237: pubDesOtherThread.join();
2238: pubMapThread.join();
#17 Object "/opt/ros/noetic/lib/libroscpp.so", at 0x7ffff7f2a21e, in ros::spin()
#16 Object "/opt/ros/noetic/lib/libroscpp.so", at 0x7ffff7f41fce, in ros::SingleThreadedSpinner::spin(ros::CallbackQueue*)
#15 Object "/opt/ros/noetic/lib/libroscpp.so", at 0x7ffff7eee882, in ros::CallbackQueue::callAvailable(ros::WallDuration)
#14 Object "/opt/ros/noetic/lib/libroscpp.so", at 0x7ffff7eed171, in ros::CallbackQueue::callOneCB(ros::CallbackQueue::TLS*)
#13 Object "/opt/ros/noetic/lib/libroscpp.so", at 0x7ffff7f3f138, in ros::SubscriptionQueue::call()
#12 Source "/opt/ros/noetic/include/ros/subscription_callback_helper.h", line 144, in call [0x5555556fe2ca]
141: virtual void call(SubscriptionCallbackHelperCallParams& params)
142: {
143: Event event(params.event, create);
> 144: callback(ParameterAdapter
::getParameter(event));
145: }
146:
147: virtual const std::type_info& getTypeInfo()
#11 Source "/usr/include/boost/function/function_template.hpp", line 763, in operator() [0x555555702548]
760: if (this->empty())
761: boost::throw_exception(bad_function_call());
762:
> 763: return get_vtable()->invoker
764: (this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS);
765: }
#10 Source "/usr/include/boost/function/function_template.hpp", line 158, in invoke [0x5555556b57eb]
155: f = reinterpret_cast<FunctionObj*>(function_obj_ptr.data);
156: else
157: f = reinterpret_cast<FunctionObj*>(function_obj_ptr.members.obj_ptr);
> 158: BOOST_FUNCTION_RETURN((f)(BOOST_FUNCTION_ARGS));
159: }
160: };
#9 Source "/usr/include/boost/function/function_template.hpp", line 763, in operator() [0x5555556c1db5]
760: if (this->empty())
761: boost::throw_exception(bad_function_call());
762:
> 763: return get_vtable()->invoker
764: (this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS);
765: }
#8 Source "/usr/include/boost/function/function_template.hpp", line 158, in invoke [0x555555696649]
155: f = reinterpret_cast<FunctionObj>(function_obj_ptr.data);
156: else
157: f = reinterpret_cast<FunctionObj*>(function_obj_ptr.members.obj_ptr);
> 158: BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS));
159: }
160: };
#7 Source "/usr/include/boost/bind/bind.hpp", line 1306, in operator()<const boost::shared_ptr<const sensor_msgs::PointCloud2<std::allocator > >&> [0x5555556a70ac]
1303: template result_type operator()( A1 && a1 )
1304: {
1305: rrlist1< A1 > a( a1 );
>1306: return l_( type<result_type>(), f_, a, 0 );
1307: }
1308:
1309: template result_type operator()( A1 && a1 ) const
#6 Source "/usr/include/boost/bind/bind.hpp", line 319, in operator()<boost::mfi::mf1<void, SubMapFusion, const boost::shared_ptr<const sensor_msgs::PointCloud2<std::allocator > >&>, boost::bi::rrlist1<const boost::shared_ptr<const sensor_msgs::PointCloud2<std::allocator > >&> > [0x5555556b5515]
317: template<class F, class A> void operator()(type, F & f, A & a, int)
318: {
> 319: unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
320: }
321:
322: template<class F, class A> void operator()(type, F const & f, A & a, int) const
#5 Source "/usr/include/boost/bind/mem_fn_template.hpp", line 165, in operator() [0x5555556c1a47]
163: R operator()(T * p, A1 a1) const
164: {
> 165: BOOST_MEM_FN_RETURN (p->f_)(a1);
166: }
167:
168: template R operator()(U & u, A1 a1) const
#4 Source "/home/jcwang/code/ws_di-lui-sam/src/di_lui_sam/src/subMapFusion.cpp", line 681, in laserCloudInfoHandler [0x55555561e8f4]
679: isKeyframe(context_info);
680: buildFrameList(context_info);
> 681: buildSubmap(context_info);
682: }
683: // std::cout << "laser: finished! " << std::endl;
684: }
#3 Source "/home/jcwang/code/ws_di-lui-sam/src/di_lui_sam/src/subMapFusion.cpp", line 1109, in buildSubmap [0x555555623a08]
1106: _downsize_filtermap.setInputCloud(cloud_in_ego_odom);
1107: _downsize_filtermap.filter(_cloud_temp);
1108:
>1109: buildiKDTree(_cloud_temp);//////TODO:这里有问题,会重复释放内存
1110: mtx_map.lock();
1111: *_lidarmap_current += *_cloud_temp;
1112: _cloud_temp->clear();
#2 Source "/home/jcwang/code/ws_di-lui-sam/src/di_lui_sam/src/subMapFusion.cpp", line 1164, in buildiKDTree [0x555555624060]
1161: }
1162:
1163: double st_time = omp_get_wtime();
>1164: ikdtree.Add_Points(PointToAdd, true);
1165: double kdtree_incremental_time = omp_get_wtime() - st_time;
1166: }
#1 Source "/home/jcwang/code/ws_di-lui-sam/src/di_lui_sam/third_parties/ikd-Tree/ikd_Tree.cpp", line 501, in Add_Points [0x7ffff72eff4d]
498: mid_point.y = Box_of_Point.vertex_min[1] + (Box_of_Point.vertex_max[1] - Box_of_Point.vertex_min[1]) / 2.0;
499: mid_point.z = Box_of_Point.vertex_min[2] + (Box_of_Point.vertex_max[2] - Box_of_Point.vertex_min[2]) / 2.0;
500: PointVector().swap(Downsample_Storage);
> 501: Search_by_range(Root_Node, Box_of_Point, Downsample_Storage);
502: min_dist = calc_dist(PointToAdd[i], mid_point);
503: downsample_result = PointToAdd[i];
504: for (int index = 0; index < Downsample_Storage.size(); index++)
#0 Source "/home/jcwang/code/ws_di-lui-sam/src/di_lui_sam/third_parties/ikd-Tree/ikd_Tree.cpp", line 1268, in Search_by_range [0x7ffff72ecce4]
1265: if (!root->point_deleted)
1266: Storage.push_back(root->point);
1267: }
>1268: if ((Rebuild_Ptr == nullptr) || root->left_son_ptr != *Rebuild_Ptr)
1269: {
1270: Search_by_range(root->left_son_ptr, boxpoint, Storage);
1271: }
Segmentation fault (Address not mapped to object [(nil)])
The text was updated successfully, but these errors were encountered: