-
Notifications
You must be signed in to change notification settings - Fork 914
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
[xmlrpcpp] close socket when connection can't be accepted. Fixes #914 #960
Conversation
Looks like this has been there forever (at least I didn't find an argument against it): |
I wish we had a test or something to exercise this execution path. It seems really hinky to have a "fix" that's essentially just uncommenting something previously commented. |
I carefully checked when this statement is executed. Basically, it's only called if ::accept returns -1. In my opinion, all the errors described in the manpage suggest to close the file descriptor |
If you've confirmed in #914 that this eliminates a source of leaked sockets, then that's enough motivation for me. +1 to merge for now; we can keep an eye out for any regressions due to this in our testing at CPR. |
Sounds good to me. |
We're seeing some assertion failure crashes now which may be due to this change. This one is a stack trace for one which occurred in the context of a costmap_2d unit test run:
|
@dirk-thomas @mgrrx We haven't been able to bottom this out, but it's impacting our ability to test everything else. IMO it should be reverted until it can be proven safe. |
I completely agree with your conclusion. |
[xmlrpcpp] close socket when connection can't be accepted. Fixes ros#914
Revert changes from ros#960.
Add integration tests for the XmlRpcServer interacting with an XmlRpcClient in the same process, particularly around the behavior when the server process runs out of available file handles. Update the XmlRpcServer with two different mitigations for file handle exhaustion (Fixes ros#914, replaces ros#960 and ros#977): * Measure the number of free file handles and reject incoming connections if the pool of free file descriptors is too small. This actively rejects incoming clients instead of waiting for complete file handle exhaustion, which would leave clients in a pending state until a file descriptor becomes free. * If accept fails due to complete file handle exhaustion, temporarily stop calling accept on this socket. This prevents a busy-loop where poll() believes the listening socket is readable, but accept() fails to allocate a file descriptor and leaves the socket in a readable state.
Add integration tests for the XmlRpcServer interacting with an XmlRpcClient in the same process, particularly around the behavior when the server process runs out of available file handles. Update the XmlRpcServer with two different mitigations for file handle exhaustion (Fixes ros#914, replaces ros#960 and ros#977): * Measure the number of free file handles and reject incoming connections if the pool of free file descriptors is too small. This actively rejects incoming clients instead of waiting for complete file handle exhaustion, which would leave clients in a pending state until a file descriptor becomes free. * If accept fails due to complete file handle exhaustion, temporarily stop calling accept on this socket. This prevents a busy-loop where poll() believes the listening socket is readable, but accept() fails to allocate a file descriptor and leaves the socket in a readable state.
* Tests and bug fixes for XmlRpcServer Add integration tests for the XmlRpcServer interacting with an XmlRpcClient in the same process, particularly around the behavior when the server process runs out of available file handles. Update the XmlRpcServer with two different mitigations for file handle exhaustion (Fixes #914, replaces #960 and #977): * Measure the number of free file handles and reject incoming connections if the pool of free file descriptors is too small. This actively rejects incoming clients instead of waiting for complete file handle exhaustion, which would leave clients in a pending state until a file descriptor becomes free. * If accept fails due to complete file handle exhaustion, temporarily stop calling accept on this socket. This prevents a busy-loop where poll() believes the listening socket is readable, but accept() fails to allocate a file descriptor and leaves the socket in a readable state. * Add test depend on boost * Run astyle
This PR fixes #914. As suggested by @trainman419 and confirmed by @ruffsl, uncommenting line
ros_comm/utilities/xmlrpcpp/src/XmlRpcServer.cpp
Line 157 in ea13207
I also changed the return value of handleEvent in that case.