Skip to content

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

@Lurvelly

Description

@Lurvelly

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();
                }
            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions