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

Segmentation Fault when calling AddGeometry() about 65535 times. #4992

Open
3 tasks done
jaehyuck0103 opened this issue Apr 12, 2022 · 3 comments
Open
3 tasks done

Segmentation Fault when calling AddGeometry() about 65535 times. #4992

jaehyuck0103 opened this issue Apr 12, 2022 · 3 comments
Labels
bug Not a build issue, this is likely a bug.

Comments

@jaehyuck0103
Copy link

Checklist

Describe the issue

The segfault happens after calling AddGeometry() about 65535 times.
The type of geometry does not matter.
There may be a 16bit overflow error.

Steps to reproduce the bug

#include <chrono>
#include <iostream>
#include <mutex>
#include <thread>

#include "open3d/Open3D.h"
#include "open3d/t/geometry/LineSet.h"

using namespace open3d;
using namespace open3d::visualization;

class MultipleWindowsApp {
public:
    MultipleWindowsApp() { gui::Application::GetInstance().Initialize(); }

    void Run() {
        main_vis_ = std::make_shared<visualizer::O3DVisualizer>(
                "Open3D - Multi-Window Demo", 1024, 768);
        main_vis_->ShowSettings(false);
        main_vis_->ShowSkybox(false);

        // camera setting
        main_vis_->ResetCameraToDefault();
        main_vis_->SetupCamera(60, {0, 0, 0}, {0, 0, -3}, {0.0f, -1.0f, 0.0f});

        gui::Application::GetInstance().AddWindow(main_vis_);

        std::thread read_thread([this]() { this->ReadThreadMain(); });
        gui::Application::GetInstance().Run();
        read_thread.join();
    }

private:
    void ReadThreadMain() {
        // Init Geo
        core::Tensor vertices(
                std::vector<float>{-10.0, -10.0, -10.0, 10.0, 10.0, 10.0},
                {2, 3}, core::Float32);
        core::Tensor edges{std::vector<int>{0, 1}, {1, 2}, core::Int32};
        any_geo_ = std::make_shared<t::geometry::LineSet>(vertices, edges);

        //
        for (int count = 0;; ++count) {
            std::cout << count << "\n";
            std::this_thread::sleep_for(std::chrono::milliseconds(5));

            // If uncommnet below, the segfault not happens.
            /*
            if (count >= 65000) {
                continue;
            }
            */

            // Update geometry (skip in this example)

            // Rendering
            gui::Application::GetInstance().PostToMainThread(
                    main_vis_.get(), [this]() {
                        std::lock_guard<std::mutex> lock(render_lock_);
                        main_vis_->RemoveGeometry("geo_name");
                        main_vis_->AddGeometry("geo_name", any_geo_);
                    });
        }
    }

private:
    std::shared_ptr<visualizer::O3DVisualizer> main_vis_;

    std::mutex render_lock_;
    std::shared_ptr<t::geometry::LineSet> any_geo_;
};

int main() {
    MultipleWindowsApp().Run();
    return 0;
}

Error message

Segmentation fault (core dumped)

Expected behavior

No response

Open3D, Python and System information

- Operating system: Ubuntu 20.04
- Open3D version: 0.15.1
- System architecture: x86
- Is this a remote workstation?: no
- How did you install Open3D?: Use pre built open3d-devel-linux-x86_64-cxx11-abi-0.15.1
- Compiler version (if built from source): gcc 9.4

Additional information

#4881 looks related issue.

@jaehyuck0103 jaehyuck0103 added the bug Not a build issue, this is likely a bug. label Apr 12, 2022
@peterzxli
Copy link

peterzxli commented May 4, 2022

@theNded @errissa @yxlao Can you please let us know how to resolve this? It seems that quite a number of users reported similar issue.

I am currently working on a SLAM system with a large number of input images. Due to this issue, I have to avoid updating the visualizer every image frame so that the visualizer does not crash. Thus, I am unable to provide frame-by-frame visualization of my results, which is really undesirable.

Thank you for your time in advance! We greatly appreciated it!

@jen-co
Copy link

jen-co commented Sep 30, 2022

Also can confirm I am hitting this issue - segmentation fault after 65535 calls of remove and add geometry. My info:

  • OS: MacOS Monterey 12.6
  • Open3D version: 0.15.1
  • Is this a remote workstation?: no
  • How did you install Open3D?: using pip

Thanks!

@tlind
Copy link

tlind commented Feb 28, 2024

We are experiencing the same issue with Open3D version 0.17, installed via pip, on Ubuntu 20.04. It would be nice to have a fix for this, as in our case there is no easy workaround except for restarting our Open3D application every 15 minutes.

@cdh981009 cdh981009 mentioned this issue Jul 29, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not a build issue, this is likely a bug.
Projects
None yet
Development

No branches or pull requests

4 participants