Uploaded image for project: 'JBoss Enterprise SOA Platform'
  1. JBoss Enterprise SOA Platform
  2. SOA-563

ESB clients hang because of JBoss Messaging background threads

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.2 CP02
    • Fix Version/s: 4.2 CP02
    • Component/s: JBossESB
    • Labels:
      None

      Description

      The ESB clients can hang as a result of background threads being created by JBoss Messaging.

      The version of JBoss Messaging inherited from the EAP release appears to be 1.4.0.SP3-CP02.

      The issue is as follows.

      ESB manages the JMS sessions through a pooling mechanism, this mechanism explicitly cleans up the JMS resources using a shutdown hook. The actual mechanism is more involved than this as it also deals with scoping all ESB resources within the app server but, for a standalone client, this is the general behaviour.

      Unfortunately the specified version of JBoss Messaging is using the oswego QueuedExecutor but their factory does not explicitly set the 'daemon' attribute (either to true or false) when creating the threads. As a consequence the thread may or may not be tagged as a daemon thread depending on which thread is being used to create the executor.

      If the created thread is not a daemon then this will prevent the VM from closing unless the session has been explicitly closed.

      This leads us very nicely into a catch-22 situation

      JBM requires a close to cleanup the thread and thus enable shutdown to occur.
      ESB requires the shutdown hook to execute the close on the session, when the pool is cleaned up.

      The result is that the client will always hang.

      A client of the FP release of SOA-P would contain the following threads prior to main exiting

      Java HotSpot(TM) Server VM[localhost:8787]
      Thread [main] (Suspended)
      Daemon Thread [Timer-0] (Running)
      Daemon Thread [Timer-1] (Running)
      Daemon Thread [control: Socket[addr=/127.0.0.1,port=2995,localport=34035]] (Running)
      Daemon Thread [Timer-2] (Running)

      whereas a client on the CP2 release contains the following threads prior to main exiting

      Java HotSpot(TM) Server VM[localhost:8787]
      Thread [main] (Suspended)
      Daemon Thread [Timer-0] (Running)
      Daemon Thread [Timer-1] (Running)
      Daemon Thread [control: Socket[addr=/127.0.0.1,port=2070,localport=35190]] (Running)
      Daemon Thread [Timer-2] (Running)
      Thread [jbm-client-session-f2-4l4iy8hf-1-l0qey8hf-0kdngz-100j3] (Suspended)
      java.lang.Object.wait(long) line: not available [native method]
      java.lang.Object.wait() line: 474
      EDU.oswego.cs.dl.util.concurrent.LinkedQueue.take() line: 122
      EDU.oswego.cs.dl.util.concurrent.QueuedExecutor$RunLoop.run() line: 83
      java.lang.Thread.run() line: 595

      It is the last which is preventing the VM from closing down

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  kconner Kevin Conner
                  Reporter:
                  kconner Kevin Conner
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: