Home Bug Reports

Thread dump when Java server is stopped by IceGrid

mefostermefoster Member Mary Ellen FosterOrganization: Heriot-Watt University, EdinburghProject: ECHOES learning environment ✭✭✭
I'm probably doing something amazingly stupid here, but I just can't see it. Here's the source of a server I'm running (NB: This is on Windows XP, using Ice 3.1.1 and Java 1.5.0_11):
package test;

import Ice.Application;

public class Test extends Application {
	public int run(String[] arg0) {
		return 0;

	public static void main(String[] args) {
        int result = new Test().main ("Test", args);
        System.exit (result);

This starts fine with IceGrid. But when I stop it, I get a thread dump as follows in the window where the relevant node is running:
[ C:/Program Files/Ice-3.1.1/bin/icegridnode.exe: Server: changed server `Test' state to `Deactivating' ]
Full thread dump Java HotSpot(TM) Client VM (1.5.0_11-b03 mixed mode, sharing):

"NewServer-Ice.ConnectionMonitor" prio=6 tid=0x02cbfb00 nid=0x1e78 in Object.wait() [0x02f1f000..0x02f1f9e8]
at java.lang.Object.wait(Native Method)
- waiting on <0x22bbd288> (a IceInternal.ConnectionMonitor)
at IceInternal.ConnectionMonitor.run(ConnectionMonitor.java:101)
- locked <0x22bbd288> (a IceInternal.ConnectionMonitor)

"Low Memory Detector" daemon prio=6 tid=0x00ac2b50 nid=0x16ec runnable [0x00000000..0x00000000]

"CompilerThread0" daemon prio=10 tid=0x00ac17c0 nid=0x1ccc waiting on condition

"Signal Dispatcher" daemon prio=10 tid=0x00ac0a18 nid=0x18dc waiting on conditio
n [0x00000000..0x00000000]

"Finalizer" daemon prio=8 tid=0x00abb098 nid=0x15f4 in Object.wait() [0x02b9f000..0x02b9fc68]
at java.lang.Object.wait(Native Method)
- waiting on <0x23077568> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
- locked <0x23077568> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

"Reference Handler" daemon prio=10 tid=0x00a98ce8 nid=0xaec in Object.wait() [0x02b5f000..0x02b5fce8]
at java.lang.Object.wait(Native Method)
- waiting on <0x230775e8> (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 <0x230775e8> (a java.lang.ref.Reference$Lock)

"main" prio=6 tid=0x00037070 nid=0x1ba8 in Object.wait() [0x0007f000..0x0007fc3c]
at java.lang.Object.wait(Native Method)
- waiting on <0x22c14308> (a IceInternal.ObjectAdapterFactory)
at java.lang.Object.wait(Object.java:474)
at IceInternal.ObjectAdapterFactory.waitForShutdown(ObjectAdapterFactory
- locked <0x22c14308> (a IceInternal.ObjectAdapterFactory)
at Ice.CommunicatorI.waitForShutdown(CommunicatorI.java:29)
at test.Test.run(Test.java:10)
at Ice.Application.main(Application.java:114)
at Ice.Application.main(Application.java:30)
at test.Test.main(Test.java:19)

"VM Thread" prio=10 tid=0x00ab8bb0 nid=0x830 runnable

"VM Periodic Task Thread" prio=10 tid=0x00ac3ed8 nid=0x11a4 waiting on condition

[ C:/Program Files/Ice-3.1.1/bin/icegridnode.exe: Activator: detected termination of server `Test' ]

This looks like there's a deadlock or something of that sort somewhere in the shutdown process, no? But I can't work out what could possibly be going on; this is obviously not one of my real servers, but a cut-down version that still seems to exhibit the error. Obviously I'm just not seeing what the stupid thing is in the above code, because I can't see the difference between this and my servers that do work ... somebody help?




  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff

    If your server doesn't register a process object, the IceGrid node tries to shutdown the server by sending a Ctrl-Break console event. This works fine for C++ servers which handle console events (such as Ice::Application) but as you discovered, for Java servers, it just dumps the server threads.

    You should register a process object for your Java server to allow IceGrid to properly shut it down. See the Ice manual for more information on the registration of process objects ("30.17.6 Process Registration" and the documentation for the object adapter RegisterProcess property in Appendix C.4).

Sign In or Register to comment.