JDK-8022391 : Custom ObjectInputStream/ObjectOutputStream suffer performance/scalbility issues
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io:serialization
  • Affected Version: 7u25
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • Submitted: 2013-08-06
  • Updated: 2014-04-24
  • Resolved: 2014-04-24
Related Reports
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
java version  " 1.7.0_25 " 
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Darwin MacBook-Pro.local 12.4.0 Darwin Kernel Version 12.4.0: Wed May  1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64

A DESCRIPTION OF THE PROBLEM :
Changes introduced by fixing the bug 8008132 (Changeset: 141facdacbf0b78cc596710bd3dcb40f9b74c981) lead to a lot of blocked threads in multithreaded environment when using sub-classes of ObjectInputStream/ObjectOutputStream. The cause of blocked threads is the call to ReflectUtil#checkPackageAccess(Class), which in turn calls at some point Proxy#isProxyClass(Class). The current implementation of Proxy#isProxyClass uses a synchronized map, which causes blocking in multithreaded environment.

This problem may also affect applications which uses RMI and CORBA as JDK contains sub-classes of ObjectInputStream/ObjectOutputStream in this areas:

- sun.rmi.server.MarshalOutputStream
- com.sun.corba.se.impl.io.OutputStreamHook
- com.sun.corba.se.impl.encoding.IDLJavaSerializationOutputStream.MarshalObjectOutputStream

Best regards
Andrej Golovnin

REGRESSION.  Last worked in version 7u21

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a test class, which starts multiple threads.
2. Each thread in the test class should serialize multiple objects.
3. Use profiler to see that all threads blocks each other.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Thread should not block each other when serializing/deserializing object using sub-classes of ObjectInputStream/ObjectOutputStream

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
  To fix this issue backport changes done for the issue 7123493 (Changeset: 5e7ae178b24dc9c77eed2a33f9a48eaf5c233c48)
Comments
JDK-7123493 has already been backported. Closing this as a duplicate.
24-04-2014

This is essentially a backport request for JDK-7123493, which was integrated into 8. Not sure how difficult it would be to backport that code, or whether it would be sensible to try to do some smaller optimizations in-place in the 7u code base. In any case this seems like a core-libs / java.lang:reflect issue, not a serialization issue.
07-08-2013

OK / SQE
06-08-2013

Need SQE-OK to defer
06-08-2013

This is not a stopper for 7u40 but we should look at the performance issues caused by the CPU fix JDK-8008132 to see if changes (particularly JDK-7123493) should be back-ported to some future 7 update.
06-08-2013