Open finostro-amtc opened 4 years ago
Found out it was a problem with eigen alignment. Fixed it by compiling with c++17
I often meet with the problems of Eigen alignment too (not in this version, this released version are comparative stable), the problems and its correspondence solution are not always the same... It cause me crazy many times...
apparently with c++17 eigen handles the alignment internally so we don't have to do anything anymore :)
hello,i come cross this problem also, and i make my gcc update to 9.1 so can use c++17,but i don't know how to use it to compile the eigen. my eigen is installed by : sudo apt-get install libeigen3-dev so what should i do to slove this problem? thanks.
@finostro @ziv-lin @musicshmily I checked gdb (my gcc 7.5, Eigen 3.3.7, PCL 1.8.1), the error at the first glance relates to Eigen memory alignment:
Open scanRegistration.log successful.
double free or corruption (out)
Thread 1 "livox_scanRegis" 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 0x00007ffff44eb921 in __GI_abort () at abort.c:79
#2 0x00007ffff4534967 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff4661b0d "%s\n") at ../sysdeps/posix/libc_fatal.c:181
#3 0x00007ffff453b9da in malloc_printerr (str=str@entry=0x7ffff4663818 "double free or corruption (out)") at malloc.c:5342
#4 0x00007ffff4542f6a in _int_free (have_lock=0, p=0x555555989530, av=0x7ffff4896c40 <main_arena>) at malloc.c:4308
#5 __GI___libc_free (mem=0x555555989540) at malloc.c:3134
#6 0x000055555556c7c1 in Eigen::internal::aligned_free (ptr=<optimized out>) at /usr/include/eigen3/Eigen/src/Core/util/Memory.h:177
#7 Eigen::aligned_allocator<pcl::PointXYZI>::deallocate (this=0x7fffff9decb8, p=<optimized out>) at /usr/include/eigen3/Eigen/src/Core/util/Memory.h:763
#8 std::allocator_traits<Eigen::aligned_allocator<pcl::PointXYZI> >::deallocate (__a=..., __n=<optimized out>, __p=<optimized out>) at /usr/include/c++/7/bits/alloc_traits.h:328
#9 std::_Vector_base<pcl::PointXYZI, Eigen::aligned_allocator<pcl::PointXYZI> >::_M_deallocate (this=0x7fffff9decb8, __n=<optimized out>, __p=<optimized out>) at /usr/include/c++/7/bits/stl_vector.h:180
#10 std::_Vector_base<pcl::PointXYZI, Eigen::aligned_allocator<pcl::PointXYZI> >::~_Vector_base (this=0x7fffff9decb8, __in_chrg=<optimized out>) at /usr/include/c++/7/bits/stl_vector.h:162
#11 std::vector<pcl::PointXYZI, Eigen::aligned_allocator<pcl::PointXYZI> >::~vector (this=0x7fffff9decb8, __in_chrg=<optimized out>) at /usr/include/c++/7/bits/stl_vector.h:435
#12 pcl::PointCloud<pcl::PointXYZI>::~PointCloud (this=0x7fffff9dec80, __in_chrg=<optimized out>) at /usr/include/pcl-1.8/pcl/point_cloud.h:240
#13 0x0000555555577b72 in pcl::Filter<pcl::PointXYZI>::filter (this=0x7fffffffd730, output=...) at /usr/include/pcl-1.8/pcl/filters/filter.h:139
#14 0x0000555555585cf9 in Laser_feature::laserCloudHandler (this=0x7fffff9dff60, laserCloudMsg=..., topic_name=...) at /home/yiakwy/catkin_ws/src/loam_livox/source/laser_feature_extractor.hpp:373
To resolve the core dump, we have to update the pcl (1.11) and gcc (gcc 9) to compile with c++17 options.
but later I find there is another problem within lazerMapping binary: (to be continued)
@musicshmily simply upgrade from gcc 7 to gcc 9 and switch to c++17 work randomly (I also udpated to latest pcl-1.11)
There are two main binaries in this project:
livox_scanRegitration
andlivox_laserMapping
The later wraps ceres optimizer but works very bad afer few rounds of iteration:
[Thread 0x7fffd89f8700 (LWP 23968) exited]
[New Thread 0x7fffd89f8700 (LWP 23969)]
[Thread 0x7fffd89f8700 (LWP 23969) exited]
[New Thread 0x7fffd89f8700 (LWP 23970)]
[Thread 0x7fffd89f8700 (LWP 23970) exited]
[New Thread 0x7fffd89f8700 (LWP 23971)]
double free or corruption (out)
Thread 87 "livox_laserMapp" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffd89f8700 (LWP 23971)]
__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.
The program threw errors in
Thread 60 "livox_laserMapp" hit Breakpoint 1, Point_cloud_registration::find_out_incremental_transfrom (this=0x7fffd89ed280, in_laser_cloud_corner_from_map=..., in_laser_cloud_surf_from_map=..., kdtree_corner_from_map=..., kdtree_surf_from_map=..., laserCloudCornerStack=..., laserCloudSurfStack=...)
at /home/yiakwy/catkin_ws/src/loam_livox/source/point_cloud_registration.hpp:508
508 ceres::Solve( options, &problem, &summary );
(gdb)
let us move step by step:
Thread 60 "livox_laserMapp" hit Breakpoint 1, Point_cloud_registration::find_out_incremental_transfrom (this=0x7fffd89ed280, in_laser_cloud_corner_from_map=..., in_laser_cloud_surf_from_map=..., kdtree_corner_from_map=..., kdtree_surf_from_map=..., laserCloudCornerStack=..., laserCloudSurfStack=...)
at /home/yiakwy/catkin_ws/src/loam_livox/source/point_cloud_registration.hpp:508
508 ceres::Solve( options, &problem, &summary );
(gdb) c
Continuing.
Thread 60 "livox_laserMapp" hit Breakpoint 1, Point_cloud_registration::find_out_incremental_transfrom (this=0x7fffd89ed280, in_laser_cloud_corner_from_map=..., in_laser_cloud_surf_from_map=..., kdtree_corner_from_map=..., kdtree_surf_from_map=..., laserCloudCornerStack=..., laserCloudSurfStack=...)
at /home/yiakwy/catkin_ws/src/loam_livox/source/point_cloud_registration.hpp:508
508 ceres::Solve( options, &problem, &summary );
(gdb) c
Continuing.
double free or corruption (out)
This has nothing to do with Eigen.
changing PCL to 1.9 has solved the problem for ceres.
Hello, The livox_laserMapping node is crashing with some sort of memory issue:
Maybe you could run your code with address sanitizer to check for memory problems?
Cheers