JDK-6553268 : AWT text field prevents Java from auto-shutdown, Linux/Solaris
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: generic
  • Submitted: 2007-05-03
  • Updated: 2020-11-06
  • Resolved: 2020-11-06
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
Run the attached test case. It shows a frame with a couple of components in it: several Labels and a single TextField. The frame has a WindowListener added, so when user closes the frame, it is disposed, and the whole JVM must terminate. However, after the frame is closed, the application is not terminated.

If the TextField is removed from the test, it operates successfully. Swing JTextFields also don't cause any problems. The bug is reproducible at least on Linux and Solaris with 6.0-fcs and 7.0-b11. Thread dump at the moment of freeze is also attached.

Comments
EVALUATION The fact is AWT uses JTextComponents on XToolkit. It also should use the same or similar technique to stop Timer responsible for blinking text cursor. That timer started when Swing classes being initialized. Each time AWTAutoShutdown is prepared to exit, EDT receives some InvocationEvent with blinking code for the text component. So far we always observe that busyThreadSet collection is not empty and start to check that once again. To fix that we either must use javax.swing.text.DefaultCaret.setVisible(false) or javax.swing.text.DefaultCaret.deinstall() when the text component lost focus. This is accompished in Swing by listening for focusLost event. I haven't managed to invent a straighforwarding fix so more thorough analysis is required.
03-07-2007

EVALUATION According to the thread dump, the problem thread is 'TimerQueue'. This thread is created in Swing (XAWT text components use Swing text components), however the bug is only reproduced with AWT TextField. Probably, AWT should perform some additional actions so the TimerQueue thread can terminate successfully.
03-05-2007