keenlabs / KeenClient-Java

Official Java client for the Keen IO API. Build analytics features directly into your Java apps.
https://keen.io/docs
MIT License
74 stars 43 forks source link

Close HttpURLConnections #6

Closed karlvr closed 11 years ago

karlvr commented 11 years ago

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.

dkador commented 11 years ago

Thanks for the pull request!