tesseract-robotics / tesseract

Motion Planning Environment
http://tesseract-docs.rtfd.io
Other
257 stars 89 forks source link

Octomap segfault #828

Open marip8 opened 1 year ago

marip8 commented 1 year ago

There appears to be a bug in the octomap library that causes a segfault for various cases.

tesseract_examples_basic_cartesian_example: /build/octomap-KdBKXz/octomap-1.9.3+dfsg/octomap/include/octomap/OcTreeDataNode.hxx:69: octomap::OcTreeDataNode<T>::~OcTreeDataNode() [with T = float]: Assertion `children == NULL' failed.

There is a PR that addresses this issue, but it hasn't been merged yet.

We might be able to add the same fixes to our code to fix this issue per discussion here

marip8 commented 1 year ago

Per @Levi-Armstrong

I tried to add the following in the prune function, but children is not accessible.

        if (node->children != NULL){
          delete[] node->children;
          node->children = NULL;
        }
Levi-Armstrong commented 1 year ago

I am starting to think there may be an issue with it finding different version of the library. The system installs version 1.9.3 and ros noetic has its own version of 1.9.8. If you run ldd on the example library and executable which is creating the error do you only see it linked against one version?

marip8 commented 1 year ago

I am starting to think there may be an issue with it finding different version of the library.

This is for sure caused by using the system version of liboctomap-dev rather than the one provided by the ROS build farm. I suppose there is a patch somewhere between 1.9.3 and 1.9.8 that resolves this issue

marip8 commented 1 year ago

@Levi-Armstrong how do you feel about adding the appropriate version of octomap to the dependencies.rosinstall? It's not ideal, but I can't find any later versions distributed on PPAs, etc. It also looks like jammy only provides version 1.9.7, which may also not solve the issue

Levi-Armstrong commented 1 year ago

I think adding it to the rosinstall is fine. Should we also add it to the CMake find_package for octomap also?

marip8 commented 1 year ago

I suppose there is a patch somewhere between 1.9.3 and 1.9.8 that resolves this issue

I forgot there is an open PR against octomap that fixes this, so it seems like 1.9.8 may only coincidentally fix this issue

I think adding it to the rosinstall is fine. Should we also add it to the CMake find_package for octomap also?

That might be a good idea, but it does technically compile with 1.9.x, so that restriction seems like it could be a bit overly conservative. I'm not sure if this problem always occurs with octomaps or just in this specific unit test

Levi-Armstrong commented 1 year ago

If this occurs on you machine you might run ldd and see if it is linking against both libraries which can cause weird behaviors like this.

marip8 commented 1 year ago

It looks like it only links against the system version