JDK-7019847 : memory leak on java.util.concurrent.locks.AbstractQueuedSynchronizer$Node
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.concurrent
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: linux
  • CPU: x86
  • Submitted: 2011-02-16
  • Updated: 2012-03-20
  • Resolved: 2011-04-10
Related Reports
Relates :  
Description
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

Comments
EVALUATION There has been no further information from the submitter. Closing as not reproducible.
10-04-2011

PUBLIC COMMENTS This is a very confusing report. Object.wait() has nothing to do with AbstractQueuedSynchronizer. Please provide further information that shows the creation of the AQS Node instances and where they are being created. As I said use of Object.wait() is completely unrelated to AQS.
22-02-2011