microsoft / mageslam

A lightweight monocular SLAM written in C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Race condition in TrackLocalMapWorker.cpp

syntheticmagus opened this issue · comments

// BUG: make sure the pose estimation waits for the updated history

The bug referred to by this line actually manifests as coming from Runtime.cpp, where a timing issue allows TrackingData.IsLost to be true while m_trackLocalMapWorker->GetHistory() is still empty, sending the program down the wrong side of a conditional statement that ultimately crashes when it tries to use information from the empty pose history.

The correct solution to this problem is likely to revise either the task chain or the scheduler to ensure that the pose history must be updated before IsLost is set to true. However, a quicker workaround that simply checks the history size when it checks IsLost can prevent crashes immediately and thus may be worth adding in the short term.

Workaround added in #12.