Hide Forgot
Date of First Response: 2008-06-09 09:04:21 project_key: SOA 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
The quickest way to handle this is, at least for ESB, is to force the JBM threads into a daemon state by creating all sessions (and therefore executors) on a daemon background thread.
Sounds like a JBM issue to me. Can you also create a JIRA in JBM and link it here?
Link: Added: This issue depends JBESB-1799
Verified in CR1
Link: Added: This issue related JBMESSAGING-1387
Link: Added: This issue related JBPAPP-935
Link: Added: This issue relates to SOA-3006