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

Sporadic RMI communication errors: "java.io.InvalidClassException: Not a proxy"

XMLWordPrintable

    • x86
    • windows_2012

      FULL PRODUCT VERSION :
      java version "1.7.0_76"
      Java(TM) SE Runtime Environment (build 1.7.0_76-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 24.76-b04, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Windows 2012 server

      A DESCRIPTION OF THE PROBLEM :
      We have a fairly complex server application using RMI for remote communication. From time to time we experience communication failures of the following form:

      java.util.concurrent.ExecutionException: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
      java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
      java.io.InvalidClassException: Not a proxy

      We believe this might be a regression which was introduced during a major overhaul of the internal cache management in class java.lang.reflect.Proxy between JDK 1.7.0_17 and JDK_1.7.0_72.

      We have traced the root cause down to java.io.ObjectInputStream.readProxyDesc(boolean) :

      ...
                  if ((cl = resolveProxyClass(ifaces)) == null) {
                      resolveEx = new ClassNotFoundException("null class");
                  } else if (!Proxy.isProxyClass(cl)) {
                      throw new InvalidClassException("Not a proxy");
      ...

      java.lang.reflect.Proxy.isProxyClass:

              return Proxy.class.isAssignableFrom(cl) && proxyClassCache.containsValue(cl);

      Since 'cl' cannot be null it basically means that the assertion whether the returned object is a proxy is failing because between the call to 'resolveProxyClass' and 'Proxy.isProxyClass' the internally stored cache entry in the java.lang.reflect.WeakCache 'Proxy.proxyClassCache' has been removed.

      Please note that older version (for example JDK1.7.0_17) did not have this additional check after the call to java.io.ObjectInputStream.resolveProxyClass(String[]).


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Unfortunately we have not yet been able to reproduce this deterministically.


      REPRODUCIBILITY :
      This bug can be reproduced occasionally.

            coffeys Sean Coffey
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: