Hi,
What does the following Threads mean, are there any bugs that can be fixed?
Thread [drivers-controllogixdriver-PROCESSO 2-2] id=1408070, (TIMED_WAITING for java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@2d324ae0)
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
java.lang.Thread.run(Thread.java:745)
Looks normal to me. WAITING and TIMED_WAITING are fine. When they show RUNNABLE very much, you might be in trouble.
1 Like
Yeah, that’s a perfectly normal thread status that just means ‘waiting in a queue for work’.
And when it is TIMED_WAITING and consumes 5-7% of CPU per thread?
I do not think, that waiting should consume so much CPUs.
Timed waiting often means sleep()
. Do you have scripts that spin in a loop checking a condition with a short sleep in each iteration? If so, don’t do that.
Thank you, I will review the code. I know about some sleep after startup of the component:
But this should not be the issue, it should be called just once after page is loaded.
OnStartup:
sleep(0.5)
component.focus()
Maybe i have other nasty waiting, i will go through code.
The CPU% column needs to be taken with a grain of salt as well. It is a calculated value that represents the CPU usage over some recent elapsed time, it’s not atomic and correlated with the current stack trace you may see for that thread.
It is common to see a now-idle thread that was doing work, but now isn’t, have a non-zero CPU % number.
2 Likes