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

Thread received signal SIGSEGV, Segmentation fault #19

Open
LItwOK opened this issue May 13, 2018 · 6 comments
Open

Thread received signal SIGSEGV, Segmentation fault #19

LItwOK opened this issue May 13, 2018 · 6 comments

Comments

@LItwOK
Copy link

LItwOK commented May 13, 2018

(Similar problems : #12 and #16 )
I've set everything OK(environment variable, dataset.yaml and config.yaml), and when I run the program, it got the segmentation fault at Frame6 (of EuRoC dataset V1_01_easy), in the addMapLineObservation function in mapFeatures.cpp(line:116) and process exited.

Debug and reproduce:

------------------------------------------   Frame #6   ----------------------------------------
VO Runtime: 53.5049
Entropy ratio: 0.846844	0.0929229 3.8357 5
#KeyFrame:     1
#Points:       0
#Segments:     0
[New Thread 0x7fff9a7fc700 (LWP 6770)]
[New Thread 0x7fffa0d7a700 (LWP 6771)]
[New Thread 0x7fff9affd700 (LWP 6772)]
[New Thread 0x7fffb2110700 (LWP 6773)]
[New Thread 0x7fffa157b700 (LWP 6774)]
[New Thread 0x7fff99ffb700 (LWP 6775)]
[New Thread 0x7fff997fa700 (LWP 6776)]
[New Thread 0x7fff98ff9700 (LWP 6777)]
[Thread 0x7fff997fa700 (LWP 6776) exited]
[Thread 0x7fff99ffb700 (LWP 6775) exited]
[Thread 0x7fffa0d7a700 (LWP 6771) exited]
[Switching to Thread 0x7fff9b7fe700 (LWP 6696)]

Thread 19 "plslam_dataset" hit Breakpoint 2, PLSLAM::MapLine::addMapLineObservation (this=this@entry=0x7fff9001a240, desc_=..., kf_obs_=kf_obs_@entry=1, 
    obs_=..., dir_=..., pts_=..., sigma2_=sigma2_@entry=1) at /home/litw/litw/prjs/pl-slam-master/src/mapFeatures.cpp:112
112	    desc_list.push_back( desc_ );
(gdb) b 116
Breakpoint 3 at 0x7ffff7b9780b: file /home/litw/litw/prjs/pl-slam-master/src/mapFeatures.cpp, line 116.
(gdb) c
Continuing.
[Thread 0x7fffb141d700 (LWP 6682) exited]

Thread 19 "plslam_dataset" hit Breakpoint 3, PLSLAM::MapLine::addMapLineObservation (this=this@entry=0x7fff9001a240, desc_=..., kf_obs_=<optimized out>, 
    kf_obs_@entry=1, obs_=..., dir_=..., pts_=..., sigma2_=<optimized out>, sigma2_@entry=1) at /home/litw/litw/prjs/pl-slam-master/src/mapFeatures.cpp:116
116	    pts_list.push_back(pts_);`

Value of Variable at the breakpoint:

(gdb) p pts_
$2 = {
  <Eigen::PlainObjectBase<Eigen::Matrix<double, 4, 1, 0, 4, 1> >> = {
    <Eigen::MatrixBase<Eigen::Matrix<double, 4, 1, 0, 4, 1> >> = {
      <Eigen::DenseBase<Eigen::Matrix<double, 4, 1, 0, 4, 1> >> = {
        <Eigen::DenseCoeffsBase<Eigen::Matrix<double, 4, 1, 0, 4, 1>, 3>> = {
          <Eigen::DenseCoeffsBase<Eigen::Matrix<double, 4, 1, 0, 4, 1>, 1>> = {
            <Eigen::DenseCoeffsBase<Eigen::Matrix<double, 4, 1, 0, 4, 1>, 0>> = {
              <Eigen::EigenBase<Eigen::Matrix<double, 4, 1, 0, 4, 1> >> = {<No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, 
    members of Eigen::PlainObjectBase<Eigen::Matrix<double, 4, 1, 0, 4, 1> >: 
    m_storage = {
      m_data = {
        array = {50.080760955810547, 0.74377506971359253, 105.73883819580078, 199.69161987304688}
      }
    }
  }, <No data fields>}
(gdb) p pts_list
$3 = std::vector of length 1, capacity 1 = {{
    <Eigen::PlainObjectBase<Eigen::Matrix<double, 4, 1, 0, 4, 1> >> = {
      <Eigen::MatrixBase<Eigen::Matrix<double, 4, 1, 0, 4, 1> >> = {
        <Eigen::DenseBase<Eigen::Matrix<double, 4, 1, 0, 4, 1> >> = {
          <Eigen::DenseCoeffsBase<Eigen::Matrix<double, 4, 1, 0, 4, 1>, 3>> = {
            <Eigen::DenseCoeffsBase<Eigen::Matrix<double, 4, 1, 0, 4, 1>, 1>> = {
              <Eigen::DenseCoeffsBase<Eigen::Matrix<double, 4, 1, 0, 4, 1>, 0>> = {
                <Eigen::EigenBase<Eigen::Matrix<double, 4, 1, 0, 4, 1> >> = {<No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, 
      members of Eigen::PlainObjectBase<Eigen::Matrix<double, 4, 1, 0, 4, 1> >: 
      m_storage = {
        m_data = {
          array = {61.574352264404297, 0.58158671855926514, 111.35973358154297, 154.23118591308594}
        }
      }
    }, <No data fields>}}

The backtrace result:

(gdb) n

Thread 19 "plslam_dataset" received signal SIGSEGV, Segmentation fault.
Eigen::Matrix<double, 4, 1, 0, 4, 1>::Matrix(Eigen::Matrix<double, 4, 1, 0, 4, 1>&&) (other=<optimized out>, this=<optimized out>)
    at /usr/local/include/eigen3/Eigen/src/Core/Matrix.h:278
278	        Base::_set_noalias(other);
(gdb) bt
#0  Eigen::Matrix<double, 4, 1, 0, 4, 1>::Matrix(Eigen::Matrix<double, 4, 1, 0, 4, 1>&&) (other=<optimized out>, this=<optimized out>)
    at /usr/local/include/eigen3/Eigen/src/Core/Matrix.h:278
#1  std::_Construct<Eigen::Matrix<double, 4, 1, 0, 4, 1>, Eigen::Matrix<double, 4, 1, 0, 4, 1> >(Eigen::Matrix<double, 4, 1, 0, 4, 1>*, Eigen::Matrix<double, 4, 1, 0, 4, 1>&&) (__p=<optimized out>) at /usr/include/c++/7/bits/stl_construct.h:75
#2  std::__uninitialized_copy<false>::__uninit_copy<std::move_iterator<Eigen::Matrix<double, 4, 1, 0, 4, 1>*>, Eigen::Matrix<double, 4, 1, 0, 4, 1>*> (
    __result=<optimized out>, __last=..., __first=...) at /usr/include/c++/7/bits/stl_uninitialized.h:83
#3  std::uninitialized_copy<std::move_iterator<Eigen::Matrix<double, 4, 1, 0, 4, 1>*>, Eigen::Matrix<double, 4, 1, 0, 4, 1>*> (__result=<optimized out>, 
    __last=..., __first=...) at /usr/include/c++/7/bits/stl_uninitialized.h:134
#4  std::__uninitialized_copy_a<std::move_iterator<Eigen::Matrix<double, 4, 1, 0, 4, 1>*>, Eigen::Matrix<double, 4, 1, 0, 4, 1>*, Eigen::Matrix<double, 4, 1, 0, 4, 1> > (__result=<optimized out>, __last=..., __first=...) at /usr/include/c++/7/bits/stl_uninitialized.h:289
#5  std::__uninitialized_move_if_noexcept_a<Eigen::Matrix<double, 4, 1, 0, 4, 1>*, Eigen::Matrix<double, 4, 1, 0, 4, 1>*, std::allocator<Eigen::Matrix<double, 4, 1, 0, 4, 1> > > (__alloc=..., __result=<optimized out>, __last=0x7fff9001a3d0, __first=0x7fff9001a3b0) at /usr/include/c++/7/bits/stl_uninitialized.h:312
#6  std::vector<Eigen::Matrix<double, 4, 1, 0, 4, 1>, std::allocator<Eigen::Matrix<double, 4, 1, 0, 4, 1> > >::_M_realloc_insert<Eigen::Matrix<double, 4, 1, 0, 4, 1> const&> (this=this@entry=0x7fff9001a328, __position={
  <Eigen::PlainObjectBase<Eigen::Matrix<double, 4, 1, 0, 4, 1> >> = {
    <Eigen::MatrixBase<Eigen::Matrix<double, 4, 1, 0, 4, 1> >> = {
      <Eigen::DenseBase<Eigen::Matrix<double, 4, 1, 0, 4, 1> >> = {
        <Eigen::DenseCoeffsBase<Eigen::Matrix<double, 4, 1, 0, 4, 1>, 3>> = {
          <Eigen::DenseCoeffsBase<Eigen::Matrix<double, 4, 1, 0, 4, 1>, 1>> = {
            <Eigen::DenseCoeffsBase<Eigen::Matrix<double, 4, 1, 0, 4, 1>, 0>> = {
              <Eigen::EigenBase<Eigen::Matrix<double, 4, 1, 0, 4, 1> >> = {<No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, <No data fields>}, 
    members of Eigen::PlainObjectBase<Eigen::Matrix<double, 4, 1, 0, 4, 1> >: 
    m_storage = {
      m_data = {
        array = {6.9532629757965612e-310, 1.8280428896126122e-322, 6.9531436082559078e-310, 6.9532629705250784e-310}
      }
    }
  }, <No data fields>}, __args#0=...) at /usr/include/c++/7/bits/vector.tcc:424
#7  0x00007ffff7b97817 in std::vector<Eigen::Matrix<double, 4, 1, 0, 4, 1>, std::allocator<Eigen::Matrix<double, 4, 1, 0, 4, 1> > >::push_back (__x=..., 
    this=<optimized out>) at /usr/include/c++/7/bits/stl_vector.h:948
#8  PLSLAM::MapLine::addMapLineObservation (this=this@entry=0x7fff9001a240, desc_=..., kf_obs_=<optimized out>, kf_obs_@entry=1, obs_=..., dir_=..., 
    pts_=..., sigma2_=<optimized out>, sigma2_@entry=1) at /home/litw/litw/prjs/pl-slam-master/src/mapFeatures.cpp:116
#9  0x00007ffff7b3d662 in PLSLAM::MapHandler::matchKF2KFLines (this=this@entry=0x684900, prev_kf=<optimized out>, curr_kf=<optimized out>)
    at /home/litw/litw/prjs/pl-slam-master/src/mapHandler.cpp:464
#10 0x00007ffff7b4fe6c in PLSLAM::MapHandler::lookForCommonMatches (this=this@entry=0x684900, kf0=0x9027740, kf1=@0x684ac8: 0x6c7ea0)
    at /home/litw/litw/prjs/pl-slam-master/src/mapHandler.cpp:760
#11 0x00007ffff7b50a20 in PLSLAM::MapHandler::localMappingThread (this=0x684900) at /home/litw/litw/prjs/pl-slam-master/src/mapHandler.cpp:1100
#12 0x00007ffff601756f in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#13 0x00007ffff65b86ba in start_thread (arg=0x7fff9b7fe700) at pthread_create.c:333
#14 0x00007ffff5a7f41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
(gdb) info threads
  Id   Target Id         Frame 
  1    Thread 0x7ffff7f06a00 (LWP 6634) "plslam_dataset" 0x00007ffff65b998d in pthread_join (threadid=140735785453312, thread_return=0x0)
    at pthread_join.c:90
  2    Thread 0x7fffdc6ca700 (LWP 6673) "plslam_dataset" syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
  3    Thread 0x7fffd42c9700 (LWP 6674) "plslam_dataset" syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
  4    Thread 0x7fffd7fff700 (LWP 6675) "plslam_dataset" syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
  5    Thread 0x7fffd7bfe700 (LWP 6676) "plslam_dataset" 0x00007ffff5a7374d in poll () at ../sysdeps/unix/syscall-template.S:84
  6    Thread 0x7fffd3ec8700 (LWP 6677) "dconf worker" 0x00007ffff5a7374d in poll () at ../sysdeps/unix/syscall-template.S:84
  7    Thread 0x7fffd36c7700 (LWP 6678) "gmain" 0x00007ffff5a7374d in poll () at ../sysdeps/unix/syscall-template.S:84
  8    Thread 0x7fffd2ec6700 (LWP 6679) "gdbus" 0x00007ffff5a7374d in poll () at ../sysdeps/unix/syscall-template.S:84
  9    Thread 0x7fffd09aa700 (LWP 6680) "radeon_cs:0" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  10   Thread 0x7fffb3fff700 (LWP 6681) "disk_cache:0" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  18   Thread 0x7fffb0c1c700 (LWP 6695) "plslam_dataset" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
* 19   Thread 0x7fff9b7fe700 (LWP 6696) "plslam_dataset" Eigen::Matrix<double, 4, 1, 0, 4, 1>::Matrix(Eigen::Matrix<double, 4, 1, 0, 4, 1>&&) (
    other=<optimized out>, this=<optimized out>) at /usr/local/include/eigen3/Eigen/src/Core/Matrix.h:278
  20   Thread 0x7fff9bfff700 (LWP 6697) "plslam_dataset" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  93   Thread 0x7fff9a7fc700 (LWP 6770) "plslam_dataset" 0x00007ffff65b998d in pthread_join (threadid=140735900268288, thread_return=0x0)
    at pthread_join.c:90
  95   Thread 0x7fff9affd700 (LWP 6772) "plslam_dataset" 0x00007ffff65b998d in pthread_join (threadid=140736180848384, thread_return=0x0)
    at pthread_join.c:90
  96   Thread 0x7fffb2110700 (LWP 6773) "plslam_dataset" 0x00007fffefc555f6 in cv::LineSegmentDetectorImpl::ll_angle(double const&, unsigned int const&) ()
   from /usr/local/lib/libopencv_imgproc.so.3.4
  97   Thread 0x7fffa157b700 (LWP 6774) "plslam_dataset" 0x00007fffefea7002 in iwAtomic_AddInt () from /usr/local/lib/libopencv_imgproc.so.3.4
  100  Thread 0x7fff98ff9700 (LWP 6777) "plslam_dataset" 0x00007fffefc555fc in cv::LineSegmentDetectorImpl::ll_angle(double const&, unsigned int const&) ()
   from /usr/local/lib/libopencv_imgproc.so.3.4

Source codes:

  • in mapFeatures.cpp
void MapLine::addMapLineObservation(Mat desc_, int kf_obs_, Vector3d obs_, Vector3d dir_, Vector4d pts_, double sigma2_)
{
    desc_list.push_back( desc_ );
    obs_list.push_back( obs_ );
    kf_obs_list.push_back( kf_obs_ );
    dir_list.push_back( dir_ );
    pts_list.push_back(pts_);
    sigma_list.push_back(sigma2_);
    updateAverageDescDir();
}
  • in mapHandler.cpp
int MapHandler::matchKF2KFLines(KeyFrame *prev_kf, KeyFrame *curr_kf) {
    ......
    map_line->addMapLineObservation(curr_frame->ldesc_l.row(i2),
                                            kf2_idx,
                                            curr_frame->stereo_ls[i2]->le,
                                            mP3d,
                                            pts);
    ......
}

This problem is driving me crazy because I don't understand how it make the process crash at push_back()... It doesn't make sense because there isn't any other thread reading from that vector, and the argument is right. And there aren't same problem with other vector members in the same class. If you have any idea how this occurs or how to solve it, please tell me. Thank you very much!

@rubengooj
Copy link
Owner

Hi,

I've never seen this error before, have you checked if you're receiving the same error when setting the 'mutithread_slam' flag to false? You can try using the last commit of pl-slam with the same version of Eigen as we're using (3.2.92)?

Best

@LItwOK
Copy link
Author

LItwOK commented Jun 6, 2018 via email

@New-Wlearner
Copy link

Hi,

I've never seen this error before, have you checked if you're receiving the same error when setting the 'mutithread_slam' flag to false? You can try using the last commit of pl-slam with the same version of Eigen as we're using (3.2.92)?

Best

Hey,
The mutithread_slam is flase already, but it's also doesn't work.
Waitting for your update.
Thank you.

@kzf-git
Copy link

kzf-git commented Aug 28, 2021

@LItwOK
Hi,

I had the same problem "pts_list.push_back( pts_ );" in mapFeature.cpp, resulting in Segmentation fault (core dumped). Only when I comment (//) this sentence can it run normally. Did you solve this problem? If yes, can you tell me how to solve it?

@latva
Copy link

latva commented Nov 15, 2021

Hi,

I get it working by changing row 94 in mapFeature.h to the code below.

std::vector<Eigen::Vector4d,Eigen::aligned_allocator<Eigen::Vector4d>> pts_list;

@Yanjiqiang
Copy link

Hi,

I get it working by changing row 94 in mapFeature.h to the code below.

std::vector<Eigen::Vector4d,Eigen::aligned_allocator<Eigen::Vector4d>> pts_list;

hi,have you run this code on KITTI datasets? I have encountered this problem on KITTI 02, and after modifying what you wrote it didn't work, do you have any suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants