-
Notifications
You must be signed in to change notification settings - Fork 913
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
rosmaster leaves sockets in CLOSE_WAIT state #610 #834
Conversation
Can you please update the imports to something like |
tools/rosgraph/package.xml
Outdated
@@ -16,6 +16,7 @@ | |||
|
|||
<run_depend>python-netifaces</run_depend> | |||
<run_depend>python-rospkg</run_depend> | |||
<run_depend>python-requests</run_depend> |
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.
Please move the line one up to maintain alphabetical order.
You mentioned that you "added some catch statements that re-throw the "original" exceptions to not break too many packages that catch the original exceptions". Are there any cases where the modified implementation raises different exceptions or behaves differently? Are you expecting to still break some use cases? |
# We could add more exception mappings here: | ||
# - requests.exceptions.InvalidURL -> socket.gaierror? | ||
# - requests.exceptions.InvalidSchema -> socket.gaierror? | ||
raise exc |
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.
Yes, the requests library throws totally different exceptions. With requests you'll get an exception derived from requests.RequestException (http://docs.python-requests.org/en/master/_modules/requests/exceptions/#RequestException) where the standard implementation would throw socket.error or maybe also httplib.HTTPExcetion. I added statements to throw a socket.timeout exception for timeouts and socket.error if e.g. the remote port is closed. As you can see in the comment, there are more exceptions possible like InvalidURL or InvalidSchema. If you think that adding this compatibility layer makes sense I can further extend this mapping.
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.
Since this change should address some serious problems in the current implementation I think it would be great to add. One critical question will be which ROS distro to target though. This PR is made against Indigo which I would almost rule out since it seems to be a too drastic change with too much chance for regressions for a distro already released more then two years ago.
It good target Kinetic but it would still take a lot of testing (hopefully by multiple parties) to ensure that it doesn't break anything.
The most conservative would be to only aim for the to be released L-turtle but that would mean a long time until it is actually being used (and tested in the field).
Therefore I think Kinetic is a reasonable target. We should try to maintain as much of the behavior (with the same exceptions) as reasonably possible. So if you see other extensions not being mapped yet it would be great to add them.
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 would use just raise
in this line (without the explicit argument). That carries the intention better imo.
@mgrrx This needs to be moved to target kinetic-devel. I would do it for you, but I don't have write access to your fork. For now going to remove the hitlist label until it merges cleanly (it's messing up some automation I'm working on). |
I will take care. |
…brary for HTTP/1.1 requests
…e compatible with existing try...catch blocks
…e compatible with existing try...catch blocks
rebased to kinetic-devel |
@ros-pull-request-builder retest this please |
@ros-pull-request-builder retest this please |
I just merged #981, which fixed the failing tests on the kinetic-devel branch. Therefore this should hopefully pass now... @ros-pull-request-builder retest this please |
The tests fail because the master api now raises a |
I'll have a look tomorrow, thank you! |
Okay, so we've now been running this for a few weeks, and we're having issues in our logs with a lot of messages that look like this coming from some rospy processes:
These seem to be originating from the version of urllib3 that's bundled with Requests, specifically this line: https://github.com/shazow/urllib3/blob/1.8/urllib3/connectionpool.py#L171 Now, the wrinkle in all this is that we're running all our robots still on Ubuntu Trusty, and we're using the default system version of Requests, which is 2013 vintage. So it's possible this change would be perfectly fine with the Requests that comes with Ubuntu Xenial, but we don't have a great way of testing that at the moment, short of backporting it (which we may well do anyway). |
Dropping testing from this for now as we're entering a release sprint— in a few weeks, I'll add it back in in conjunction with testing on an updated |
@mikepurvis Any update? I'm very happy if this is merged. |
Hi, we have been testing this on Ubuntu Trusty machine and works great for a few days, so it's ok to merge this. |
@mgrrx Can you please take a look at the additional patches @furushchev added in #1024 and consider to merge them into your branch in order to add them to this PR. @k-okada Previous testing has shown some regressions which seemed to be related to this patch. So I don't consider this to be ready to be merge at the moment even if it addresses the |
We're now equipped to install an updated |
Hi, after I tried this patch on our robot and confirmed that with this patch there is no more
|
Hi there, I further investigated and I found another approach to maintain one rosmaster without crash. And here is python code for this. It looks very dirty and I totally don't have an idea how to integrate this to ros repository though: |
This should be addressed by #1104. |
I will close this for now assuming this patch isn't needed anymore. Please feel to comment and the ticket can be reopened. |
As already discussed in #610, this PR requires extensive testing. This PR replaces the HTTP backend of xmlrpclib by python-requests to fix the HTTP keep-alive problem that has been there for more than one year. This fix does NOT fix all CLOSE_WAIT issues that I observed on our robots (see #831 and #833), it only fixes the problem that is caused by the rosmaster <-> python xmlrpclib communication.
One side effect of the python-requests library ist that it throws completely different exceptions if e.g. the rosmaster is not reachable. I added some catch statements that re-throw the "original" exceptions to not break too many packages that catch the original exceptions.