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

Delete frame_locked_markers when reusing marker #907

Merged
merged 1 commit into from
Sep 26, 2022

Conversation

sloretz
Copy link
Contributor

@sloretz sloretz commented Sep 20, 2022

Fixes #906

This makes sure to delete the marker from frame_locked_markers_ when reusing an old marker.

If a existing Marker is frame locked, but a new marker uses the same ID and is not frame locked then the marker in markers_ gets deleted, but the frame_locked_markers_ entry was not. That was causing RViz to try to update markers that didn't exist.

Separately, keeping separate std::set for markers_with_expiration_ and frame_locked_markers_ seems like it's keeping state in two places. It might be worth refactoring this code in the future to iterate over markers_ instead of trying to keep three containers in sync.

This PR is backportable

Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
@sloretz sloretz added the bug Something isn't working label Sep 20, 2022
@sloretz sloretz self-assigned this Sep 20, 2022
@sloretz
Copy link
Contributor Author

sloretz commented Sep 20, 2022

CI (build: --packages-above-and-dependencies rviz_default_plugins test: --packages-above rviz_default_plugins)

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@clalancette
Copy link
Contributor

Separately, keeping separate std::set for markers_with_expiration_ and frame_locked_markers_ seems like it's keeping state in two places. It might be worth refactoring this code in the future to iterate over markers_ instead of trying to keep three containers in sync.

While I like that idea in theory, I'm somewhat concerned about the performance implications of doing so. That is, one refactoring I could see would be to add a simple boolean flag to each marker to determine whether it is expired or frame locked. Then we would just have the markers_ map that contains MarkerID -> MarkerBasePtr. That would definitely make the code easier to follow, and prevent bugs like the one you are fixing here. But it would also mean that in order to find these markers, we would have to traverse the entire map to find them, which could be slow with a lot of markers in play. So I'm not sure that it is a straight win (I guess some benchmarking would have to be done).

Regardless, that is not what you are doing here, so I'll just review this code :).

@sloretz sloretz merged commit dbc240d into rolling Sep 26, 2022
@delete-merged-branch delete-merged-branch bot deleted the sloretz__fix_frame_locked_markers branch September 26, 2022 16:57
@sloretz
Copy link
Contributor Author

sloretz commented Sep 26, 2022

@Mergifyio backport humble galactic foxy

mergify bot pushed a commit that referenced this pull request Sep 26, 2022
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>

Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
(cherry picked from commit dbc240d)
mergify bot pushed a commit that referenced this pull request Sep 26, 2022
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>

Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
(cherry picked from commit dbc240d)
@mergify
Copy link

mergify bot commented Sep 26, 2022

backport humble galactic foxy

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Sep 26, 2022
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>

Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
(cherry picked from commit dbc240d)
sloretz added a commit that referenced this pull request Sep 26, 2022
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>

Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
(cherry picked from commit dbc240d)

Co-authored-by: Shane Loretz <sloretz@osrfoundation.org>
sloretz added a commit that referenced this pull request Sep 26, 2022
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>

Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
(cherry picked from commit dbc240d)

Co-authored-by: Shane Loretz <sloretz@osrfoundation.org>
sloretz added a commit that referenced this pull request Sep 26, 2022
Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>

Signed-off-by: Shane Loretz <sloretz@osrfoundation.org>
(cherry picked from commit dbc240d)

Co-authored-by: Shane Loretz <sloretz@osrfoundation.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash in Ogre::GLStateCacheManager using visualization_msgs/msg/MarkerArray
2 participants