2 Replies Latest reply on Mar 31, 2009 10:03 AM by Jeff Mesnil

    JBM 2 Server does not shutdown cleanly

    Jeff Mesnil Master

      while playing with the examples, I found that starting a JBMBootstrapServer and shutting it down does not leave the JVM

       System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
       System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces, value");
      
       JBMBootstrapServer server = new JBMBootstrapServer(new String[] {"jbm-example-beans.xml"});
       server.run();
       server.shutDown();
      


      When I dump the threads, it gives:

      Full thread dump Java HotSpot(TM) Client VM (1.5.0_16-133 mixed mode):
      
      "DestroyJavaVM" prio=5 tid=0x01001890 nid=0xb0801000 waiting on condition [0x00000000..0xb0800060]
      
      "NamingBootstrap Pool(1)-1" daemon prio=5 tid=0x010453e0 nid=0x846200 waiting on condition [0xb1011000..0xb1011d90]
       at sun.misc.Unsafe.park(Native Method)
       at java.util.concurrent.locks.LockSupport.park(LockSupport.java:118)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1841)
       at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:359)
       at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:470)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:674)
       at java.lang.Thread.run(Thread.java:613)
      
      "GC Daemon" daemon prio=2 tid=0x010432e0 nid=0x845400 in Object.wait() [0xb0f90000..0xb0f90d90]
       at java.lang.Object.wait(Native Method)
       - waiting on <0x05b92430> (a sun.misc.GC$LatencyLock)
       at sun.misc.GC$Daemon.run(GC.java:100)
       - locked <0x05b92430> (a sun.misc.GC$LatencyLock)
      
      "RMI Reaper" prio=5 tid=0x01042ea0 nid=0x82a200 in Object.wait() [0xb0f0f000..0xb0f0fd90]
       at java.lang.Object.wait(Native Method)
       - waiting on <0x05b92438> (a java.lang.ref.ReferenceQueue$Lock)
       at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:120)
       - locked <0x05b92438> (a java.lang.ref.ReferenceQueue$Lock)
       at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:136)
       at sun.rmi.transport.ObjectTable$Reaper.run(ObjectTable.java:336)
       at java.lang.Thread.run(Thread.java:613)
      
      "Timer-0" daemon prio=5 tid=0x010421a0 nid=0x829400 in Object.wait() [0xb0e8e000..0xb0e8ed90]
       at java.lang.Object.wait(Native Method)
       - waiting on <0x05b92468> (a java.util.TaskQueue)
       at java.lang.Object.wait(Object.java:474)
       at java.util.TimerThread.mainLoop(Timer.java:483)
       - locked <0x05b92468> (a java.util.TaskQueue)
       at java.util.TimerThread.run(Timer.java:462)
      
      "RMI TCP Accept-1098" daemon prio=5 tid=0x01041e20 nid=0x828600 runnable [0xb0e0d000..0xb0e0dd90]
       at java.net.PlainSocketImpl.socketAccept(Native Method)
       at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
       - locked <0x05b92488> (a java.net.SocksSocketImpl)
       at java.net.ServerSocket.implAccept(ServerSocket.java:450)
       at java.net.ServerSocket.accept(ServerSocket.java:421)
       at sun.rmi.transport.tcp.TCPTransport.run(TCPTransport.java:340)
       at java.lang.Thread.run(Thread.java:613)
      
      "Low Memory Detector" daemon prio=5 tid=0x01010bd0 nid=0x809800 runnable [0x00000000..0x00000000]
      
      "CompilerThread0" daemon prio=9 tid=0x0100fce0 nid=0x808a00 waiting on condition [0x00000000..0xb0c8a7d8]
      
      "Signal Dispatcher" daemon prio=9 tid=0x0100f990 nid=0x807c00 waiting on condition [0x00000000..0x00000000]
      
      "JDWP Command Reader" daemon prio=5 tid=0x0100dc10 nid=0x806e00 runnable [0x00000000..0x00000000]
      
      "JDWP Event Helper Thread" daemon prio=5 tid=0x0100d120 nid=0x816200 runnable [0x00000000..0x00000000]
      
      "JDWP Transport Listener: dt_socket" daemon prio=5 tid=0x0100c3c0 nid=0x815400 runnable [0x00000000..0xb0a86ae0]
      
      "Finalizer" daemon prio=8 tid=0x01007b80 nid=0x81be00 in Object.wait() [0xb0a05000..0xb0a05d90]
       at java.lang.Object.wait(Native Method)
       - waiting on <0x05a7fe88> (a java.lang.ref.ReferenceQueue$Lock)
       at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:120)
       - locked <0x05a7fe88> (a java.lang.ref.ReferenceQueue$Lock)
       at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:136)
       at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
      
      "Reference Handler" daemon prio=10 tid=0x010077a0 nid=0x81a400 in Object.wait() [0xb0984000..0xb0984d90]
       at java.lang.Object.wait(Native Method)
       - waiting on <0x05a7feb0> (a java.lang.ref.Reference$Lock)
       at java.lang.Object.wait(Object.java:474)
       at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
       - locked <0x05a7feb0> (a java.lang.ref.Reference$Lock)
      
      "VM Thread" prio=9 tid=0x01006ef0 nid=0x819600 runnable
      
      "VM Periodic Task Thread" prio=9 tid=0x010116c0 nid=0x81fc00 waiting on condition
      
      "Exception Catcher Thread" prio=10 tid=0x01001ab0 nid=0x80d800 runnable
      


      all remainging threads are daemon except for "RMI Reaper".
      It's also strange that "RMI TCP Accept-1098" is still alive even after shutting down the JNDI naming server

        • 1. Re: JBM 2 Server does not shutdown cleanly
          Tim Fox Master

          Try starting up the server without the jboss messaging service to see if it's related to just the jndi server.

          • 2. Re: JBM 2 Server does not shutdown cleanly
            Jeff Mesnil Master

             

            "timfox" wrote:
            Try starting up the server without the jboss messaging service to see if it's related to just the jndi server.


            the JNDI server is indeed the guilty part:

             public static void main(String[] args) throws Exception
             {
            
             System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
             System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces, value");
            
             NamingBeanImpl namingInfo = new NamingBeanImpl();
             namingInfo.start();
             org.jnp.server.Main jndiServer = new org.jnp.server.Main();
             jndiServer.setNamingInfo(namingInfo);
             jndiServer.setPort(1099);
             jndiServer.setBindAddress("localhost");
             jndiServer.setRmiPort(1098);
             jndiServer.setRmiBindAddress("localhost");
             jndiServer.start();
            
             System.out.println("STARTED");
            
             jndiServer.stop();
             namingInfo.stop();
             }
            


            I've asked about it on #jboss and I'll raise a JIRA issue if I don't have a reply.