-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
[ndt/filter] call pcl::NormalDistributionsTransform::setInputTarget twice got segfault #4944
Comments
This is weird because in the call stack it tries to destroy We may need more context, can you provide us some runnable code to reproduce the error? |
You suggest to add |
Yes, it fixed my problem. You can reproduce the bug as fellowed: pcl::NormalDistributionsTransform<pcl::PointXYZI, pcl::PointXYZI> ndt; const std::vectorstd::string pcd_paths = {std::string(1.pcd),std::string(2.pcd),std::string(3.pcd),std::string(4.pcd)}; bool is_map_init = false; if(!is_map_init ){ pcl::VoxelGridpcl::PointXYZI voxel_grid_filter; pcl::PointCloudpcl::PointXYZI::Ptr map_ptr(new pcl::PointCloudpcl::PointXYZI(map)); ndt.setTransformationEpsilon(0.01); double fitness_score = ndt.getFitnessScore(); if(fitness_score < 0.5){ |
But the trace suggests that the segfault happens while destroying a leaf, so why would adding |
There are some fixed-size Eigen types in struct Leaf which is included in class VoxelGridCovariance . Is it the cause? |
" not enabling SIMD extensions" may be the cause, I'll try later。 |
I also doubted that but as @mvieth said, the trace indicating it was caused by dynamic size matrix, which adding @marf-cn Since you close the issue, have you fixed your issue already? |
@mvieth Yes,I fixed my issue by adding PCL_MAKE_ALIGNED_OPERATOR_NEW temporarily! I haven't dig into the issue if SIMD worked, due to I have quited from the project. |
Describe the bug
A clear and concise description of what the bug is.
got segfault when calling pcl::NormalDistributionsTransform::setInputTarget second time.
Context
What are you trying to accomplish? Providing context helps us come up with a solution that is most useful in the real world
Expected behavior
A clear and concise description of what you expected to happen.
Current Behavior
What happens instead of the expected behavior?
To Reproduce
chang the map and call
pcl::NormalDistributionsTransform::setInputTarget
again
static pcl::NormalDistributionsTransform<pcl::PointXYZI, pcl::PointXYZI> ndt;
.......
ndt.setTransformationEpsilon(trans_eps);
ndt.setStepSize(step_size);
ndt.setResolution(ndt_res);
ndt.setMaximumIterations(max_iter);
ndt.setInputSource(filtered_scan_ptr);
ndt.setInputTarget(map_ptr1);
ndt.align(*output_cloud, init_guess);
....
ndt.setTransformationEpsilon(trans_eps);
ndt.setStepSize(step_size);
ndt.setResolution(ndt_res);
ndt.setMaximumIterations(max_iter);
ndt.setInputSource(filtered_scan_ptr);
ndt.setInputTarget(map_ptr2); //got segfault
Provide a link to a live example, or an unambiguous set of steps to reproduce this bug. A reproducible example helps to provide faster answers.
Screenshots/Code snippets
#0 0x00007fffe8e2ea6d in free () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00005555555ca47f in Eigen::internal::handmade_aligned_free(void*) ()
#2 0x00005555555ca4db in Eigen::internal::aligned_free(void*) ()
#3 0x00005555555ccd7d in void Eigen::internal::conditional_aligned_free(void*) ()
#4 0x00005555555d2420 in void Eigen::internal::conditional_aligned_delete_auto<float, true>(float*, unsigned long) ()
#5 0x00005555555cd19d in Eigen::DenseStorage<float, -1, -1, 1, 0>::~DenseStorage() ()
#6 0x00005555555cb578 in Eigen::PlainObjectBase<Eigen::Matrix<float, -1, 1, 0, -1, 1> >::~PlainObjectBase() ()
#7 0x00005555555cb594 in Eigen::Matrix<float, -1, 1, 0, -1, 1>::~Matrix() ()
#8 0x00005555555f145c in pcl::VoxelGridCovariancepcl::PointXYZ::Leaf::~Leaf() ()
#9 0x00005555555f147c in std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf>::~pair() ()
#10 0x00005555555f149c in void __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> > >::destroy<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >(std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf>) ()
#11 0x00005555555ecc6f in void std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> > > >::destroy<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >(std::allocator<std::_Rb_tree_node<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> > >&, std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf>) ()
#12 0x00005555555e882d in std::_Rb_tree<unsigned long, std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf>, std::_Select1st<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >, std::less, std::allocator<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> > >::_M_destroy_node(std::_Rb_tree_node<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >) ()
#13 0x00005555555e355d in std::_Rb_tree<unsigned long, std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf>, std::_Select1st<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >, std::less, std::allocator<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> > >::_M_drop_node(std::_Rb_tree_node<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >) ()
#14 0x00005555555dafea in std::_Rb_tree<unsigned long, std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf>, std::_Select1st<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >, std::less, std::allocator<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> > >::_M_erase(std::_Rb_tree_node<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >) ()
#15 0x00005555555dafc7 in std::_Rb_tree<unsigned long, std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf>, std::_Select1st<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >, std::less, std::allocator<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> > >::_M_erase(std::_Rb_tree_node<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >) ()
#16 0x00005555555dafc7 in std::_Rb_tree<unsigned long, std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf>, std::_Select1st<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >, std::less, std::allocator<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> > >::_M_erase(std::_Rb_tree_node<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >) ()
#17 0x00005555555dafc7 in std::_Rb_tree<unsigned long, std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf>, std::_Select1st<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >, std::less, std::allocator<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> > >::_M_erase(std::_Rb_tree_node<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >) ()
#18 0x00005555555dafc7 in std::_Rb_tree<unsigned long, std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf>, std::_Select1st<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >, std::less, std::allocator<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> > >::_M_erase(std::_Rb_tree_node<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >) ()
#19 0x00005555555dafc7 in std::_Rb_tree<unsigned long, std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf>, std::_Select1st<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >, std::less, std::allocator<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> > >::_M_erase(std::_Rb_tree_node<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >) ()
#20 0x00005555555dafc7 in std::_Rb_tree<unsigned long, std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf>, std::_Select1st<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >, std::less, std::allocator<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> > >::_M_erase(std::_Rb_tree_node<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >) ()
#21 0x00005555555dafc7 in std::_Rb_tree<unsigned long, std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf>, std::_Select1st<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >, std::less, std::allocator<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> > >::_M_erase(std::_Rb_tree_node<std::pair<unsigned long const, pcl::VoxelGridCovariancepcl::PointXYZ::Leaf> >) ()
In order to help explain your problem, please consider adding
Your Environment (please complete the following information):
Possible Solution
try putting PCL_MAKE_ALIGNED_OPERATOR_NEW in VoxelGridCovariance
class VoxelGridCovariance : public VoxelGrid
{
// public:
// PCL_MAKE_ALIGNED_OPERATOR_NEW
...
Not obligatory, but suggest a fix/reason for the bug. Feel free to create a PR if you feel comfortable.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: