I’m working on a legacy project where someone had used swing timer threads to do some server scheduling tasks. This code is not a swing app, it’s server side java. I know this is not a good idea, and know acceptable ways to do the same. The question is, I see some long VM pauses that happen every several minutes under no load. Enabling verbose gc, I determined it’s not garbage collection. When I do a thread dump during one of those pauses, I get this dump below. Any idea if this AWTAutoShutdown could be causing this pause, or what it’s doing when it does this activateBlockerThread shown below?
"AWT-Shutdown" prio=10 tid=0x00007fed5802d000 nid=0x2ef1 in Object.wait() [0x00007fed53e5d000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x000000031e910b90> (a java.lang.Object)
at java.lang.Object.wait(Object.java:485)
at sun.awt.AWTAutoShutdown.run(Unknown Source)
- locked <0x000000031e910b90> (a java.lang.Object)
at java.lang.Thread.run(Unknown Source)
"TimerQueue" daemon prio=10 tid=0x00007fed58597000 nid=0x2a56 in Object.wait() [0x00007fed54737000]
java.lang.Thread.State: BLOCKED (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x000000031e910b90> (a java.lang.Object)
at java.lang.Object.wait(Object.java:485)
at sun.awt.AWTAutoShutdown.activateBlockerThread(Unknown Source)
at sun.awt.AWTAutoShutdown.notifyThreadBusy(Unknown Source)
- locked <0x000000031e910b90> (a java.lang.Object)
- locked <0x000000031e9a60c8> (a java.lang.Object)
at java.awt.EventQueue.postEvent(Unknown Source)
at java.awt.EventQueue.postEventPrivate(Unknown Source)
- locked <0x000000031e90eb90> (a java.awt.EventQueue)
at java.awt.EventQueue.postEvent(Unknown Source)
at java.awt.EventQueue.invokeLater(Unknown Source)
at javax.swing.SwingUtilities.invokeLater(Unknown Source)
at javax.swing.Timer$1.run(Unknown Source)
at javax.swing.Timer$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at javax.swing.Timer.post(Unknown Source)
- locked <0x000000031e9af7e0> (a javax.swing.Timer)
at javax.swing.TimerQueue.postExpiredTimers(Unknown Source)
- locked <0x000000031e90ce60> (a javax.swing.TimerQueue)
at javax.swing.TimerQueue.run(Unknown Source)
- locked <0x000000031e90ce60> (a javax.swing.TimerQueue)
at java.lang.Thread.run(Unknown Source)
It looks like you may be having issues with notification. The TimerQueue thread should have woken up after the AWT-Shutdown thread got started (the AWTAutShutdown.run method signals the monitor that the AWTAutShutdown.activateBlockerThread method is waiting on). if your app is freezing for an extended time and these threads aren’t making progress, it would seem that the TimerQueue thread is not receiving the signal in a timely manner.
However, seeing as you application is not a swing/awt application, i don’t see how this would affect anything else in the application.