JDK-6706797 : Heavy Lock Contention using ObjectInputStream
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.io:serialization
  • Affected Version: 6u10
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2008-05-23
  • Updated: 2010-04-04
  • Resolved: 2008-05-29
Related Reports
Duplicate :  
Description
A DESCRIPTION OF THE REQUEST :
Our application deserializes the same class in hundreds of threads pretty much all the time.  We've hit a bottleneck in ObjectInputStream that is causing all threads to wait on a global ReferenceQueue.  Here's the common stack trace seen in 500 threads:

        - waiting to lock <0x00002aab4cd568d8> (a java.lang.ref.ReferenceQueue$Lock)
        at java.io.ObjectStreamClass.processQueue(ObjectStreamClass.java:2234)
        at java.io.ObjectStreamClass.getReflector(ObjectStreamClass.java:2066)
        at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:602)
        at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
        at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
        at com.danga.MemCached.MemCachedClient.loadItems(MemCachedClient.java:1547)


JUSTIFICATION :
This type of concurrency problem is not acceptable.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Threads should not have this contention.
ACTUAL -
Threads are blocked on a global shared Queue.

CUSTOMER SUBMITTED WORKAROUND :
Haven't found one yet...

Comments
EVALUATION This appears to be a duplicate of 6525425, which was fixed in 5.0u14 but not in a JDK 6 release yet. Although 6525425's original Description states that it is specific to machines with Niagara architecture, there is an SR and SDN Comments about it on x64 (with Linux) as well, with JDK 6.
29-05-2008