Axis2
  1. Axis2
  2. AXIS2-4263

Stopping ListenerManager does not cleanup several Timer threads

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.4.1, 1.5
    • Fix Version/s: 1.5.6, 1.6.1, 1.7.0
    • Component/s: kernel
    • Labels:
      None
    • Environment:
      Windows XP Service Pack 2, JDK 1.6_11

      Description

      When I attempt to stop and cleanup the ListenerManager for a closed SOAP connection with either the stop() or destroy() method two Timer threads remain active in the waiting state. I tracked it down to the "final" timer created for each instance of a Scheduler object. During the initialization of the ListenerManager, the Scheduler is created during execution of the startSearch() method of the DeploymentEngine. This method is called twice during the creation of the ConfigurationContext. Once for the FileSystemConfigurator and again for the ScriptDeploymentEngine (when initializing the ScriptModule)

      Here is how I create the ConfigurationContext and ListenerManager:
      ConfigurationContext configctx =
      ConfigurationContextFactory.createConfigurationContextFromFileSystem(m_repoLocation,
      m_confLocation); // – THIS IS WHEN THE TWO TIMERS ARE CREATED
      AxisConfiguration aconf = configctx.getAxisConfiguration();
      TransportInDescription tid = aconf.getTransportIn("http");
      Parameter param = tid.getParameter("port");
      param.setValue(getServerPortString());

      m_listenerManager = new ListenerManager();
      m_listenerManager.init(configctx);
      m_listenerManager.start();

      I have managed to cleanup the Timer associated the Scheduler for the FileSystemConfigurator, but I cannot find a way to cleanup the TImer for the ScriptDeploymentEngine:

      Here is my current cleanup code:

      m_listenerManager.stop();
      m_listenerManager.getConfigctx().cleanupContexts();
      m_listenerManager.getConfigctx().terminate(); // – THIS CALL WILL CLEANUP ONE OF THE TIMERS
      m_listenerManager.destroy();

      Our application can create and shutdown SOAP communications to various servers numerous times and each time we are "leaking" this one Timer object (Thread). At some point, Java throws the following exception (java.lang.OutOfMemoryError: unable to create new native thread) and we have to kill the program)

        Activity

        Hide
        Dennis Urech added a comment -

        Can you guys please look into this problem! If you cannot fix it, can you at least provide a workaround (I don't care how convoluted it may be). I need this resolved. Am I just doing something wrong??

        Please respond

        Thanks

        Show
        Dennis Urech added a comment - Can you guys please look into this problem! If you cannot fix it, can you at least provide a workaround (I don't care how convoluted it may be). I need this resolved. Am I just doing something wrong?? Please respond Thanks
        Hide
        Andreas Veithen added a comment -

        Analysis:

        • The ScriptDeploymentEngine is created in the init method of the "scripting" module. The init method then calls DeploymentEngine#loadServices which will create the timer if hot deployment is enabled.
        • On the other hand, ScriptModule#shutdown doesn't call ScriptDeploymentEngine#cleanup, so the timer is never cancelled.

        Possible solutions:

        • If the scripting module is not used, remove it from the configuration/repository.
        • If hot deployment is not used, disable it.
        • Modify the ScriptModule class so that ScriptDeploymentEngine#cleanup is called in the shutdown method.

        We should also investigate why the scripting feature is implemented as a module with a deployment engine, and not just as a simple deployer. Maybe the deployer feature didn't exist yet at the time the scripting module was written?

        Show
        Andreas Veithen added a comment - Analysis: The ScriptDeploymentEngine is created in the init method of the "scripting" module. The init method then calls DeploymentEngine#loadServices which will create the timer if hot deployment is enabled. On the other hand, ScriptModule#shutdown doesn't call ScriptDeploymentEngine#cleanup, so the timer is never cancelled. Possible solutions: If the scripting module is not used, remove it from the configuration/repository. If hot deployment is not used, disable it. Modify the ScriptModule class so that ScriptDeploymentEngine#cleanup is called in the shutdown method. We should also investigate why the scripting feature is implemented as a module with a deployment engine, and not just as a simple deployer. Maybe the deployer feature didn't exist yet at the time the scripting module was written?
        Hide
        Dennis Urech added a comment -

        Andreas,

        I turned off Hot Deployment and removed the scripting module and my problem is GONE! While this is still a problem, your workarounds have resolved a long standing problem for us,

        THANKS!!!!!

        Show
        Dennis Urech added a comment - Andreas, I turned off Hot Deployment and removed the scripting module and my problem is GONE! While this is still a problem, your workarounds have resolved a long standing problem for us, THANKS!!!!!
        Hide
        Dennis Urech added a comment -

        I am reducing the Priority to Critical (since there is a memory leak), but it is no longer a Blocker for us given the recent workaround

        Show
        Dennis Urech added a comment - I am reducing the Priority to Critical (since there is a memory leak), but it is no longer a Blocker for us given the recent workaround
        Hide
        Ruwan Linton added a comment -

        As there is a workaround and the Script Module is not being used in most of the cases this is not critical, I would reduce this to Major

        Show
        Ruwan Linton added a comment - As there is a workaround and the Script Module is not being used in most of the cases this is not critical, I would reduce this to Major
        Hide
        William Walsh added a comment -

        I am seeing similar symptoms running Axis2 on WebSphere V7 on z/OS and was pointed here via AXIS2-5110, which I had opened. I have not had success with the workaround here and was wondering if someone could provide more detail on what "removing the scripting module" looks like. I have turned off hot deployment in axis2.xml, but I have not been able to identify anything like the scripting module in my environment, yet the symptoms persist. (I can resolve them by making a change as described in AXIS2-5110.) I don't see anything like scripting in our modules.list and looking at the Axis2 source I don't find the classes in axis2-1.5.1-src\modules\scripting\src\org\apache\axis2\scripting in any of the deployed jars for our environment.

        If we can confirm that we do have the workaround here in place, then perhaps AXIS2-5110 is a separate issue; especially in light of the two different platforms and the JDK behavior differences IBM has indicated in that JIRA.

        Show
        William Walsh added a comment - I am seeing similar symptoms running Axis2 on WebSphere V7 on z/OS and was pointed here via AXIS2-5110 , which I had opened. I have not had success with the workaround here and was wondering if someone could provide more detail on what "removing the scripting module" looks like. I have turned off hot deployment in axis2.xml, but I have not been able to identify anything like the scripting module in my environment, yet the symptoms persist. (I can resolve them by making a change as described in AXIS2-5110 .) I don't see anything like scripting in our modules.list and looking at the Axis2 source I don't find the classes in axis2-1.5.1-src\modules\scripting\src\org\apache\axis2\scripting in any of the deployed jars for our environment. If we can confirm that we do have the workaround here in place, then perhaps AXIS2-5110 is a separate issue; especially in light of the two different platforms and the JDK behavior differences IBM has indicated in that JIRA.
        Hide
        Hudson added a comment -

        Integrated in axis2-1.5 #160 (See https://builds.apache.org/job/axis2-1.5/160/)
        AXIS2-4263: Merged r1156305 to the 1.5 branch.

        veithen :
        Files :

        • /axis/axis2/java/core/branches/1_5/modules/soapmonitor/module/pom.xml
        • /axis/axis2/java/core/branches/1_5/modules/transport/http/pom.xml
        • /axis/axis2/java/core/branches/1_5/modules/soapmonitor/module/src/main/java/org/apache/axis2/handlers
        • /axis/axis2/java/core/branches/1_5
        • /axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/TestUtils.java
        • /axis/axis2/java/core/branches/1_5/modules/kernel/src/org/apache/axis2/transport/http/util/QueryStringParser.java
        • /axis/axis2/java/core/branches/1_5/modules/soapmonitor/module/src/main/resources/META-INF/module.xml
        • /axis/axis2/java/core/branches/1_5/modules/kernel/test/org/apache/axis2/transport/http/util/QueryStringParserTest.java
        • /axis/axis2/java/core/branches/1_5/modules/soapmonitor/servlet/src/main/java/org/apache/axis2/soapmonitor/servlet
        • /axis/axis2/java/core/branches/1_5/modules/tool/axis2-repo-maven-plugin
        • /axis/axis2/java/core/branches/1_5/modules/transport/http/src
        • /axis/axis2/java/core/branches/1_5/modules/distribution
        • /axis/axis2/java/core/branches/1_5/modules/soapmonitor/servlet/src/main/java/org/apache/axis2/soapmonitor/applet
        • /axis/axis2/java/core/branches/1_5/modules/transport/local
        • /axis/axis2/java/core/branches/1_5/modules/webapp/src/main/java/org/apache/axis2/webapp/AxisAdminServlet.java
        • /axis/axis2/java/core/branches/1_5/modules/soapmonitor/servlet
        • /axis/axis2/java/core/branches/1_5/modules/webapp/src/main/java/org/apache/axis2/webapp/AdminAgent.java
        • /axis/axis2/java/core/branches/1_5/modules/parent
        • /axis/axis2/java/core/branches/1_5/modules/soapmonitor/module
        • /axis/axis2/java/core/branches/1_5/modules/scripting/src/org/apache/axis2/scripting/ScriptModule.java
        Show
        Hudson added a comment - Integrated in axis2-1.5 #160 (See https://builds.apache.org/job/axis2-1.5/160/ ) AXIS2-4263 : Merged r1156305 to the 1.5 branch. veithen : Files : /axis/axis2/java/core/branches/1_5/modules/soapmonitor/module/pom.xml /axis/axis2/java/core/branches/1_5/modules/transport/http/pom.xml /axis/axis2/java/core/branches/1_5/modules/soapmonitor/module/src/main/java/org/apache/axis2/handlers /axis/axis2/java/core/branches/1_5 /axis/axis2/java/core/branches/1_5/modules/saaj/test/org/apache/axis2/saaj/TestUtils.java /axis/axis2/java/core/branches/1_5/modules/kernel/src/org/apache/axis2/transport/http/util/QueryStringParser.java /axis/axis2/java/core/branches/1_5/modules/soapmonitor/module/src/main/resources/META-INF/module.xml /axis/axis2/java/core/branches/1_5/modules/kernel/test/org/apache/axis2/transport/http/util/QueryStringParserTest.java /axis/axis2/java/core/branches/1_5/modules/soapmonitor/servlet/src/main/java/org/apache/axis2/soapmonitor/servlet /axis/axis2/java/core/branches/1_5/modules/tool/axis2-repo-maven-plugin /axis/axis2/java/core/branches/1_5/modules/transport/http/src /axis/axis2/java/core/branches/1_5/modules/distribution /axis/axis2/java/core/branches/1_5/modules/soapmonitor/servlet/src/main/java/org/apache/axis2/soapmonitor/applet /axis/axis2/java/core/branches/1_5/modules/transport/local /axis/axis2/java/core/branches/1_5/modules/webapp/src/main/java/org/apache/axis2/webapp/AxisAdminServlet.java /axis/axis2/java/core/branches/1_5/modules/soapmonitor/servlet /axis/axis2/java/core/branches/1_5/modules/webapp/src/main/java/org/apache/axis2/webapp/AdminAgent.java /axis/axis2/java/core/branches/1_5/modules/parent /axis/axis2/java/core/branches/1_5/modules/soapmonitor/module /axis/axis2/java/core/branches/1_5/modules/scripting/src/org/apache/axis2/scripting/ScriptModule.java
        Hide
        Hudson added a comment -

        Integrated in axis2-1.6 #65 (See https://builds.apache.org/job/axis2-1.6/65/)
        AXIS2-4263: Merged r1156305 to the 1.6 branch.

        veithen :
        Files :

        • /axis/axis2/java/core/branches/1_6
        • /axis/axis2/java/core/branches/1_6/modules/scripting/src/org/apache/axis2/scripting/ScriptModule.java
        Show
        Hudson added a comment - Integrated in axis2-1.6 #65 (See https://builds.apache.org/job/axis2-1.6/65/ ) AXIS2-4263 : Merged r1156305 to the 1.6 branch. veithen : Files : /axis/axis2/java/core/branches/1_6 /axis/axis2/java/core/branches/1_6/modules/scripting/src/org/apache/axis2/scripting/ScriptModule.java
        Hide
        Hudson added a comment -

        Integrated in Axis2 #912 (See https://builds.apache.org/job/Axis2/912/)
        AXIS2-4263: Fixed a timer leak in the scripting module.

        veithen :
        Files :

        • /axis/axis2/java/core/trunk/modules/scripting/src/org/apache/axis2/scripting/ScriptModule.java
        Show
        Hudson added a comment - Integrated in Axis2 #912 (See https://builds.apache.org/job/Axis2/912/ ) AXIS2-4263 : Fixed a timer leak in the scripting module. veithen : Files : /axis/axis2/java/core/trunk/modules/scripting/src/org/apache/axis2/scripting/ScriptModule.java

          People

          • Assignee:
            Andreas Veithen
            Reporter:
            Dennis Urech
          • Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development