Our production server was crashing with "too many open files". Investigating the open files using lsof I noticed a large number of TCP connections in CLOSE_WAIT to 50.22.16.4-static.reverse.softlayer.com:https or similar. I believe the connections were being left hanging open and thus leaking.
I have added an explicit close on the InputStream and added timeouts on connect and read from the socket. This appears to have resolved the issue in our production environment.
Our production server was crashing with "too many open files". Investigating the open files using lsof I noticed a large number of TCP connections in CLOSE_WAIT to 50.22.16.4-static.reverse.softlayer.com:https or similar. I believe the connections were being left hanging open and thus leaking.
I have added an explicit close on the InputStream and added timeouts on connect and read from the socket. This appears to have resolved the issue in our production environment.