It appears this exact problem has been asked before and answered by the author. Unfortunately the original forum is now read-only and I can no longer extend that thread or directly message the author. ( dangling-ports-via-spring-in-close-wait )
My environment:
- apache-tomcat-7.0.53
- CommonsHttpInvokerRequestExecutor
- Spring 3.2.11.RELEASE
- httpclient-4.3.5
I too am seeing many CLOSE_WAIT connections hanging around.
Is the correct answer to "get the handle of the httpclient and close the socket from the application" ?
If so can anyone provide a code snippet how to access the httpclient from the application ? If this is not the right approach, what is the correct way to fix it ?
It looks like Florent Guillaume has the answer: Using HttpClient properly
One simple way is to add: method.addHeader("Connection", "close"); For other ways to avoid CLOSE_WAIT please read his blog entry.