Use HTTP1.1: we get persistent connections for free#371
Use HTTP1.1: we get persistent connections for free#371RainCT wants to merge 1 commit intoros:hydro-develfrom
Conversation
|
I've tested this change on a real robot (two in-build computers, Python and C++ nodes, RViz, tablet & web UIs using rosbridge), everything seems to be working fine. |
|
Thank you for contributing. That looks like a nice benefit. I will merge this into the indigo-devel branch though since that is the upcoming ROS distro. In the future we might consider it for backporting to older ROS distros if there is need for it and it has worked fine for indigo for a while. |
|
Merged into indigo-devel: 53a2213 |
|
I rolled back the commit for now since this changes introduces a serious regression. Python scripts do not react to Ctrl+C anymore (under certain conditions). The following scenario should reproduce the problem:
|
|
Weird, the only thing I noticed is roscore taking a couple seconds to die on Ctrl+C. I'll look into it. |
|
It does not hang forever for you? I had to kill the process. |
|
Nope, I can't reproduce the problem with the {talker, listener}, the only change I notice is that the roscore sometimes takes a few seconds to stop if there are nodes talking. Tested with Hydro and Python 2.7.3 on Ubuntu Precise. |
|
Did you also Ctrl-C the roscore or only the talker and listener? |
|
Yes, IIRC I tried killing all three (and in different orders). |
|
And what is the behavior for you if you are not killing the roscore at all - and the other ones in the exact order as mentioned above? |
|
@RainCT Is it likely that you continue the work on this PR or should it be closed for now? |
|
I couldn't reproduce the problem you mentioned. |
|
Dirk, did you try this only in indigo, or only in hydro? |
|
This is what I get when I break with CTRL-C. Sometimes it lags a few seconds, but it always eventually dies. |
|
I just tried it again (this time on Trusty with Indigo) with the exact steps posted here: #371 (comment) And the problem is still there: terminal 2 does not terminate after pressing Ctrl+C (only after Ctrl+C the first terminal). |
|
You're completely right. You're scenario hangs on my precise+hydro also. thanks |
|
The Indigo release is done. But with a lot of testing it can still be added in a patch release. But that depends what is necessary to fix the problem. |
|
I think the problem is that the listener will not break until the 1 minute timer which monitors the connection detects that the talker is dead. That's why sometimes it breaks immediately, and some times it takes a long time to break. Dirk, did you ever wait more than 1 minute for the listener to die after pressing CTRL-C? |
|
No, I never waited that long. Without the patch the program exits immediately and that's the behavior which must be preserved. |
|
This is superseded by #610. |
Hi,
Currently rospy creates a new socket for every single request (eg. getParam call). Since sockets stay around for a while in CLOSE_WAIT state, this can become a serious problem.
Python's xmlrpc actually supports persistent connections. All that's needed is configuring SimpleXMLRPCRequestHandler to use HTTP 1.1 (vs. 1.0) and it'll automatically keep connections open and re-use them for subsequent calls.
With this you go from:
to: