While troubleshooting one of the jvm hung issues in our production environment, we encountered that one of threads which executes the following logger statement
logger.debug("Loaded ids as " + ids + ".");
is hung at this step with the thread status as runnable. Here ids is a Set. There is another thread which waits on the above thread through a count down latch to complete its task. The software takes thread dumps every 15 mins and the stacktraces of the two threads look as below
Stack trace for [THREAD GROUP: Job_Executor] [THREAD NAME:main-Runner Thread][THREAD STATE: WAITING]
...sun.misc.Unsafe.park(Native Method)
...java.util.concurrent.locks.LockSupport.park(Unknown Source)
...java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(Unknown Source)
...java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(Unknown Source)
...java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(Unknown Source)
...java.util.concurrent.CountDownLatch.await(Unknown Source)
...com.runner.MainRunner.stopThread(MainRunnerRunner.java:1334)
Stack trace for [THREAD GROUP: Job_Executor] [THREAD NAME:task executor][THREAD STATE: RUNNABLE]
...java.util.AbstractCollection.toString(Unknown Source)
...java.lang.String.valueOf(Unknown Source)
...java.lang.StringBuilder.append(Unknown Source)
...com.runner.CriticalTaskExecutor.loadByIds(CriticalTaskExecutor.java:143)
This jvm got hung for almost 24 hrs and finally we had to kill it to move ahead. The thread dumps indicates that there are 43 threads in RUNNABLE state including the above one.
What could be the reasons for the above thread to be in RUNNABLE state for 24 hrs just executing collection.toString()?
Any suggestions on how to proceed?