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

Prevent possible infinite loop in keyframe traversal #244

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mdailey
Copy link

@mdailey mdailey commented Jan 30, 2017

Love this project!

I ran into a deadlock running ORB SLAM right after a loop closure after about 3 minutes of video. Tracking had stopped, local mapping had stopped, and the process was using about 1.2 CPUs but doing nothing visible. Attaching to the running process in gdb revealed that the tracking thread was waiting for the mpMap->mMutexMapUpdate lock, but it couldn't acquire it because the loop closure thread never completed its spanning tree traversal. I guess that somehow a cycle must have been introduced into the map's keyframe spanning tree.

I suppose the inconsistency in the tree should really be further investigated and fixed, but here I've just added a "visited" flag to the keyframe data structure to prevent loop closing from getting stuck indefinitely. That seems like a good idea regardless.

@AlejandroSilvestri
Copy link

@mdailey , that's a good idea indeed.

Did it eliminate your problem? Does the loop close as expected?

@mdailey
Copy link
Author

mdailey commented Mar 27, 2017

@AlejandroSilvestri , I've done quite a few runs with the modification, I haven't gotten any deadlock, and loop closing seems to be working as expected. However, on the other hand, I also haven't gone into more detailed debugging to find out what if anything caused the cycle in the spanning tree in the first place. Still, seems to me that cycle avoidance is important.

@AlejandroSilvestri
Copy link

@mdailey , I must say I found a lot of broken pointers (mappoints and keyframes) while saving maps, I can't identify their cause, but the spanning tree is difficult to debug, I think there may be a bug in there.

lukeqsun pushed a commit to lukeqsun/ORB_SLAM2 that referenced this pull request Sep 22, 2017
mdailey@f5df5f6
Prevent possible infinite loop in keyframe traversal by mdailey · Pull Request raulmur#244 · raulmur/ORB_SLAM2
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

Successfully merging this pull request may close these issues.

2 participants