Uploaded image for project: 'Synapse'
  1. Synapse
  2. SYNAPSE-846

Few parts of the code that prevents normal Synapse termination when running as a web application

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 3.0.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      Synapse is acting as a web application inside web container (Tomcat), not tested as stand alone (but may be affected also).

      Description

      When using synapse as a web application, I noticed that it is unable to stop (stop web application) sucessfully. It leaves many threads running, which prevents web application and Tomcat itself from shutdown. I tracked those threads and found parts of code which "creates them but do not stop them". I created my own patch for those code parts and now application stops correctly. I would be pleased if those changes appears in some future version so I will have no need to hold "my own set of patches synapse and axis 2 classes". Changes to source codes of Synapse 2.1:

      • org.apache.synapse.core.axis2.SynapseStartUpServlet:80 (after serverManager.stop():

      serverManager.shutdown(); // this must be called also

      • org.apache.synapse.transport.nhttp.HttpCoreNIOListener in method stop(), just before the end of try-catch block:

      mbeanSupport.unregister();
      metrics.destroy();

      • org.apache.synapse.endpoints.AbstractEndpoint in method destroy() before "this.initialized = false":

      if (metricsMBean != null)

      { metricsMBean.destroy(); metricsMBean = null; }
      • org.apache.axis2.transport.jms.ServiceTaskManager (I know this belongs to Axis2, but it is the same problem):
      • in the method stop() after the initial logging:

      if (workerPool != null) {
      try

      { workerPool.shutdown(1000); }

      catch (InterruptedException e)

      { log.error("Stopping WorkerPool failed", e); }

      }

      • in the method stop() after "sharedConnection.stop();":

      sharedConnection.close();

      Thank you

        Activity

        Hide
        hiranya Hiranya Jayathilaka added a comment -

        Thanks Lukas for pointing these issues out. Will review your fixes and do the necessary changes. The JMS transport fix should go to Axis2 Transports project.

        Show
        hiranya Hiranya Jayathilaka added a comment - Thanks Lukas for pointing these issues out. Will review your fixes and do the necessary changes. The JMS transport fix should go to Axis2 Transports project.
        Hide
        hiranya Hiranya Jayathilaka added a comment -

        This should be fixed now. Thanks Lukas for the contribution.

        Show
        hiranya Hiranya Jayathilaka added a comment - This should be fixed now. Thanks Lukas for the contribution.
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Synapse - Trunk #4615 (See https://builds.apache.org/job/Synapse%20-%20Trunk/4615/)
        SYNAPSE-846 Made the suggested changes to the synapse servlet. Added the MBean unregistration code to the pass through transport. NHTTP transport seems to be already fixed. (hiranya: rev 1503474)

        • /synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseStartUpServlet.java
        • /synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/PassThroughHttpListener.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Synapse - Trunk #4615 (See https://builds.apache.org/job/Synapse%20-%20Trunk/4615/ ) SYNAPSE-846 Made the suggested changes to the synapse servlet. Added the MBean unregistration code to the pass through transport. NHTTP transport seems to be already fixed. (hiranya: rev 1503474) /synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseStartUpServlet.java /synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/passthru/PassThroughHttpListener.java

          People

          • Assignee:
            hiranya Hiranya Jayathilaka
            Reporter:
            konzerva Lukas Valenta
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development