Mysteriously appearing Timer thread does not allow JVM to die

C

cprakash

Hi All,
In my application, a "Timer-1" thread seems to appear out of nowhere
and it does not let the application to shut down. This thread belongs
to a ThreadGroup that I create within the application and it starts
while another thread of the same ThreadGroup is executing. I am able to
pinpoint to fixed block of code during the execution of which, this
thread appears.
I did like to know if there is a way I can track and find out where
this thread is starting from ?

thanks in advance,
Chandresh

Here is what I get on Ctrl+Brk:

Full thread dump Java HotSpot(TM) Client VM (1.5.0_02-b09 mixed mode,
sharing):

"Timer-1" prio=5 tid=0x02e37df8 nid=0x9a8 in Object.wait()
[0x033cf000..0x033cf9
e8]
at java.lang.Object.wait(Native Method)
- waiting on <0x23189cf8> (a java.util.TaskQueue)
at java.lang.Object.wait(Object.java:474)
at java.util.TimerThread.mainLoop(Timer.java:483)
- locked <0x23189cf8> (a java.util.TaskQueue)
at java.util.TimerThread.run(Timer.java:462)

"DestroyJavaVM" prio=5 tid=0x00037948 nid=0xfc waiting on condition
[0x00000000.
..0x0007fae8]

"Low Memory Detector" daemon prio=5 tid=0x00a6dda0 nid=0x95c runnable
[0x0000000
0..0x00000000]

"CompilerThread0" daemon prio=10 tid=0x00a6c978 nid=0xb8 waiting on
condition [0
x00000000..0x02c0f6c0]

"Signal Dispatcher" daemon prio=10 tid=0x00a6bc10 nid=0x188 waiting on
condition
[0x00000000..0x00000000]

"Finalizer" daemon prio=9 tid=0x00a68fd0 nid=0xb88 in Object.wait()
[0x02b8f000.
..0x02b8fa68]
at java.lang.Object.wait(Native Method)
- waiting on <0x23074288> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
- locked <0x23074288> (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=0x00a46af8 nid=0xa2c in
Object.wait() [0x
02b4f000..0x02b4fae8]
at java.lang.Object.wait(Native Method)
- waiting on <0x23074308> (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 <0x23074308> (a java.lang.ref.Reference$Lock)

"VM Thread" prio=10 tid=0x00036318 nid=0x3a4 runnable

"VM Periodic Task Thread" prio=10 tid=0x00a6efe8 nid=0xffc waiting on
condition
 
T

Thomas Hawtin

Hi All,
In my application, a "Timer-1" thread seems to appear out of nowhere
and it does not let the application to shut down. This thread belongs
to a ThreadGroup that I create within the application and it starts
while another thread of the same ThreadGroup is executing. I am able to
pinpoint to fixed block of code during the execution of which, this
thread appears.
I did like to know if there is a way I can track and find out where
this thread is starting from ?

It's starting from the constructor of a java.util.Timer. You can see
where that is by putting a breakpoint on it.

You can stop the thread by calling cancel on the timer. If you must, you
can construct the timer with isDaemon flag set.

Tom Hawtin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,481
Members
44,900
Latest member
Nell636132

Latest Threads

Top