You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "AravindPS (JIRA)" <ji...@apache.org> on 2012/11/09 10:42:12 UTC

[jira] [Commented] (AXIS2-4898) Thread named [MultiThreadedHttpConnectionManager cleanup] not cleaned up properly

    [ https://issues.apache.org/jira/browse/AXIS2-4898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13493852#comment-13493852 ] 

AravindPS commented on AXIS2-4898:
----------------------------------

Hi,
 We are facing the same issue. We have generated the stub using axis2 1.6.2 jars. The tomcat version is "apache-tomcat-7.0.32-windows-x86" The threads are not closing and reaches the maximum number of threads for http connector in tomcat. We are not able to send any requests after that. More than 300 threads are open. We are calling all the methods in the finally block as mentioned above.

Error when stop tomcat:-
-------------------
Nov 8, 2012 6:30:23 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/axis2] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak.
Nov 8, 2012 6:30:23 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/axis2] appears to have started a thread named [Thread-3] but has failed to stop it. This is very likely to create a memory leak.
Nov 8, 2012 6:30:23 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/axis2] appears to have started a thread named [Thread-4] but has failed to stop it. This is very likely to create a memory leak.
Nov 8, 2012 6:30:23 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/axis2] appears to have started a thread named [Thread-8] but has failed to stop it. This is very likely to create a memory leak.
............
-------------------

 Can you confirm whether this fix is available in axis2 1.6.2?

Aravind 
                
> Thread named [MultiThreadedHttpConnectionManager cleanup] not cleaned up properly
> ---------------------------------------------------------------------------------
>
>                 Key: AXIS2-4898
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4898
>             Project: Axis2
>          Issue Type: Bug
>          Components: client-api
>    Affects Versions: 1.5.1
>         Environment: Operating system Windows and Linux
> Application Server: Tomcat 6.0.29
> Axis2 version 1.5.1
> Client created with ADB
>            Reporter: Chris Emerson
>            Assignee: Andreas Veithen
>            Priority: Critical
>             Fix For: 1.5.5, 1.6.0
>
>         Attachments: version2.zip
>
>
> Shutting down Tomcat 6.0.29 gives the following error:
> Nov 23, 2010 4:42:18 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
> SEVERE: A web application appears to have started a thread named [MultiThreadedHttpConnectionManager cleanup] but has failed to stop it. This is very likely to create a memory leak.
> This error only happens when one of our Axis2 web services is called through a generated ADB client stub.  It appears to never close this thread.
> Our current configuration on the web application:
>    /**
>     * The configureServiceStub method sets the web service client settings and
>     *  for the web service call. 
>     * 
>     * @param params WebServiceParameters
>     * 
>     * @throws Exception
>     */
>    private void configureServiceStub(WebServiceParameters params) throws Exception
>    {
>       // check if connection manager already established
>       if(connectionManager == null)
>       {
>          connectionManager = new MultiThreadedHttpConnectionManager();
>          connectionManagerParams = new HttpConnectionManagerParams();
>          connectionManagerParams.setDefaultMaxConnectionsPerHost(2);
>          connectionManagerParams.setTcpNoDelay(true);
>          connectionManagerParams.setStaleCheckingEnabled(true);
>          connectionManagerParams.setLinger(0);
>          connectionManager.setParams(connectionManagerParams);
>          httpClient = new HttpClient(connectionManager);
>          
>          configcontext = ConfigurationContextFactory.createDefaultConfigurationContext();
>          configcontext.setThreadPool(new ThreadPool(1, 3));
>          configcontext.setProperty(HTTPConstants.REUSE_HTTP_CLIENT,
>                                    Boolean.TRUE);
>          configcontext.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
>          configcontext.setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION, httpClient);
>       }           
>       
>       if(employeeStub == null)
>       {
>          employeeStub = new EmployeeServiceSMARTStub(configcontext,
>                                                      params.getLocalServiceUrl()
>                                                      + "EmployeeServiceSMART.EmployeeServiceSMARTHttpSoap12Endpoint/");
>          
>          employeeStub._getServiceClient().getOptions().setTimeOutInMilliSeconds(2 * 60 * 1000);
>          employeeStub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT,
>                                                            30000);
>          employeeStub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT,
>                                                            30000);
>          employeeStub._getServiceClient().getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT,
>                                                            Boolean.TRUE);
>          employeeStub._getServiceClient().getOptions().setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION,
>                                                            Boolean.TRUE);
>          employeeStub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED,
>                                                            Boolean.TRUE);
>          employeeStub._getServiceClient().getOptions().setCallTransportCleanup(true);
>          employeeStub._getServiceClient().getOptions().setProperty(HTTPConstants.HTTP_PROTOCOL_VERSION,
>                                  HTTPConstants.HEADER_PROTOCOL_10);
>       }
>    }
> After each call we call the following code:
>       finally
>       {
>          // clean up all hanging threads and stop connection manager        
>          if(employeeStub._getServiceClient() != null)
>          {
>             try
>             {
>                employeeStub._getServiceClient().cleanupTransport();
>             }
>             catch(Exception e)
>             {
>                e.printStackTrace();
>             }
>             try
>             {
>                employeeStub._getServiceClient().cleanup();
>                employeeStub.cleanup();
>             }
>             catch(Exception e)
>             {
>                e.printStackTrace();
>             }
>          }
>          
>          connectionManager.closeIdleConnections(0);
>          connectionManager.shutdown();
>          connectionManager = null;
>          employeeStub = null;
>       }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org