-
Notifications
You must be signed in to change notification settings - Fork 45
Description
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.

I have debugged this issue and found there is a fault usage of std::thread in your code below:
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: 0Here 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
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();
}
}