What could be the cause of JVM thread dumps that show threads waiting to lock on a monitor, but the monitors do not have corresponding locking threads?
Java 1.5_14 on Windows 2003
Does your code by any change use any JNI? (i.e. are you running any native code launched from Java?).
We've seen a similar behavior, but JDK 1.6.0_05. App appears to deadlock, but Jstack shows threads waiting for a lock that no other threads are holding onto. We have some JNI code, so it's possible we're corrupting something.
We haven't found a solution for this and the issue is only reproducible on 1 machine.
Do those waiting threads wait for ever, or do they eventually proceed?
If the latter, it may be that the lock is held by the garbage collector.
You can add the arguments -verbose:gc with -XX:+PrintGCDetails
on your java command line to be told when GCs are occurring. If gc activity coincides with your slowdowns it may indicate that this is the problem.
Here's some information on garbage collection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With