0 Replies Latest reply on Mar 31, 2009 12:15 PM by Jeff Mesnil

    Starting/Stopping JNDI server does not exit cleanly the JVM

    Jeff Mesnil Master

      Hi,

      when starting JBoss Messaging in standalone mode, I found out that the JVM is not exited cleanly when we shutdown the server.
      After some investigation, I narrow the problem down to the JNDI server:

       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();
       }
      


      When I run the code (using both jnpserver 5.0.0.Beta3 and 5.0.0.Beta4), the VM hangs and I get the thread dump:

      Full thread dump Java HotSpot(TM) Client VM (1.5.0_16-133 mixed mode, sharing):
      
      "DestroyJavaVM" prio=5 tid=0x010014b0 nid=0xb0801000 waiting on condition [0x00000000..0xb0800060]
      
      "NamingBootstrap Pool(1)-1" daemon prio=5 tid=0x01013480 nid=0x82be00 waiting on condition [0xb0e8e000..0xb0e8ed90]
       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=0x010128e0 nid=0x914a00 in Object.wait() [0xb0e0d000..0xb0e0dd90]
       at java.lang.Object.wait(Native Method)
       - waiting on <0x25b02af8> (a sun.misc.GC$LatencyLock)
       at sun.misc.GC$Daemon.run(GC.java:100)
       - locked <0x25b02af8> (a sun.misc.GC$LatencyLock)
      
      "RMI Reaper" prio=5 tid=0x010124c0 nid=0x913c00 in Object.wait() [0xb0d8c000..0xb0d8cd90]
       at java.lang.Object.wait(Native Method)
       - waiting on <0x25b01b00> (a java.lang.ref.ReferenceQueue$Lock)
       at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:120)
       - locked <0x25b01b00> (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=0x010120c0 nid=0x84d200 in Object.wait() [0xb0d0b000..0xb0d0bd90]
       at java.lang.Object.wait(Native Method)
       - waiting on <0x25b01fa0> (a java.util.TaskQueue)
       at java.lang.Object.wait(Object.java:474)
       at java.util.TimerThread.mainLoop(Timer.java:483)
       - locked <0x25b01fa0> (a java.util.TaskQueue)
       at java.util.TimerThread.run(Timer.java:462)
      
      "RMI TCP Accept-1098" daemon prio=5 tid=0x01011d30 nid=0x84c400 runnable [0xb0c8a000..0xb0c8ad90]
       at java.net.PlainSocketImpl.socketAccept(Native Method)
       at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
       - locked <0x25b01b58> (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=0x01009110 nid=0x81ba00 runnable [0x00000000..0x00000000]
      
      "CompilerThread0" daemon prio=9 tid=0x01008660 nid=0x81ac00 waiting on condition [0x00000000..0xb0b077d8]
      
      "Signal Dispatcher" daemon prio=9 tid=0x01008130 nid=0x819e00 waiting on condition [0x00000000..0x00000000]
      
      "Finalizer" daemon prio=8 tid=0x01007a70 nid=0x818200 in Object.wait() [0xb0a05000..0xb0a05d90]
       at java.lang.Object.wait(Native Method)
       - waiting on <0x25a82180> (a java.lang.ref.ReferenceQueue$Lock)
       at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:120)
       - locked <0x25a82180> (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=0x010076b0 nid=0x816a00 in Object.wait() [0xb0984000..0xb0984d90]
       at java.lang.Object.wait(Native Method)
       - waiting on <0x25a82208> (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 <0x25a82208> (a java.lang.ref.Reference$Lock)
      
      "VM Thread" prio=9 tid=0x01006e00 nid=0x815c00 runnable
      
      "VM Periodic Task Thread" prio=9 tid=0x01009c50 nid=0x806e00 waiting on condition
      
      "Exception Catcher Thread" prio=10 tid=0x010017b0 nid=0x80d800 runnable
      


      Is it a known issue?
      Should I set some attributes on the JNDI server to ensure that it won't prevent the VM to exit?

      thanks!