[ http://issues.apache.org/jira/browse/AXIS2-935?page=comments#action_12424935 ] Jeff Peterson commented on AXIS2-935: -------------------------------------
I have finally been able to track down what I believe to be the root cause of this issue. The problem originates from how the commons-httpclient deals with http connections. By default it attempts to pool them within a "HttpConnectionManager." Here's basically what I did: First, I tweaked some code (as mentioned above) so that complete() was being called by ServiceClient on the various operation clients. This allowed the cleanup operation to propigate through to CommonsHttpTransportSender. Which, in turn, caused releaseConnection() to be called on the HttpMethod. I did some testing and noticed that this had no effect on the number of CLOSE_WAIT connections. After more research I found out that HttpClient attempts to pool http connections for the purpose of connection reuse. The object which manages this pool is an instance of HttpConnectionManager which can be accessed via httpClient.getHttpConnectionManager(). So, basically, the problem boils down to these connection pools not being cleaned up properly. They are allowed to go out of scope and continue to live until garbage collection is triggered. There are a couple solutions: the "Connection: close" header could be sent to disable connection pooling altogether or the pools can be purged as part of the cleanup() routine. I chose the latter for my test. In order to purge the pool, I registered the HttpClient (although I probably should have done the HttpConnectionManager), in the message context properties. When clean() is called in CommonsHttpTransportSender, I fetch the client, get the connection manager, and call closeIdleConnections(0). Testing indicates that this has solved the issue. I'll see if I can cleanup my working copy and post a patch. > Connections are not properly released causing them to stick in the > "CLOSE_WAIT" state and cause "Too many files open" > --------------------------------------------------------------------------------------------------------------------- > > Key: AXIS2-935 > URL: http://issues.apache.org/jira/browse/AXIS2-935 > Project: Apache Axis 2.0 (Axis2) > Issue Type: Bug > Components: core > Affects Versions: 1.0 > Environment: Weblogic 8.1.2, Solaris 8 (dont ask!) > Reporter: Jeff Peterson > Priority: Critical > > It appears that org.apache.axis2.transport.http.SOAPOverHTTPSender does not > properly cleanup the http post connection after payload has been sent. > The symptoms of this problem show up in `netstat` as literally hundreds of > connections in the "CLOSE_WAIT" state. On a busy server this can cause the > application to report exceptions with the message "Too many open files." > I looked in the source code for axis2 1.0 and discovered that in > SOAPOverHTTPSender.java the releaseConnection() is never called on the > postMethod variable. This seems to be a likely candidate for the source of > the issue. > See SOAPOverHTTPSender.java:97-118 -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
