SegFault: PCL 1.8 Feature Computation

classic Classic list List threaded Threaded
5 messages Options
tbb
Reply | Threaded
Open this post in threaded view
|

SegFault: PCL 1.8 Feature Computation

tbb
Hey,

Unfort. I'm getting a segfault if I start to use any feature computation! (FPH, GASD)
Using gdb I was able to pinpoint the problem down to this: 

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7a8c154 in void Eigen::internal::pstore<float, float __vector>(float*, float __vector const&) () from /usr/lib/libpcl_common.so.1.8

after some research, i've found some threads about compiling PCL with the C++11 flag,
but this seems related to PCL 1.7. So any advice on this?

Thanks!

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: SegFault: PCL 1.8 Feature Computation

Stephen McDowell
hmmmmm.

The method your showing here is part of the backend of Eigen, specifically the vectorization backend.  A likely reason for getting a segfault here is because you somehow (indirectly) called a method with an unaligned memory pointer.  SSE / AVX etc instructions require specifically aligned memory, when you execute these instructions on unaligned memory the typical result is either a segfault or a bus error depending on the scenario (and operating system).

Did you compile PCL yourself?

IIRC the point cloud class uses Eigen’s aligned memory allocator for all point clouds.  Particularly if you compiled PCL yourself, this would lead me to suspect an Eigen bug of some kind.

If you did compile yourself, I think a good course of action would be to re-compile with a newer version of Eigen.


It’s just a simple find_package(Eiegen), but I don’t think it is advisable to just download a copy and hard-code the value when building.  You will want to make sure that the new version of Eigen is found with `find_package(Eigen)`.  If you hard code a path, in other packages (e.g. whatever project you are working with PCL with) will find the original Eigen that led to this bug in the first place.  That may be a problem, it may not (feel free to ask for help and I will include more information on that, just install it to a custom location and make sure to update CMAKE_MODULE_PATH correctly).

There hasn’t been a new release from Eigen in quite some time, maybe the latest master branch will have this problem solved?

On the other hand, you could end up in the same position :/

So maybe before going down this road, inspect your current code and the internal memory of your cloud.  They’re just std::vector’s so you can get the pointer to the memory easily enough.  With the pointer to the memory, you can check using the method described in this answer: https://stackoverflow.com/a/1898487/3814202

Assuming the memory is aligned (it should be), recompiling is the only thing I can think of.  If it were your own code, you could compile with DEIGEN_DONT_VECTORIZE to bypass it, but since the segfault is coming from within the compiled PCL code, it’s too late for that :/

I hope some of that is helpful, but I worry it may point you in the wrong direction and ultimately be fruitless.  This was all guesswork based on the information you gave and the specific method involved, but it could be something completely different…


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
tbb
Reply | Threaded
Open this post in threaded view
|

Re: SegFault: PCL 1.8 Feature Computation

tbb
Hey thank you so much for the thoughtful answer :-) I actually manage to fix it during they day. By adding the c++11 flag at front of the cmake list and making sure it does use the flag during pcl computation I was able to solve it! So even in the latest pcl version this seems to necessary to do! (And not just 1.7)

Thanks again and cheers


Stephen McDowell <[hidden email]> schrieb am Di., 17. Apr. 2018, 18:59:
hmmmmm.

The method your showing here is part of the backend of Eigen, specifically the vectorization backend.  A likely reason for getting a segfault here is because you somehow (indirectly) called a method with an unaligned memory pointer.  SSE / AVX etc instructions require specifically aligned memory, when you execute these instructions on unaligned memory the typical result is either a segfault or a bus error depending on the scenario (and operating system).

Did you compile PCL yourself?

IIRC the point cloud class uses Eigen’s aligned memory allocator for all point clouds.  Particularly if you compiled PCL yourself, this would lead me to suspect an Eigen bug of some kind.

If you did compile yourself, I think a good course of action would be to re-compile with a newer version of Eigen.


It’s just a simple find_package(Eiegen), but I don’t think it is advisable to just download a copy and hard-code the value when building.  You will want to make sure that the new version of Eigen is found with `find_package(Eigen)`.  If you hard code a path, in other packages (e.g. whatever project you are working with PCL with) will find the original Eigen that led to this bug in the first place.  That may be a problem, it may not (feel free to ask for help and I will include more information on that, just install it to a custom location and make sure to update CMAKE_MODULE_PATH correctly).

There hasn’t been a new release from Eigen in quite some time, maybe the latest master branch will have this problem solved?

On the other hand, you could end up in the same position :/

So maybe before going down this road, inspect your current code and the internal memory of your cloud.  They’re just std::vector’s so you can get the pointer to the memory easily enough.  With the pointer to the memory, you can check using the method described in this answer: https://stackoverflow.com/a/1898487/3814202

Assuming the memory is aligned (it should be), recompiling is the only thing I can think of.  If it were your own code, you could compile with DEIGEN_DONT_VECTORIZE to bypass it, but since the segfault is coming from within the compiled PCL code, it’s too late for that :/

I hope some of that is helpful, but I worry it may point you in the wrong direction and ultimately be fruitless.  This was all guesswork based on the information you gave and the specific method involved, but it could be something completely different…

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: SegFault: PCL 1.8 Feature Computation

Stephen McDowell
Oh yay!  Glad you solved it :)

So to clarify in case future users encounter similar problems, you needed to compile PCL with c++11, or you needed to compile your project using PCL with c++11?


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
tbb
Reply | Threaded
Open this post in threaded view
|

Re: SegFault: PCL 1.8 Feature Computation

tbb
Just the compilation of pcl with the c++11 flag is needed. My own project did not need this flag to work properly. 

Stephen McDowell <[hidden email]> schrieb am Di., 17. Apr. 2018, 20:52:
Oh yay!  Glad you solved it :)

So to clarify in case future users encounter similar problems, you needed to compile PCL with c++11, or you needed to compile your project using PCL with c++11?


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users