CogRob/omnimapper

Segfault when initializing new Cloud instances

ruffsl opened this issue · 1 comments

Looks like there may be a template issue when creating a new instance of a Cloud (pcl::PointCloud). Perhaps this is tied to an issue with pcl_conversions in ros2?

This can be verified by testing the only the icp plugin using "xyz","rgb" PointCloud2 messages. However, I don't think runtime data from the PointCloud2 message format is yet the issue here, as segfault occurs even before the payload message current_cloud is used in the control flow.

CloudPtr current_cloud_filtered(new Cloud());

template <typename PointT>
class ICPPoseMeasurementPlugin //: public omnimapper::PosePlugin
{
typedef typename pcl::PointCloud<PointT> Cloud;

Building from the head of https://github.com/ros-perception/perception_pcl/tree/eloquent-devel as of ros-perception/perception_pcl@36eb607 within the workspace still seem to exisbit this issue.

Stack trace:

    __GI___libc_free 0x00007f01094b198d
    Eigen::internal::handmade_aligned_free Memory.h:98
    Eigen::internal::aligned_free Memory.h:179
    Eigen::aligned_allocator<pcl::PointXYZRGBA>::deallocate Memory.h:747
    std::allocator_traits<Eigen::aligned_allocator<pcl::PointXYZRGBA> >::deallocate alloc_traits.h:328
    std::_Vector_base<pcl::PointXYZRGBA, Eigen::aligned_allocator<pcl::PointXYZRGBA> >::_M_deallocate stl_vector.h:180
    std::_Vector_base<pcl::PointXYZRGBA, Eigen::aligned_allocator<pcl::PointXYZRGBA> >::~_Vector_base stl_vector.h:162
    std::vector<pcl::PointXYZRGBA, Eigen::aligned_allocator<pcl::PointXYZRGBA> >::~vector stl_vector.h:435
    pcl::PointCloud<pcl::PointXYZRGBA>::~PointCloud point_cloud.h:240
    pcl::PointCloud<pcl::PointXYZRGBA>::~PointCloud point_cloud.h:240
    boost::checked_delete<pcl::PointCloud<pcl::PointXYZRGBA> > checked_delete.hpp:34
    boost::detail::sp_counted_impl_p<pcl::PointCloud<pcl::PointXYZRGBA> >::dispose sp_counted_impl.hpp:92
    boost::detail::sp_counted_base::release sp_counted_base_std_atomic.hpp:110
    boost::detail::shared_count::~shared_count shared_count.hpp:426
--> boost::shared_ptr<pcl::PointCloud<pcl::PointXYZRGBA> >::~shared_ptr shared_ptr.hpp:341
    omnimapper::ICPPoseMeasurementPlugin<pcl::PointXYZRGBA>::spinOnce icp_plugin.cpp:135
    omnimapper::ICPPoseMeasurementPlugin<pcl::PointXYZRGBA>::spin icp_plugin.cpp:112
    boost::_mfi::mf0<void, omnimapper::ICPPoseMeasurementPlugin<pcl::PointXYZRGBA> >::operator() mem_fn_template.hpp:49
    boost::_bi::list1<boost::_bi::value<omnimapper::ICPPoseMeasurementPlugin<pcl::PointXYZRGBA>*> >::operator()<boost::_mfi::mf0<void, omnimapper::ICPPoseMeasurementPlugin<pcl::PointXYZRGBA> >, boost::_bi::list0> bind.hpp:259
    boost::_bi::bind_t<void, boost::_mfi::mf0<void, omnimapper::ICPPoseMeasurementPlugin<pcl::PointXYZRGBA> >, boost::_bi::list1<boost::_bi::value<omnimapper::ICPPoseMeasurementPlugin<pcl::PointXYZRGBA>*> > >::operator() bind.hpp:1294
    boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf0<void, omnimapper::ICPPoseMeasurementPlugin<pcl::PointXYZRGBA> >, boost::_bi::list1<boost::_bi::value<omnimapper::ICPPoseMeasurementPlugin<pcl::PointXYZRGBA>*> > > >::run thread.hpp:116
    <unknown> 0x00007f010a276bcd
    start_thread 0x00007f010be776db
    clone 0x00007f010953b88f

@BillWSY would you have an idea on what the C++ template issue with pcl::PointCloud might be? I don't have as much experience using C++ template as you may have.

Ok, I've think I've resolved this issue with:

CogRob/omnimapper_ros@3fb4339

It seems that PCL v1.8.1 released in debian is compiled with AVX. while our project isn't. I first tried just forcing CMAKE_CXX_FLAGS="-mavx" for the overlay workspace to avoid having to compile all of PCL from source, but had no effect. So I just added PCL into the underlay workspace to work around this issue, pulling the same v1.8.1 tag from source to maintain API with other downstream PCL dependent packages give ubuntu 18.04 LTS ships with libpcl-dev v1.8.1 as well..

Related: