This repository was archived by the owner on May 31, 2025. It is now read-only.
Fix Issue 1346 - Make a copy of the topic list#1416
Merged
dirk-thomas merged 2 commits intoros:melodic-develfrom Jun 1, 2018
pbaughman:issue_1346_rosout_race
Merged
Fix Issue 1346 - Make a copy of the topic list#1416dirk-thomas merged 2 commits intoros:melodic-develfrom pbaughman:issue_1346_rosout_race
dirk-thomas merged 2 commits intoros:melodic-develfrom
pbaughman:issue_1346_rosout_race
Conversation
get_topics() returns a set, which is iterated by the Log constructor. Make a copy of the set (atomic in cpython!) so nobody adds or removes something while the Log constructor iterates over it
Member
|
Moving the |
Author
|
Aye - if you're comfortable with a slightly bigger footprint, that's probably a more robust fix |
This reverts commit 0e019e0. Move the fix to the _TopicManager so anybody else calling get_topics doesn't get burned by the same issue as _rosout
pbaughman
commented
Jun 1, 2018
| @@ -1348,7 +1348,7 @@ def get_topics(self): | |||
| @return: list of topic names this node subscribes to/publishes | |||
| @rtype: [str] | |||
Author
There was a problem hiding this comment.
This return type is a bit of a fib, I think, unless I don't understand the documentation syntax. Problem?
Member
|
This would be a good candidate for backporting. It's known to cause issues all the way back to indigo and is a pure bug fix. |
Member
|
Thank you for the updated patch. |
dirk-thomas
pushed a commit
that referenced
this pull request
Aug 9, 2018
* Make a copy of the topic list get_topics() returns a set, which is iterated by the Log constructor. Make a copy of the set (atomic in cpython!) so nobody adds or removes something while the Log constructor iterates over it * Revert "Make a copy of the topic list", Fix This reverts commit 0e019e0. Move the fix to the _TopicManager so anybody else calling get_topics doesn't get burned by the same issue as _rosout
dirk-thomas
pushed a commit
that referenced
this pull request
Aug 20, 2018
* Make a copy of the topic list get_topics() returns a set, which is iterated by the Log constructor. Make a copy of the set (atomic in cpython!) so nobody adds or removes something while the Log constructor iterates over it * Revert "Make a copy of the topic list", Fix This reverts commit 0e019e0. Move the fix to the _TopicManager so anybody else calling get_topics doesn't get burned by the same issue as _rosout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed fix from #1346
Description
get_topics() returns a set, which is iterated by the Log constructor. Make a copy of the set (atomic in cpython!) so nobody adds or removes something while the Log constructor iterates over it
A more optimized fix might be to use an immutable data structure inside the topic manager. I imagine that in the general case the topic list changes a lot less often than than calls are made to _rosout. It might be better to eat the overhead on topic add/remove instead of adding a copy operation to every _rosout call.