Single-threaded Java application starts over 70 threads - linux
I just experienced a very strange behaviour of the (openJDK) JVM, when starting my single-threaded application on our compute server:
The JVM starts a lot (really a lot) of threads that heavily increase the CPU load on all processors and I don't have a suitable explanation for that [see image below].
I also tested a few more things:
I also tried running it on a Amazon EC2 instance with ~200GB of RAM and got a similar result with just a few number of threads less.
Instead of starting the app with java -Xms4096M -Xmx100000M -jar ... I tried smaller parameters like java -Xms1024M -Xmx1024M -jar ... and nothing changed.
Has anyone else already experienced such behaviour?
Or even better: can someone explain to me what is happening here?
EDIT:
I now have tried some of the things you have suggested and indeed got some valuable and also non-valuable output.
jstack PID does not work and suggests me to use jstack -F PID whose output for the main process is as follows.
kill -3 PID doesn't output anything.
Attaching to process ID 39041, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.40-b25
Deadlock Detection:
No deadlocks found.
Thread 39090: (state = BLOCKED)
Thread 39089: (state = BLOCKED)
- java.lang.Object.wait(long) #bci=0 (Interpreted frame)
- java.lang.ref.ReferenceQueue.remove(long) #bci=59, line=143 (Interpreted frame)
- java.lang.ref.ReferenceQueue.remove() #bci=2, line=164 (Interpreted frame)
- java.lang.ref.Finalizer$FinalizerThread.run() #bci=36, line=209 (Interpreted frame)
Thread 39088: (state = BLOCKED)
- java.lang.Object.wait(long) #bci=0 (Interpreted frame)
- java.lang.Object.wait() #bci=2, line=502 (Interpreted frame)
- java.lang.ref.Reference$ReferenceHandler.run() #bci=36, line=157 (Interpreted frame)
Thread 39043: (state = BLOCKED)
- java.lang.AbstractStringBuilder.<init>(int) #bci=6, line=68 (Compiled frame)
- java.lang.StringBuilder.<init>(java.lang.String) #bci=8, line=112 (Compiled frame)
- de.unisb.react.stud.algorithm.BMCLoopConverter.convert(gov.nasa.ltl.trans.Formula, int, int, int[]) #bci=526, line=99 (Compiled frame)
- de.unisb.react.stud.algorithm.BMCLoopConverter.convert(gov.nasa.ltl.trans.Formula, int, int, int[]) #bci=413, line=86 (Compiled frame)
- de.unisb.react.stud.algorithm.BMCLoopConverter.convert(gov.nasa.ltl.trans.Formula, int, int, int[]) #bci=80, line=39 (Compiled frame)
- de.unisb.react.stud.algorithm.BMCLoopConverter.convert(gov.nasa.ltl.trans.Formula, int, int, int[]) #bci=136, line=43 (Compiled frame)
- de.unisb.react.stud.algorithm.BMCLoopConverter.convert(gov.nasa.ltl.trans.Formula, int, int, int[]) #bci=676, line=112 (Compiled frame)
- de.unisb.react.stud.algorithm.BMCLoopConverter.convert(gov.nasa.ltl.trans.Formula, int, int, int[]) #bci=654, line=111 (Compiled frame)
- de.unisb.react.stud.algorithm.BMCLoopConverter.convert(gov.nasa.ltl.trans.Formula, int, int, int[]) #bci=654, line=111 (Compiled frame)
- de.unisb.react.stud.algorithm.BMCLoopConverter.convert(gov.nasa.ltl.trans.Formula, int, int, int[]) #bci=654, line=111 (Compiled frame)
- de.unisb.react.stud.algorithm.BMCLoopConverter.convert(gov.nasa.ltl.trans.Formula, int, int, int[]) #bci=654, line=111 (Compiled frame)
- de.unisb.react.stud.algorithm.BMCLoopConverter.convert(gov.nasa.ltl.trans.Formula, int, int, int[]) #bci=654, line=111 (Compiled frame)
- de.unisb.react.stud.algorithm.BMCLoopConverter.convert(gov.nasa.ltl.trans.Formula, int, int, int[]) #bci=654, line=111 (Compiled frame)
- de.unisb.react.stud.algorithm.BMCLoopConverter.convert(gov.nasa.ltl.trans.Formula, int, int, int[]) #bci=654, line=111 (Compiled frame)
- de.unisb.react.stud.algorithm.PMC.LoopConvert(gov.nasa.ltl.trans.Formula, int, de.unisb.react.stud.algorithm.Tree) #bci=69, line=274 (Compiled frame)
- de.unisb.react.stud.algorithm.PMC.main(java.lang.String[]) #bci=207, line=97 (Interpreted frame)
I'm not sure whether it belongs to kill or jstack, however I found this in the tmux:
2015-04-06 10:11:49
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.40-b25 mixed mode):
"Service Thread" #23 daemon prio=9 os_prio=0 tid=0x00007f0e54040000 nid=0x98c5 runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C1 CompilerThread17" #22 daemon prio=9 os_prio=0 tid=0x00007f0e54039800 nid=0x98c4 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C1 CompilerThread16" #21 daemon prio=9 os_prio=0 tid=0x00007f0e54037800 nid=0x98c3 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C1 CompilerThread15" #20 daemon prio=9 os_prio=0 tid=0x00007f0e54035000 nid=0x98c2 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C1 CompilerThread14" #19 daemon prio=9 os_prio=0 tid=0x00007f0e54033000 nid=0x98c1 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C1 CompilerThread13" #18 daemon prio=9 os_prio=0 tid=0x00007f0e54031000 nid=0x98c0 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C1 CompilerThread12" #17 daemon prio=9 os_prio=0 tid=0x00007f0e5402f000 nid=0x98bf waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread11" #16 daemon prio=9 os_prio=0 tid=0x00007f0e5402d000 nid=0x98be waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread10" #15 daemon prio=9 os_prio=0 tid=0x00007f0e5402b000 nid=0x98bd waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread9" #14 daemon prio=9 os_prio=0 tid=0x0000000001bd9000 nid=0x98bc runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread8" #13 daemon prio=9 os_prio=0 tid=0x0000000001bd7000 nid=0x98bb waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread7" #12 daemon prio=9 os_prio=0 tid=0x0000000001bd5000 nid=0x98ba waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread6" #11 daemon prio=9 os_prio=0 tid=0x0000000001bd3000 nid=0x98b9 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread5" #10 daemon prio=9 os_prio=0 tid=0x0000000001bd1000 nid=0x98b8 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread4" #9 daemon prio=9 os_prio=0 tid=0x0000000001bc6800 nid=0x98b7 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread3" #8 daemon prio=9 os_prio=0 tid=0x0000000001bc4800 nid=0x98b6 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread2" #7 daemon prio=9 os_prio=0 tid=0x0000000001bc0000 nid=0x98b5 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread1" #6 daemon prio=9 os_prio=0 tid=0x0000000001bbe000 nid=0x98b4 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread0" #5 daemon prio=9 os_prio=0 tid=0x0000000001bbb800 nid=0x98b3 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"Signal Dispatcher" #4 daemon prio=9 os_prio=0 tid=0x0000000001bb9000 nid=0x98b2 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"Finalizer" #3 daemon prio=8 os_prio=0 tid=0x0000000001b89000 nid=0x98b1 in Object.wait() [0x00007f0e5b5ba000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00007f0f73829c78> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
- locked <0x00007f0f73829c78> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)
"Reference Handler" #2 daemon prio=10 os_prio=0 tid=0x0000000001b87000 nid=0x98b0 in Object.wait() [0x00007f0e5b6bb000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x00007f0f73829cc0> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:502)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:157)
- locked <0x00007f0f73829cc0> (a java.lang.ref.Reference$Lock)
"main" #1 prio=5 os_prio=0 tid=0x000000000151d800 nid=0x9883 runnable [0x00007f27cbc8c000]
java.lang.Thread.State: RUNNABLE
at de.unisb.react.stud.algorithm.BMCLoopConverter.convertLoop(BMCLoopConverter.java:156)
at de.unisb.react.stud.algorithm.BMCLoopConverter.convert(BMCLoopConverter.java:118)
at de.unisb.react.stud.algorithm.BMCLoopConverter.convert(BMCLoopConverter.java:111)
at de.unisb.react.stud.algorithm.BMCLoopConverter.convert(BMCLoopConverter.java:111)
at de.unisb.react.stud.algorithm.BMCLoopConverter.convert(BMCLoopConverter.java:111)
at de.unisb.react.stud.algorithm.BMCLoopConverter.convert(BMCLoopConverter.java:111)
at de.unisb.react.stud.algorithm.BMCLoopConverter.convert(BMCLoopConverter.java:111)
at de.unisb.react.stud.algorithm.BMCLoopConverter.convert(BMCLoopConverter.java:111)
at de.unisb.react.stud.algorithm.BMCLoopConverter.convert(BMCLoopConverter.java:111)
at de.unisb.react.stud.algorithm.BMCLoopConverter.convert(BMCLoopConverter.java:111)
at de.unisb.react.stud.algorithm.BMCLoopConverter.convert(BMCLoopConverter.java:111)
at de.unisb.react.stud.algorithm.BMCLoopConverter.convert(BMCLoopConverter.java:111)
at de.unisb.react.stud.algorithm.PMC.LoopConvert(PMC.java:274)
at de.unisb.react.stud.algorithm.PMC.main(PMC.java:97)
"VM Thread" os_prio=0 tid=0x0000000001b82000 nid=0x98af runnable
"GC task thread#0 (ParallelGC)" os_prio=0 tid=0x0000000001533000 nid=0x9884 runnable
"GC task thread#1 (ParallelGC)" os_prio=0 tid=0x0000000001535000 nid=0x9885 runnable
"GC task thread#2 (ParallelGC)" os_prio=0 tid=0x0000000001536800 nid=0x9886 runnable
"GC task thread#3 (ParallelGC)" os_prio=0 tid=0x0000000001538800 nid=0x9887 runnable
"GC task thread#4 (ParallelGC)" os_prio=0 tid=0x000000000153a000 nid=0x9888 runnable
"GC task thread#5 (ParallelGC)" os_prio=0 tid=0x000000000153c000 nid=0x9889 runnable
"GC task thread#6 (ParallelGC)" os_prio=0 tid=0x000000000153d800 nid=0x988a runnable
"GC task thread#7 (ParallelGC)" os_prio=0 tid=0x000000000153f800 nid=0x988b runnable
"GC task thread#8 (ParallelGC)" os_prio=0 tid=0x0000000001541000 nid=0x988c runnable
"GC task thread#9 (ParallelGC)" os_prio=0 tid=0x0000000001543000 nid=0x988d runnable
"GC task thread#10 (ParallelGC)" os_prio=0 tid=0x0000000001544800 nid=0x988e runnable
"GC task thread#11 (ParallelGC)" os_prio=0 tid=0x0000000001546800 nid=0x988f runnable
"GC task thread#12 (ParallelGC)" os_prio=0 tid=0x0000000001548000 nid=0x9890 runnable
"GC task thread#12 (ParallelGC)" os_prio=0 tid=0x0000000001548000 nid=0x9890 runnable [31/1020]
"GC task thread#13 (ParallelGC)" os_prio=0 tid=0x000000000154a000 nid=0x9891 runnable
"GC task thread#14 (ParallelGC)" os_prio=0 tid=0x000000000154b800 nid=0x9892 runnable
"GC task thread#15 (ParallelGC)" os_prio=0 tid=0x000000000154d800 nid=0x9893 runnable
"GC task thread#16 (ParallelGC)" os_prio=0 tid=0x000000000154f000 nid=0x9894 runnable
"GC task thread#17 (ParallelGC)" os_prio=0 tid=0x0000000001551000 nid=0x9895 runnable
"GC task thread#18 (ParallelGC)" os_prio=0 tid=0x0000000001552800 nid=0x9896 runnable
"GC task thread#19 (ParallelGC)" os_prio=0 tid=0x0000000001554800 nid=0x9897 runnable
"GC task thread#20 (ParallelGC)" os_prio=0 tid=0x0000000001556000 nid=0x9898 runnable
"GC task thread#21 (ParallelGC)" os_prio=0 tid=0x0000000001558000 nid=0x9899 runnable
"GC task thread#22 (ParallelGC)" os_prio=0 tid=0x0000000001559800 nid=0x989a runnable
"GC task thread#23 (ParallelGC)" os_prio=0 tid=0x000000000155b800 nid=0x989b runnable
"GC task thread#24 (ParallelGC)" os_prio=0 tid=0x000000000155d000 nid=0x989c runnable
"GC task thread#25 (ParallelGC)" os_prio=0 tid=0x000000000155f000 nid=0x989d runnable
"GC task thread#26 (ParallelGC)" os_prio=0 tid=0x0000000001560800 nid=0x989e runnable
"GC task thread#27 (ParallelGC)" os_prio=0 tid=0x0000000001562800 nid=0x989f runnable
"GC task thread#28 (ParallelGC)" os_prio=0 tid=0x0000000001564000 nid=0x98a0 runnable
"GC task thread#29 (ParallelGC)" os_prio=0 tid=0x0000000001566000 nid=0x98a1 runnable
"GC task thread#30 (ParallelGC)" os_prio=0 tid=0x0000000001567800 nid=0x98a2 runnable
"GC task thread#31 (ParallelGC)" os_prio=0 tid=0x0000000001569800 nid=0x98a3 runnable
"GC task thread#32 (ParallelGC)" os_prio=0 tid=0x000000000156b000 nid=0x98a4 runnable
"GC task thread#33 (ParallelGC)" os_prio=0 tid=0x000000000156d000 nid=0x98a5 runnable
"GC task thread#34 (ParallelGC)" os_prio=0 tid=0x000000000156e800 nid=0x98a6 runnable
"GC task thread#35 (ParallelGC)" os_prio=0 tid=0x0000000001570800 nid=0x98a7 runnable
"GC task thread#36 (ParallelGC)" os_prio=0 tid=0x0000000001572000 nid=0x98a8 runnable
"GC task thread#37 (ParallelGC)" os_prio=0 tid=0x0000000001574000 nid=0x98a9 runnable
"GC task thread#38 (ParallelGC)" os_prio=0 tid=0x0000000001575800 nid=0x98aa runnable
"GC task thread#39 (ParallelGC)" os_prio=0 tid=0x0000000001577800 nid=0x98ab runnable
"GC task thread#40 (ParallelGC)" os_prio=0 tid=0x0000000001579000 nid=0x98ac runnable
"GC task thread#41 (ParallelGC)" os_prio=0 tid=0x000000000157b000 nid=0x98ad runnable
"GC task thread#42 (ParallelGC)" os_prio=0 tid=0x000000000157c800 nid=0x98ae runnable
"VM Periodic Task Thread" os_prio=0 tid=0x00007f0e54042800 nid=0x98c6 waiting on condition
JNI global references: 13
Heap [163/1020]
PSYoungGen total 22755328K, used 10392421K [0x00007f1f96300000, 0x00007f27b9800000, 0x00007f27b9800000)
eden space 11377664K, 91% used [0x00007f1f96300000,0x00007f22107d97a8,0x00007f224ca00000)
from space 11377664K, 0% used [0x00007f224ca00000,0x00007f224ca00000,0x00007f2503100000)
to space 11377664K, 0% used [0x00007f2503100000,0x00007f2503100000,0x00007f27b9800000)
ParOldGen total 68267008K, used 68266986K [0x00007f0f4f800000, 0x00007f1f96300000, 0x00007f1f96300000)
object space 68267008K, 99% used [0x00007f0f4f800000,0x00007f1f962fa968,0x00007f1f96300000)
Metaspace used 3156K, capacity 4240K, committed 4352K, reserved 8192K
I checked the PIDs of the running processes that generate the high CPU load -> they belong to the GC threads.
I'm still not sure how a single threaded program can generate so much garbage that it keeps all those GC threads busy... but at least that's a starting point.
Fully explaining and debugging the code (which is somewhat complex as it is a research project) would be clearly out of scope.
Maybe a last question directly concerning the topic: Is it possible to adjust the number of GC threads the JVM spawns?
I will now start debugging the garbage collection, e.g. by using -verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails, so if you know helpful tools or have any hints, please let me know. ;)
The only answer I can give you is that:
Despite what other answers might imply, you DO have real evidence that something is wrong. While you are looking at OS-level threads, there is a one-to-one correspondence between Java threads and OS threads ... at least on Linux, with current generation JVMs.
It is not the JVM's fault. Java does not spontaneously create large numbers of threads; e.g. ~70 as you are seeing.
(Depending on the Java version, JVM parameters, etc, you might see ten or so internal threads. But they will be idle most of the time ... not running all of the time as your monitoring seems to suggest.)
Fiddling with the Java heap and stack size parameters won't affect the number of threads launched ... in a way that is likely to address your problem.
Running on a different platform (EC2) is unlikely to make any difference.
You need to look at what your application is doing, and at the third party libraries that it is using. We can't help you with this, unless you provide more details.
However, getting a thread dump (with jstack or kill -3 PID) should offer some clues as to what those threads are, and how they got created.
Having said that, you do appear to have a suspiciously large heap, and (possible) a large number of cores. Apparently, the default policy of the throughput collector is to create a GC thread for each physical core. However, it is hard to conceive of a use-case where a single-threaded application could create enough garbage to keep a large number of GC threads busy for an extended period ... unless it had filled the heap with reachable objects.
Related
16 threads waiting the same lock
I'm having a problem in a glassfish 3 server. The log is throwing messages java.util.concurrent.RejectedExecutionException: The thread pool's task queue is full, limit: 256 I did a couple of thread dumps and found that there are 16 threads waiting for the same lock, for example: "__ejb-thread-pool1" daemon prio=6 tid=0x39657c00 nid=0x1c08 waiting on condition [0x3297f000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x117b2cb0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1068) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724) Locked ownable synchronizers: - None "__ejb-thread-pool2" daemon prio=6 tid=0x38408c00 nid=0x1a3c waiting on condition [0x3ad3f000] java.lang.Thread.State: WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x117b2cb0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1068) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724) Locked ownable synchronizers: - None ... is this normal? I thought I was going to find a thread owning the lock in the thread dump, but there isn't. Please help.. I'm new to thread analysis.
If some executor service has 16 theads doing nothing, then yes it's perfectly normal that they are all waiting for something to show in the task queue. The rejected executions likely occured at another moment than when you snapshot threads. It only means there was a spike in submissions and the queue overflowed earlier. Careful though, these rejected executions may not even be on the executor service you are looking at. It depends how many other executor services there are elsewhere.
jvm stack threads increase
There are many Timer threads in my jvm. From thread dump, i get this: "Timer-19" - Thread t#159 java.lang.Thread.State: WAITING at java.lang.Object.wait(Native Method) - waiting on <134c08ad> (a java.util.TaskQueue) at java.lang.Object.wait(Object.java:485) at java.util.TimerThread.mainLoop(Timer.java:483) at java.util.TimerThread.run(Timer.java:462) Locked ownable synchronizers: - None In my program i don't use Timer, it confused me a lot. So please help!
attach a debugger set a breakpoint on the Timer constructor wait until it triggers inspect the call stack to find the caller
message-driven-channel-adapter deadlock issues
I have this deadlock scenario which brings the application to a complete halt, not sure whats going on, if you could show some light. Thank you This is the consumer configuration <jms:message-driven-channel-adapter id="InBoundZFlow" connection-factory="wmqConnFactory" destination="ResponseQueue" channel="responseInChannel" auto-startup="false" max-messages-per-task="20" receive-timeout="10000" concurrent-consumers="2" task-executor="receivingTaskExecutor" max-concurrent-consumers="20" idle-consumer-limit="1" idle-task-execution-limit="1" recovery-interval="60000"/> receivingTaskExecutor has 20 threads. This is what i see for some of the blocking threads - "receivingTaskExecutor-19" - Thread t#226 java.lang.Thread.State: BLOCKED at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.clearResources(DefaultMessageListenerContainer.java:1142) - waiting to lock <1f7cd479> (a java.lang.Object) owned by "receivingTaskExecutor-11" t#111 at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1002) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:679) "rceivingTaskExecutor-16" - Thread t#184 java.lang.Thread.State: BLOCKED at org.springframework.jms.listener.AbstractJmsListeningContainer.isRunning(AbstractJmsListeningContainer.java:347) - waiting to lock <3c616415> (a java.lang.Object) owned by "receivingTaskExecutor-7" t#69 at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:995) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:679) Locked ownable synchronizers: - locked <712a95c7> (a java.util.concurrent.ThreadPoolExecutor$Worker) ---------------------------------------------------- "mqReceivingTaskExecutor-7" - Thread t#69 java.lang.Thread.State: BLOCKED at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.clearResources(DefaultMessageListenerContainer.java:1142) - waiting to lock <1f7cd479> (a java.lang.Object) owned by "mqReceivingTaskExecutor-11" t#111 at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1043) - locked <3c616415> (a java.lang.Object) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:679) Locked ownable synchronizers: - locked <a01ec0b> (a java.util.concurrent.ThreadPoolExecutor$Worker) --------------------------------------------------------- "receivingTaskExecutor-11" - Thread t#111 java.lang.Thread.State: WAITING at sun.misc.Unsafe.park(Native Method) - waiting to lock <1df1bdab> (a java.util.concurrent.locks.ReentrantLock$NonfairSync) owned by "receivingTaskExecutor-5" t#65 at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186) at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:838) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:871) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1201) at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:214) at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:290) at com.ibm.mq.jmqi.remote.impl.RemoteConnection.requestSendLock(RemoteConnection.java:2842) at com.ibm.mq.jmqi.remote.impl.RemoteConnection.sendTSH(RemoteConnection.java:1812) at com.ibm.mq.jmqi.remote.impl.RemoteSession.sendTSH(RemoteSession.java:758) at com.ibm.mq.jmqi.remote.impl.RemoteSession.exchangeTSH(RemoteSession.java:1237) at com.ibm.mq.jmqi.remote.api.RemoteFAP.spiNotify(RemoteFAP.java:4612) at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiNotify(RemoteFAP.java:4449) at com.ibm.mq.jmqi.monitoring.JmqiInterceptAdapter.jmqiNotify(JmqiInterceptAdapter.java:579) at com.ibm.msg.client.wmq.internal.WMQSyncConsumerShadow.setRunning(WMQSyncConsumerShadow.java:462) at com.ibm.msg.client.wmq.internal.WMQMessageConsumer.stop(WMQMessageConsumer.java:535) at com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl.stopUnconditional(JmsMessageConsumerImpl.java:706) at com.ibm.msg.client.jms.internal.JmsSessionImpl.stop(JmsSessionImpl.java:2014) - locked <2a02832d> (a java.util.Collections$SynchronizedSet) - locked <af214e7> (a java.lang.Object) at com.ibm.msg.client.jms.internal.JmsSessionImpl.close(JmsSessionImpl.java:315) at com.ibm.msg.client.jms.internal.JmsConnectionImpl.close(JmsConnectionImpl.java:300) - locked <1b3a4f4e> (a com.ibm.msg.client.jms.internal.State) at com.ibm.mq.jms.MQConnection.close(MQConnection.java:98) at org.springframework.jms.connection.ConnectionFactoryUtils.releaseConnection(ConnectionFactoryUtils.java:80) at org.springframework.jms.listener.AbstractJmsListeningContainer.refreshSharedConnection(AbstractJmsListeningContainer.java:395) - locked <1f7cd479> (a java.lang.Object) at org.springframework.jms.listener.DefaultMessageListenerContainer.refreshConnectionUntilSuccessful(DefaultMessageListenerContainer.java:885) at org.springframework.jms.listener.DefaultMessageListenerContainer.recoverAfterListenerSetupFailure(DefaultMessageListenerContainer.java:861) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1013) - locked <112c97d9> (a java.lang.Object) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:679) Locked ownable synchronizers: - locked <33d65cd0> (a java.util.concurrent.ThreadPoolExecutor$Worker) - locked <6a5305e> (a java.util.concurrent.locks.ReentrantLock$NonfairSync) "receivingTaskExecutor-5" - Thread t#65 java.lang.Thread.State: BLOCKED at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.clearResources(DefaultMessageListenerContainer.java:1142) - waiting to lock <1f7cd479> (a java.lang.Object) owned by "receivingTaskExecutor-11" t#111 at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1002) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:679) Locked ownable synchronizers: - locked <19f71b53> (a java.util.concurrent.ThreadPoolExecutor$Worker) - locked <1df1bdab> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
This looks like a bug in the mq client library. receivingTaskExecutor-5 is holding a lock owned by the client library but has no client library stack frames on its stack. receivingTaskExecutor-11 is trying to acquire that lock (while holding a DMLC lock; the other threads are waiting for that). So something happened in the client library on receivingTaskExecutor-5 that caused it to leave the lock locked. I suggest you contact IBM support.
Understanding JVM's "Attach Listener" thread
When I use jstack -l pid to see the thread's dump info, I get result as follow: "Attach Listener" daemon prio=10 tid=0x01e4a800 nid=0x109c waiting on condition [0x00000000] java.lang.Thread.State: RUNNABLE Locked ownable synchronizers: - None My questions are as follow: What's the function of "Attach Listener" thread? When does this thread be created? Where? I can't find it. Thank you very much.
See here http://openjdk.java.net/groups/hotspot/docs/Serviceability.html Find "Dynamic Attachâ Dynamic attach has an attach listener thread in the target JVM. This is a thread that is started when the first attach request occurs.
Java: strange deadlock
I've got a deadlock in my application, but there is no obvious locking instance in the stack trace. How is this possible? Is this a bug? jstack -l output Full thread dump OpenJDK 64-Bit Server VM (19.0-b09 mixed mode): "Attach Listener" daemon prio=10 tid=0x000000000120d000 nid=0x34a9 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE Locked ownable synchronizers: - None "queue_1" prio=10 tid=0x0000000001043800 nid=0x2ecc waiting for monitor entry [0x00000000426f2000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.getConnectionId(ConnectionManagerImpl.java:20) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.getConnectionId(ConnectionUtils.java:15) at org.seosrv.engines.wordstat.AbstractWordstatEngine.startQueueProcessing(AbstractWordstatEngine.java:56) at org.seosrv.engines.wordstat.WordstatEngineManager$EngineQueueXable.act(WordstatEngineManager.java:155) at org.seosrv.engines.wordstat.WordstatEngineManager$EngineQueueXable.run(WordstatEngineManager.java:145) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "queue_2" prio=10 tid=0x0000000001043000 nid=0x2ecb waiting for monitor entry [0x00000000413a5000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.getConnectionId(ConnectionManagerImpl.java:20) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.getConnectionId(ConnectionUtils.java:15) at org.seosrv.engines.wordstat.AbstractWordstatEngine.startQueueProcessing(AbstractWordstatEngine.java:56) at org.seosrv.engines.wordstat.WordstatEngineManager$EngineQueueXable.act(WordstatEngineManager.java:155) at org.seosrv.engines.wordstat.WordstatEngineManager$EngineQueueXable.run(WordstatEngineManager.java:145) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "actor_1" prio=10 tid=0x0000000001a7c800 nid=0xdb8 waiting for monitor entry [0x00000000433ff000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.releaseConnectionId(ConnectionManagerImpl.java:29) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.releaseConnectionId(ConnectionUtils.java:19) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.act(SearchEngineContainer.java:352) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.run(SearchEngineContainer.java:266) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "actor_2" prio=10 tid=0x0000000003f24800 nid=0xdb5 waiting for monitor entry [0x00000000431fd000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.releaseConnectionId(ConnectionManagerImpl.java:29) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.releaseConnectionId(ConnectionUtils.java:19) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.act(SearchEngineContainer.java:352) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.run(SearchEngineContainer.java:266) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "actor_3" prio=10 tid=0x0000000001578000 nid=0xdb2 waiting for monitor entry [0x00000000424f0000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.releaseConnectionId(ConnectionManagerImpl.java:29) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.releaseConnectionId(ConnectionUtils.java:19) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.act(SearchEngineContainer.java:352) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.run(SearchEngineContainer.java:266) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "actor_4" prio=10 tid=0x0000000003f20000 nid=0xdad waiting for monitor entry [0x0000000042ffb000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.releaseConnectionId(ConnectionManagerImpl.java:29) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.releaseConnectionId(ConnectionUtils.java:19) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.act(SearchEngineContainer.java:352) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.run(SearchEngineContainer.java:266) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "actor_5" prio=10 tid=0x0000000001091000 nid=0xda3 waiting for monitor entry [0x00000000428f4000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.releaseConnectionId(ConnectionManagerImpl.java:29) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.releaseConnectionId(ConnectionUtils.java:19) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.act(SearchEngineContainer.java:352) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.run(SearchEngineContainer.java:266) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "actor_6" prio=10 tid=0x0000000001592000 nid=0xd9d waiting for monitor entry [0x0000000042af6000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.releaseConnectionId(ConnectionManagerImpl.java:29) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.releaseConnectionId(ConnectionUtils.java:19) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.act(SearchEngineContainer.java:352) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.run(SearchEngineContainer.java:266) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "actor_7" prio=10 tid=0x00000000030f5000 nid=0xd98 waiting for monitor entry [0x0000000042efa000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.releaseConnectionId(ConnectionManagerImpl.java:29) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.releaseConnectionId(ConnectionUtils.java:19) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.act(SearchEngineContainer.java:352) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.run(SearchEngineContainer.java:266) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "actor_8" prio=10 tid=0x0000000001094000 nid=0xd92 waiting for monitor entry [0x0000000042bf7000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.releaseConnectionId(ConnectionManagerImpl.java:29) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.releaseConnectionId(ConnectionUtils.java:19) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.act(SearchEngineContainer.java:352) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.run(SearchEngineContainer.java:266) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "actor_9" prio=10 tid=0x0000000001485800 nid=0xd5c waiting for monitor entry [0x0000000041e13000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.releaseConnectionId(ConnectionManagerImpl.java:29) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.releaseConnectionId(ConnectionUtils.java:19) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.act(SearchEngineContainer.java:352) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.run(SearchEngineContainer.java:266) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "actor_10" prio=10 tid=0x0000000003f26800 nid=0xd42 waiting for monitor entry [0x00000000432fe000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.releaseConnectionId(ConnectionManagerImpl.java:29) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.releaseConnectionId(ConnectionUtils.java:19) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.act(SearchEngineContainer.java:352) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.run(SearchEngineContainer.java:266) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "actor_11" prio=10 tid=0x00000000032ed000 nid=0xd34 waiting for monitor entry [0x00000000425f1000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.releaseConnectionId(ConnectionManagerImpl.java:29) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.releaseConnectionId(ConnectionUtils.java:19) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.act(SearchEngineContainer.java:352) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.run(SearchEngineContainer.java:266) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "actor_12" prio=10 tid=0x00000000011b8000 nid=0xd05 waiting for monitor entry [0x00000000427f3000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.releaseConnectionId(ConnectionManagerImpl.java:29) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.releaseConnectionId(ConnectionUtils.java:19) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.act(SearchEngineContainer.java:352) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.run(SearchEngineContainer.java:266) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "actor_13" prio=10 tid=0x000000000104b800 nid=0xcb7 waiting for monitor entry [0x00000000422ee000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.releaseConnectionId(ConnectionManagerImpl.java:29) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.releaseConnectionId(ConnectionUtils.java:19) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.act(SearchEngineContainer.java:352) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.run(SearchEngineContainer.java:266) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "actor_14" prio=10 tid=0x00000000014f9800 nid=0xb3c waiting for monitor entry [0x00000000411f0000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.releaseConnectionId(ConnectionManagerImpl.java:29) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.releaseConnectionId(ConnectionUtils.java:19) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.act(SearchEngineContainer.java:352) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.run(SearchEngineContainer.java:266) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "actor_15" prio=10 tid=0x0000000001213000 nid=0xb25 waiting for monitor entry [0x00000000429f5000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.releaseConnectionId(ConnectionManagerImpl.java:29) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.releaseConnectionId(ConnectionUtils.java:19) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.act(SearchEngineContainer.java:352) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.run(SearchEngineContainer.java:266) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "actor_16" prio=10 tid=0x00000000032fa800 nid=0xabe waiting for monitor entry [0x00000000423ef000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.releaseConnectionId(ConnectionManagerImpl.java:29) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.releaseConnectionId(ConnectionUtils.java:19) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.act(SearchEngineContainer.java:352) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.run(SearchEngineContainer.java:266) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "actor_17" prio=10 tid=0x0000000003f22000 nid=0xaaf waiting for monitor entry [0x00000000430fc000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.releaseConnectionId(ConnectionManagerImpl.java:29) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.releaseConnectionId(ConnectionUtils.java:19) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.act(SearchEngineContainer.java:352) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.run(SearchEngineContainer.java:266) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "actor_18" prio=10 tid=0x0000000001595800 nid=0xa9f waiting for monitor entry [0x0000000042cf8000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.releaseConnectionId(ConnectionManagerImpl.java:29) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.releaseConnectionId(ConnectionUtils.java:19) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.act(SearchEngineContainer.java:352) at org.seosrv.engines.search.SearchEngineContainer$PositionCheckerXable.run(SearchEngineContainer.java:266) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "queue_3" prio=10 tid=0x00000000014f2000 nid=0x890 waiting for monitor entry [0x0000000040b05000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.getConnectionId(ConnectionManagerImpl.java:20) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.getConnectionId(ConnectionUtils.java:15) at org.seosrv.engines.search.SearchEngineContainer.startQueueProcessing(SearchEngineContainer.java:134) at org.seosrv.engines.search.SearchEngineManager$EngineQueueXable.act(SearchEngineManager.java:202) at org.seosrv.engines.search.SearchEngineManager$EngineQueueXable.run(SearchEngineManager.java:189) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "queue_4" prio=10 tid=0x0000000001039000 nid=0x88f waiting for monitor entry [0x000000004081b000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.getConnectionId(ConnectionManagerImpl.java:20) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.getConnectionId(ConnectionUtils.java:15) at org.seosrv.engines.search.SearchEngineContainer.startQueueProcessing(SearchEngineContainer.java:134) at org.seosrv.engines.search.SearchEngineManager$EngineQueueXable.act(SearchEngineManager.java:202) at org.seosrv.engines.search.SearchEngineManager$EngineQueueXable.run(SearchEngineManager.java:189) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "queue_5" prio=10 tid=0x0000000001786000 nid=0x88e waiting for monitor entry [0x000000004071a000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.getConnectionId(ConnectionManagerImpl.java:20) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.getConnectionId(ConnectionUtils.java:15) at org.seosrv.engines.search.SearchEngineContainer.startQueueProcessing(SearchEngineContainer.java:134) at org.seosrv.engines.search.SearchEngineManager$EngineQueueXable.act(SearchEngineManager.java:202) at org.seosrv.engines.search.SearchEngineManager$EngineQueueXable.run(SearchEngineManager.java:189) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "queue_6" prio=10 tid=0x0000000001f96000 nid=0x88d waiting for monitor entry [0x00000000421ed000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.getConnectionId(ConnectionManagerImpl.java:20) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.getConnectionId(ConnectionUtils.java:15) at org.seosrv.engines.search.SearchEngineContainer.startQueueProcessing(SearchEngineContainer.java:134) at org.seosrv.engines.search.SearchEngineManager$EngineQueueXable.act(SearchEngineManager.java:202) at org.seosrv.engines.search.SearchEngineManager$EngineQueueXable.run(SearchEngineManager.java:189) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "queue_7" prio=10 tid=0x00000000021a3800 nid=0x88c waiting for monitor entry [0x0000000041d12000] java.lang.Thread.State: BLOCKED (on object monitor) at org.seosrv.manager.ConnectionManagerImpl.getConnectionId(ConnectionManagerImpl.java:20) - waiting to lock <0x00007f9fd56f4ab8> (a org.seosrv.manager.ConnectionManagerImpl) at org.seosrv.utility.ConnectionUtils.getConnectionId(ConnectionUtils.java:15) at org.seosrv.engines.search.SearchEngineContainer.startQueueProcessing(SearchEngineContainer.java:134) at org.seosrv.engines.search.SearchEngineManager$EngineQueueXable.act(SearchEngineManager.java:202) at org.seosrv.engines.search.SearchEngineManager$EngineQueueXable.run(SearchEngineManager.java:189) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "queue_8" prio=10 tid=0x00000000016b9800 nid=0x88b waiting on condition [0x0000000040a04000] java.lang.Thread.State: TIMED_WAITING (sleeping) at java.lang.Thread.sleep(Native Method) at org.seosrv.engines.search.SearchEngineContainer.startQueueProcessing(SearchEngineContainer.java:136) at org.seosrv.engines.search.SearchEngineManager$EngineQueueXable.act(SearchEngineManager.java:202) at org.seosrv.engines.search.SearchEngineManager$EngineQueueXable.run(SearchEngineManager.java:189) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "DestroyJavaVM" prio=10 tid=0x0000000000cf8800 nid=0x86d waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE Locked ownable synchronizers: - None "Thread-4" prio=10 tid=0x0000000001495800 nid=0x88a runnable [0x0000000041c11000] java.lang.Thread.State: RUNNABLE at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method) at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:228) at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:83) at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87) - locked <0x00007f9fd5878c78> (a sun.nio.ch.Util$1) - locked <0x00007f9fd5878c90> (a java.util.Collections$UnmodifiableSet) - locked <0x00007f9fd5878c00> (a sun.nio.ch.EPollSelectorImpl) at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:98) at sun.net.httpserver.ServerImpl$Dispatcher.run(ServerImpl.java:307) at java.lang.Thread.run(Thread.java:636) Locked ownable synchronizers: - None "server-timer" daemon prio=10 tid=0x0000000001613000 nid=0x889 in Object.wait() [0x0000000040fcc000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x00007f9fd5878d78> (a java.util.TaskQueue) at java.util.TimerThread.mainLoop(Timer.java:531) - locked <0x00007f9fd5878d78> (a java.util.TaskQueue) at java.util.TimerThread.run(Timer.java:484) Locked ownable synchronizers: - None "InternetCheckerThread" daemon prio=10 tid=0x0000000001310800 nid=0x884 waiting on condition [0x000000004032c000] java.lang.Thread.State: TIMED_WAITING (sleeping) at java.lang.Thread.sleep(Native Method) at org.seosrv.utility.InternetCheckerThread.run(InternetCheckerThread.java:61) Locked ownable synchronizers: - None "ConsoleThread" prio=10 tid=0x00000000015e3800 nid=0x883 runnable [0x0000000040ecb000] java.lang.Thread.State: RUNNABLE at java.io.FileInputStream.readBytes(Native Method) at java.io.FileInputStream.read(FileInputStream.java:236) at java.io.BufferedInputStream.read1(BufferedInputStream.java:273) at java.io.BufferedInputStream.read(BufferedInputStream.java:334) - locked <0x00007f9fd54b01c0> (a java.io.BufferedInputStream) at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:282) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:324) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:176) - locked <0x00007f9fd56e8a48> (a java.io.InputStreamReader) at java.io.InputStreamReader.read(InputStreamReader.java:184) at java.io.BufferedReader.fill(BufferedReader.java:153) at java.io.BufferedReader.readLine(BufferedReader.java:316) - locked <0x00007f9fd56e8a48> (a java.io.InputStreamReader) at java.io.BufferedReader.readLine(BufferedReader.java:379) at org.fs.jcs.JcsCliThread.run(JcsCliThread.java:97) Locked ownable synchronizers: - None "WordstScheduleThread" prio=10 tid=0x000000000172d800 nid=0x882 waiting on condition [0x0000000041f68000] java.lang.Thread.State: TIMED_WAITING (sleeping) at java.lang.Thread.sleep(Native Method) at org.seosrv.engines.wordstat.WordstatEngineManager.launchAndWait(WordstatEngineManager.java:104) at org.seosrv.schedule.WordstatSchedule.fullCheck(WordstatSchedule.java:64) at org.seosrv.schedule.WordstatSchedule.run(WordstatSchedule.java:100) Locked ownable synchronizers: - None "PosScheduleThread" prio=10 tid=0x00000000012d1800 nid=0x881 waiting on condition [0x000000004197c000] java.lang.Thread.State: TIMED_WAITING (sleeping) at java.lang.Thread.sleep(Native Method) at org.seosrv.engines.search.SearchEngineManager.launchAndWait(SearchEngineManager.java:121) at org.seosrv.schedule.PositionSchedule.fullCheck(PositionSchedule.java:135) at org.seosrv.schedule.PositionSchedule.run(PositionSchedule.java:326) Locked ownable synchronizers: - None "net.sf.ehcache.CacheManager#45c1f5b2" daemon prio=10 tid=0x0000000001787000 nid=0x880 in Object.wait() [0x0000000040c97000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x00007f9fd56e8e20> (a java.util.TaskQueue) at java.util.TimerThread.mainLoop(Timer.java:531) - locked <0x00007f9fd56e8e20> (a java.util.TaskQueue) at java.util.TimerThread.run(Timer.java:484) Locked ownable synchronizers: - None "Low Memory Detector" daemon prio=10 tid=0x0000000000d8e800 nid=0x876 runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE Locked ownable synchronizers: - None "CompilerThread1" daemon prio=10 tid=0x0000000000d89000 nid=0x875 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE Locked ownable synchronizers: - None "CompilerThread0" daemon prio=10 tid=0x0000000000d87000 nid=0x874 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE Locked ownable synchronizers: - None "Signal Dispatcher" daemon prio=10 tid=0x0000000000d85800 nid=0x873 runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE Locked ownable synchronizers: - None "Finalizer" daemon prio=10 tid=0x0000000000d60800 nid=0x870 in Object.wait() [0x00000000416d2000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x00007f9fd54b0550> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:133) - locked <0x00007f9fd54b0550> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:149) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:177) Locked ownable synchronizers: - None "Reference Handler" daemon prio=10 tid=0x0000000000d5f000 nid=0x86f in Object.wait() [0x000000004049a000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0x00007f9fd54b0630> (a java.lang.ref.Reference$Lock) at java.lang.Object.wait(Object.java:502) at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133) - locked <0x00007f9fd54b0630> (a java.lang.ref.Reference$Lock) Locked ownable synchronizers: - None "VM Thread" prio=10 tid=0x0000000000d58000 nid=0x86e runnable "VM Periodic Task Thread" prio=10 tid=0x0000000000d91800 nid=0x877 waiting on condition JNI global references: 1608 ConnectionManagerImpl is a singleton, it's guaranteed that there is no explicit synchronization on it via synchronized (conManager) {...} within the hand-written code. Here is it's source: public class ConnectionManagerImpl implements ConnectionManager { private int maxCons = 30; private int lastGrantedConnectionId = 0; private final List <Integer> allConnections = new ArrayList <Integer>(); #Override public synchronized int getConnectionId(){ if (allConnections.size() >= maxCons) return -1; if (!InternetChecker.waitForInternet()) { //unsynch return -1; } int newId = ++lastGrantedConnectionId; allConnections.add(newId); return newId; } #Override public synchronized void releaseConnectionId(int connectionId){ if (!allConnections.remove(Integer.valueOf(connectionId))) { LogUtils.logError(new InternalException("Finished thread never was registred: " + "networkId = " + connectionId + ", active network IDs: " + allConnections)); } } } VPS configuration: CentOS 5 x64, OpenJDK 64-Bit 19.0-b09 App runned with -XX:HeapDumpPath=path_here -XX:+HeapDumpOnOutOfMemoryError -XX:-PrintClassHistogram -XX:-UseCompressedOops
I removed a InternetChecker.waitForInternet() call like Udi Cohen proposed and here is what I got: Exception in thread "queue_1" java.lang.IllegalMonitorStateException at org.seosrv.manager.ConnectionManagerImpl.getConnectionId(ConnectionManagerImpl.java:20) at org.seosrv.utility.ConnectionUtils.getConnectionId(ConnectionUtils.java:15) at org.seosrv.engines.search.SearchEngineContainer.startQueueProcessing(SearchEngineContainer.java:134) at org.seosrv.engines.search.SearchEngineManager$EngineQueueXable.act(SearchEngineManager.java:202) at org.seosrv.engines.search.SearchEngineManager$EngineQueueXable.run(SearchEngineManager.java:189) at java.lang.Thread.run(Thread.java:636) Exception in thread "queue_2" java.lang.IllegalMonitorStateException at org.seosrv.manager.ConnectionManagerImpl.getConnectionId(ConnectionManagerImpl.java:20) at org.seosrv.utility.ConnectionUtils.getConnectionId(ConnectionUtils.java:15) at org.seosrv.engines.search.SearchEngineContainer.startQueueProcessing(SearchEngineContainer.java:134) at org.seosrv.engines.search.SearchEngineManager$EngineQueueXable.act(SearchEngineManager.java:202) at org.seosrv.engines.search.SearchEngineManager$EngineQueueXable.run(SearchEngineManager.java:189) at java.lang.Thread.run(Thread.java:636) # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (synchronizer.cpp:1954), pid=15269, tid=1104439616 # guarantee(mid->header()->is_neutral()) failed: invariant # # JRE version: 6.0_20-b20 # Java VM: OpenJDK 64-Bit Server VM (19.0-b09 mixed mode linux-amd64 ) # Derivative: IcedTea6 1.9.8 # Distribution: CentOS release 5.6 (Final), package rhel-1.22.1.9.8.el5_6-x86_64 # An error report file with more information is saved as: # /hs_err_pid15269.log # # If you would like to submit a bug report, please include # instructions how to reproduce the bug and visit: # http://icedtea.classpath.org/bugzilla # I've already noticed the IllegalMonitorStateException under Oracle JDK 1.6.0_27 for c3p0 thread, but I thought that was a c3p0 problem. Now i've tested it better and got similiar error with IBM SDK. It seems like this is a virtualization bug. Thank you for your efforts.
(Disclaimer: my company develops JProfiler) Obviously, the jstack output is missing something in this case. I would recommend to consult a different tool that gets this information from the JVMTI profiling interface. In JProfiler, you get a view like this:
Do you have any specific reason for using OpenJDK? If not you can switch to another JDK to make sure this is not a bug in the JDK implementation.