Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8022391

Custom ObjectInputStream/ObjectOutputStream suffer performance/scalbility issues

    XMLWordPrintable

    Details

      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)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              smarks Stuart Marks
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: