This bug occurs on Solaris and Linux.
It the Toolkit is accessed when running in Headless mode, the Java app will hang on exit. The following test can be used to reproduce this:
---
import java.awt.*;
public class GetToolkit {
public static void main(String[] args) {
Toolkit tk = Toolkit.getDefaultToolkit();
}
}
---
When run normally, this program runs to completion and then exits. When run w/ -Djava.awt.headless=true, the app never exits. This is true on Solaris w/ 1.4 & 1.4.1b14, and on Linux with 1.4.1b14. The thread dump looks like this:
Full thread dump Java HotSpot(TM) Client VM (1.4.1-beta-b14 mixed mode):
"DestroyJavaVM" prio=5 tid=0x2c518 nid=0x1 waiting on condition [0..ffbfe194]
"AWT-Shutdown" prio=5 tid=0x1860d8 nid=0x9 in Object.wait() [f23ff000..f23ffc24]
at java.lang.Object.wait(Native Method)
- waiting on <f2c9dea8> (a java.lang.Object)
at java.lang.Object.wait(Object.java:426)
at sun.awt.AWTAutoShutdown.run(AWTAutoShutdown.java:259)
- locked <f2c9dea8> (a java.lang.Object)
at java.lang.Thread.run(Thread.java:536)
"Signal Dispatcher" daemon prio=10 tid=0xb8fd0 nid=0x7 waiting on condition [0..0]
"Finalizer" daemon prio=8 tid=0xb43d8 nid=0x4 in Object.wait() [f2b7f000..f2b7fc24]
at java.lang.Object.wait(Native Method)
- waiting on <f2c00490> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
- locked <f2c00490> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
"Reference Handler" daemon prio=10 tid=0xb39a0 nid=0x3 in Object.wait() [facff000..facffc24]
at java.lang.Object.wait(Native Method)
- waiting on <f2c00380> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:426)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:113)
- locked <f2c00380> (a java.lang.ref.Reference$Lock)
"VM Thread" prio=5 tid=0xb2578 nid=0x2 runnable
"VM Periodic Task Thread" prio=10 tid=0xb7d20 nid=0x5 waiting on condition
"Suspend Checker Thread" prio=10 tid=0xb8678 nid=0x6 runnable