This repository was archived by the owner on May 31, 2025. It is now read-only.
Abort topic lookup on connection refused#1044
Merged
dirk-thomas merged 1 commit intoros:lunar-develfrom May 12, 2017
Merged
Conversation
mikepurvis
added a commit
that referenced
this pull request
May 2, 2017
mikepurvis
reviewed
May 2, 2017
| if getattr(e, 'errno', None) == errno.ECONNREFUSED: | ||
| code = errno.ECONNREFUSED | ||
| msg = str(e) | ||
| break |
Member
There was a problem hiding this comment.
The early return down below only triggers when code <= 0, but you're assigning it a positive value. What is the expected behaviour here, when we break out of the while loop?
Contributor
Author
There was a problem hiding this comment.
Good catch, the intention is to return at the early return. But the errno will be positive. Let me fix that.
In a multimaster environment where a topic has multiple publishers, when a node drops out abruptly (host is shutdown), a single subscriber update on that topic will cause multiple threads to be created (one for each host) in order to resolve the topic location. This cause a thread leak as host which are turned off will not respond and when they come back online, the xmlrpc URI is changed causing a connection refused error at the socket layer. This fix catches the connection refused error and terminate the thread with the understanding that if the connection is refused, the rosnode cannot be reached now or never. This effectively prevents thread leak. Note: if the remote host where the rosnode is thought to be never comes back up, then the thread will still be leaked as the exception received is a host unreachable type. This is intentional to avoid abruptly terminating the thread in case of a temporary DNS failure.
e41901f to
a61b63c
Compare
Contributor
Author
|
Ping for review... |
Member
|
@dirk-thomas We've been running this on our bots for the week; would like to get it merged if there's no objection. |
Member
|
Sounds good to me. Thank you both for your effort on this. |
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.
In a multimaster environment where a topic has multiple publishers,
when a node drops out abruptly (host is shutdown), a single subscriber update on
that topic will cause multiple threads to be created (one for each host) in order to
resolve the topic location. This cause a thread leak as host which are turned off
will not respond and when they come back online, the xmlrpc URI is changed causing a
connection refused error at the socket layer.
This fix catches the connection refused error and terminate the thread with the understanding
that if the connection is refused, the rosnode cannot be reached now or never. This effectively
prevents thread leak.
Note: if the remote host where the rosnode is thought to be never comes back up,
then the thread will still be leaked as the exception received is a host unreachable type.
This is intentional to avoid abruptly terminating the thread in case of a temporary DNS failure.