This repository has been archived by the owner on Feb 3, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 498
Avoid deadlock in ConnectionManager::Stop #2950
Merged
scpeters
merged 2 commits into
gazebosim:gazebo11
from
ivanpauno:ivanpauno/avoid-connection-manager-stop-deadlock
Apr 7, 2021
Merged
Avoid deadlock in ConnectionManager::Stop #2950
scpeters
merged 2 commits into
gazebosim:gazebo11
from
ivanpauno:ivanpauno/avoid-connection-manager-stop-deadlock
Apr 7, 2021
Conversation
This file contains 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
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
jacobperron
approved these changes
Apr 6, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested this together with #2949 and it haven't seen any lingering gzserver process after shutdown.
@jacobperron if you have write permissions, please go ahead and merge. (the PR checkers failures doesn't seem related to me, but IDK) |
I was having trouble reproducing this reliably, but with the following patch it happen every time (lol)
|
I merged this branch with |
scpeters
approved these changes
Apr 7, 2021
scpeters
added a commit
to scpeters/gazebo
that referenced
this pull request
Apr 14, 2021
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com> Co-authored-by: Steve Peters <scpeters@openrobotics.org>
scpeters
added a commit
to scpeters/gazebo
that referenced
this pull request
Apr 16, 2021
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com> Co-authored-by: Steve Peters <scpeters@openrobotics.org>
scpeters
added a commit
that referenced
this pull request
Apr 21, 2021
Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com> Co-authored-by: Steve Peters <scpeters@openrobotics.org>
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.
Similarly to #2949, it fixes another condition where
gzserver
hangs when shutting down.The main thread was interrepted by sigint and is waiting for
ConnectionManager::Stop()
to finish:That will never happen, because
gazebo::rendering::Scene::PreRender()
was interrupted while taking this mutex and the connection manager thread got stuck in the same mutex:i.e. this
while
loop:https://github.com/osrf/gazebo/blob/2df3bfb039c1f5616122a0452ece99a8f3395e17/gazebo/transport/ConnectionManager.cc#L308-L316
will get stuck in L310 and never reach L316.
The solution is that
Stop()
will not wait until the background thread exits the loops, but just signal its ending.I also deleted the condition variable
notify_all()
call, as that's not signal safe.There's only a timed wait, so notifying or not shouldn't matter.