Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java threadump significance of "waiting on condition"

I have a threaddump of an app which showed 3 threads like below.

===============

"http-443-11" daemon prio=10 tid=0x00000000473bc800 nid=0x3590 waiting on condition [0x0000000061818000]
   java.lang.Thread.State: WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x00000007612a3880> (a java.util.concurrent.Semaphore$NonfairSync)

"http-443-4" daemon prio=10 tid=0x00000000451f6000 nid=0x243a waiting on condition [0x0000000055354000]
   java.lang.Thread.State: WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x00000007612a3880> (a java.util.concurrent.Semaphore$NonfairSync)

"http-443-7" daemon prio=10 tid=0x000000004602e000 nid=0x2974 waiting on condition [0x000000005e6e7000]
   java.lang.Thread.State: WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x00000007612a3880> (a java.util.concurrent.Semaphore$NonfairSync)

===============

What is the significance of the "waiting on condition []" ? What does the number in the [] signifiy ?

like image 513
anjanb Avatar asked Nov 26 '13 13:11

anjanb


People also ask

What is waiting on condition in thread dump?

Runnable: Means a thread is currently executing. Blocked: The thread is waiting for a lock to be released. This happens when entering a synchronized block, for instance. Waiting / Timed_waiting: The thread is waiting for something to happen.

What is waiting on condition?

The state "waiting on condition" means that the thread is waiting on an internal VM condition variable. These are not Java objects and so there is no means to identify them.

What does the thread status Wait mean?

A thread in the waiting state is waiting for another thread to perform a particular action. For example, a thread that has called Object. wait() on an object is waiting for another thread to call Object. notify() or Object. notifyAll() on that object.

What are the different circumstances when we can take a thread dump?

You can do thread dumps whenever you see fit to analyse anything to do with thread lock contention, deadlock detection, system resource contention, ... This is why there are tools to facilitate thread dump whenever we see fit, not only after a JVM crash.


1 Answers

In the thread stack we can see that threads are daemon threads and are waiting for task to come. Since these threads are created on JVM startup , they dont get killed unless JVM exits or any non daemon thread i not running, thus they wait for tasks to come. Say Garbage collection thread is a daemoon thread which might not be running all the time, it could be in waiting state.

like image 128
Vineet Kasat Avatar answered Oct 05 '22 03:10

Vineet Kasat