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

Fit the spline doesn't work correctly. It will cause *Signal: SIGABRT (Aborted)* issue. #24

Open
Lurvelly opened this issue Sep 30, 2024 · 0 comments

Comments

@Lurvelly
Copy link

Hi, Thien-Minh Nguyen

Thanks for sharing your great work! I have learned a lot.

I found there may cause Signal: SIGABRT (Aborted) issue, if I turn the parameter "fit_spline" to 1.
screenshot-20240930-111113

I have debugged this issue and found there is a fault usage of std::thread in your code below:

slict/src/Estimator.cpp

Lines 1403 to 1412 in a733e7f

// Fit the spline at the ending segment to avoid high cost
std::thread threadFitSpline;
if (fit_spline)
{
static bool fit_spline_enabled = false;
if (SwTimeStep.size() >= WINDOW_SIZE && !fit_spline_enabled)
fit_spline_enabled = true;
else if(fit_spline_enabled)
threadFitSpline = std::thread(&Estimator::FitSpline, this);
}

You have allocated a thread object on the stack and the thread will be destroyed before a new loop.

So I have to trun the parameter "fit_spline" to 0, so that we can avoid create the issue.

fit_spline:         0

Here is a simple code to reproduct the Signal: SIGABRT (Aborted) issue:

//
// Created by Liuyang Li on 30/09/24.
//
#include <iostream>
#include <thread>

void test()
{
    for(int i = 0; i < 10000000; i++)
    {
        std::cout << i << std::endl;
    }
}

int main()
{
    std::thread t1(&test);
}

Sorry for my poor understand your SLAM system, I'm afraid of influencing the SLAM progress, so I can't fix this issue by myself.
Maybe you can use "join()" at the end of the loop

Screenshot from 2024-09-30 11-39-56

or just use "detach()" after creating the thread.

            // Fit the spline at the ending segment to avoid high cost
            std::thread threadFitSpline;
            if (fit_spline)
            {
                static bool fit_spline_enabled = false;
                if (SwTimeStep.size() >= WINDOW_SIZE && !fit_spline_enabled)
                    fit_spline_enabled = true;
                else if(fit_spline_enabled)
                {
                    threadFitSpline = std::thread(&Estimator::FitSpline, this);
                    threadFitSpline.detach();
                }
            }
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

1 participant