1

I'm using JDK 8 with Wildfly 11 on Amazon Linux. I have jstack installed. I'm trying to figure out why CPU utilization is way up and doing a thread dump reveals things like this

"default task-80" #266 prio=5 os_prio=0 tid=0x00000000090f0000 nid=0x2458 waiting on condition [0x00007f32204d7000]
   java.lang.Thread.State: WAITING (parking)
        at sun.misc.Unsafe.park(Native Method)
        - parking to wait for  <0x0000000181c9e470> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
        at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
        at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
        at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
        at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

How do I figure out what the condition or the lock the thread is waiting on?

Dave
  • 15,639
  • 133
  • 442
  • 830
  • Possible duplicate of [WAITING at sun.misc.Unsafe.park(Native Method)](https://stackoverflow.com/questions/24241335/waiting-at-sun-misc-unsafe-parknative-method) – Oleksandr Pyrohov Sep 11 '18 at 16:45
  • I contend this is different because the answer to that question is "the thread is doing is waiting for something" but my quesiton is how do I figure out what the thread is waiting for. Let me know if I shoudl re-word my question in some way. – Dave Sep 11 '18 at 16:55
  • 3
    From the stack trace it looks like it's a threadpool thread, that works for some work to be queued that it can execute. That's not a bad thing that can cause high CPU utilization. In fact any waiting/ablocked thread won't cause any important CPU utilization until it's woken up again. – Matthias247 Sep 11 '18 at 16:58
  • 3
    If you're trying to figure out why CPU utilization is way up, ignore all threads that are WAITING or BLOCKED, since they by nature don't consume any CPU at all. It is the other threads that are the culprit. – Andreas Sep 11 '18 at 17:03
  • @Andreas, I'm indeed trying to figure out high CPU utilization. Running "top -n 1 -H -p WILDFLY_PID" gives me this high CPU process "9222 jboss 20 0 28.0g 9.7g 33m S 51.3 33.5 2:12.02 java", and then converting that to hex and searching for that in my jstack trace gives the WAITING thread. So if its waiting, how can it also be consuming CPU? – Dave Sep 11 '18 at 17:53
  • 1
    @Dave *"converting that to hex"* Converting *what* to hex? Process IDs and Thread IDs are not the same thing. – Andreas Sep 11 '18 at 20:47

0 Answers0