FULL PRODUCT VERSION :
java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Server VM (build 17.1-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux ----- 2.6.26-2-amd64 #1 SMP Thu Nov 5 02:23:12 UTC 2009 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
I start my multi-threaded application and eventually it starts to slow down.
tracking it with the visualgc tool, and after doing a dump of the heap with jmap
I saw
12931 instances of class java.util.concurrent.locks.AbstractQueuedSynchronizer$Node
then
58951 instances of class java.util.concurrent.locks.AbstractQueuedSynchronizer$Node
and so on.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
The problem is on the Object.wait(ms) method
when calling it, the jvm leaks instances of java.util.concurrent.locks.AbstractQueuedSynchronizer$Node
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expect it to run and not to leak instances of java.util.concurrent.locks.AbstractQueuedSynchronizer$Node
ACTUAL -
tons of instances of java.util.concurrent.locks.AbstractQueuedSynchronizer$Node
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
private ArrayList<AudioPacket> queue = new ArrayList<AudioPacket>(50);
synchronized (queue) {
while (queue.size() == 0) {
queue.wait(1000);
}
packet = queue.remove(0);
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
using Object.wait() instead of Object.wait(1000) fixed the problem