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

RMI-IIOP throws IndirectionException (with recursive ref to [de]serialized obj)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 1.3.0
    • Fix Version/s: 1.3.1
    • Component/s: other-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      01
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Backports

        Description



        Name: krC82822 Date: 02/10/2001


        10 Feb 2001, eval1127@eng -- may be related to #'s 4399798, 4375061.
        -------
        java version "1.3.0"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-beta_refresh)
        Java HotSpot(TM) Client VM (build 1.3.0-beta_refresh, mixed mode)

        RMI-IIOP throws an org.omg.CORBA.portable.IndirectionException when unmarshaling
        a Serializable object that implements readObject/writeObject and whose state
        contains a recursive reference to itself.

        I have already run this problem by [individual's name], an RMI-IIOP expert at
        [company name], who suggested filing this bug report.

        Here's the stack:

        org.omg.CORBA.portable.IndirectionException: minor code: 0 completed: Maybe
                at
        com.sun.corba.se.internal.iiop.CDRInputStream.read_value(CDRInputStream.java:781)

                at
        com.sun.corba.se.internal.iiop.CDRInputStream.read_abstract_interface(CDRInputStream

        .java:759)
                at
        com.sun.corba.se.internal.iiop.CDRInputStream.read_abstract_interface(CDRInputStream

        .java:751)
                at
        com.sun.corba.se.internal.io.IIOPInputStream.readObjectDelegate(IIOPInputStream.java

        :198)
                at
        com.sun.corba.se.internal.io.IIOPInputStream.readObjectOverride(IIOPInputStream.java

        :348)
                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:232)
                at examples.hello.SerObj.readObject(SerObj.java:25)
                at com.sun.corba.se.internal.io.IIOPInputStream.readObject(Native
        Method)
                at
        com.sun.corba.se.internal.io.IIOPInputStream.invokeObjectReader(IIOPInputStream.java

        :1160)
                at
        com.sun.corba.se.internal.io.IIOPInputStream.inputObject(IIOPInputStream.java:785)

                at
        com.sun.corba.se.internal.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:2

        29)
                at
        com.sun.corba.se.internal.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.jav

        a:234)
                at
        com.sun.corba.se.internal.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:194)

                at
        com.sun.corba.se.internal.iiop.CDRInputStream.read_value(CDRInputStream.java:985)

                at examples.hello._Hello_Stub.getRecursive(Unknown Source)
                at examples.hello.HelloClient.go(HelloClient.java:48)
                at examples.hello.HelloClient.main(HelloClient.java:25)
        Exception in thread "main" org.omg.CORBA.MARSHAL: minor code: 0 completed: No

                at
        com.sun.corba.se.internal.io.IIOPInputStream.readObjectDelegate(IIOPInputStream.java

        :204)
                at
        com.sun.corba.se.internal.io.IIOPInputStream.readObjectOverride(IIOPInputStream.java

        :348)
                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:232)
                at examples.hello.SerObj.readObject(SerObj.java:25)
                at com.sun.corba.se.internal.io.IIOPInputStream.readObject(Native
        Method)
                at
        com.sun.corba.se.internal.io.IIOPInputStream.invokeObjectReader(IIOPInputStream.java

        :1160)
                at
        com.sun.corba.se.internal.io.IIOPInputStream.inputObject(IIOPInputStream.java:785)

                at
        com.sun.corba.se.internal.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:2

        29)
                at
        com.sun.corba.se.internal.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.jav

        a:234)
                at
        com.sun.corba.se.internal.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:194)

                at
        com.sun.corba.se.internal.iiop.CDRInputStream.read_value(CDRInputStream.java:985)

                at examples.hello._Hello_Stub.getRecursive(Unknown Source)
                at examples.hello.HelloClient.go(HelloClient.java:48)
                at examples.hello.HelloClient.main(HelloClient.java:25)
        java.io.IOException: Serializable readObject method failed internally
                at
        com.sun.corba.se.internal.io.IIOPInputStream.throwExceptionType(Native Method)
                at
        com.sun.corba.se.internal.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:2

        41)
                at
        com.sun.corba.se.internal.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.jav

        a:234)
                at
        com.sun.corba.se.internal.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:194)

                at
        com.sun.corba.se.internal.iiop.CDRInputStream.read_value(CDRInputStream.java:985)

                at examples.hello._Hello_Stub.getRecursive(Unknown Source)
                at examples.hello.HelloClient.go(HelloClient.java:48)
                at examples.hello.HelloClient.main(HelloClient.java:25)
        java.rmi.MarshalException: CORBA MARSHAL 0 No; nested exception is:
                org.omg.CORBA.MARSHAL: Unable to read value from underlying bridge :
        Serializable readObject method failed internally minor code: 0 completed: No
        org.omg.CORBA.MARSHAL: Unable to read value from underlying bridge :
        Serializable readObject me
        thod failed internally minor code: 0 completed: No
                at
        com.sun.corba.se.internal.iiop.CDRInputStream.read_value(CDRInputStream.java:990)

                at examples.hello._Hello_Stub.getRecursive(Unknown Source)
                at examples.hello.HelloClient.go(HelloClient.java:48)
                at examples.hello.HelloClient.main(HelloClient.java:25)

        Here's a simple example that reproduces the problem:

        package examples.hello;
        import java.io.*;
        public class SerObj implements java.io.Serializable {
            public String name;
            public SerObj ref;
            public SerObj() {
                name = "default";
                ref = null;
            }
            public SerObj(String _name, SerObj _ref) {
                name = _name;
                ref = _ref;
            }
            public String toString() {
                return "SerObj("+name+")";
            }
            private void writeObject(java.io.ObjectOutputStream stream)
                throws IOException {
                stream.writeObject(name);
                stream.writeObject(ref);
            }
            private void readObject(java.io.ObjectInputStream stream)
               throws IOException, ClassNotFoundException {
               name = (String)stream.readObject();
               ref = (SerObj)stream.readObject();
           }
        }

        package examples.hello;

        import java.rmi.Remote;
        import java.rmi.RemoteException;

        public interface Hello extends Remote {
            String sayHello() throws RemoteException;
            SerObj getNonRecursive() throws RemoteException;
            SerObj getRecursive() throws RemoteException;
        }

        package examples.hello;

        import javax.rmi.PortableRemoteObject;
        import java.rmi.RemoteException;

        public class HelloImpl implements Hello {

            public HelloImpl() throws RemoteException {
                super();
            }

            public String sayHello() {
                return "Hello World!";
            }
            
            public SerObj getRecursive() throws RemoteException {
                SerObj obj = new SerObj();
                obj.name = "recursive";
                obj.ref = obj;
                return obj;
            }
            public SerObj getNonRecursive() throws RemoteException {
                SerObj obj = new SerObj();
                obj.name = "nonrecursive1";
                obj.ref = new SerObj();
                obj.ref.name = "nonrecursive2";
                return obj;
            }
        }

        package examples.hello;

        import java.io.*;
        import javax.rmi.PortableRemoteObject;
        import javax.rmi.CORBA.Stub;
        import javax.naming.*;

            /**
             * This class runs the hello client.
             */
        public class HelloClient {

            /**
             * Usage (property values are the defaults):
             * java HelloClient
             */
            public HelloClient() {
            super();
            }

            public static void main(String args[]) {
        HelloClient that = new HelloClient();
                try {
        that.go();
                } catch (Exception e) {
        e.printStackTrace();
                }
            }

            /**
             * Run the test
             */

            private void go() throws Exception {

        org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init((String[])null, null);

                FileInputStream f = new FileInputStream("t.tmp");
                ObjectInputStream s = new ObjectInputStream(f);
                Hello helloStub = (Hello)s.readObject();
                ((Stub)helloStub).connect(orb);
        System.out.println(helloStub.sayHello());
                System.out.println("get non-recursive:");
                System.out.println(helloStub.getNonRecursive().toString());
                System.out.println("get recursive:");
                System.out.println(helloStub.getRecursive().toString());
            }
        }

        package examples.hello;

        import java.io.*;
        import javax.rmi.PortableRemoteObject;
        import javax.rmi.CORBA.Stub;
        import javax.naming.*;

            /**
             * This class runs the hello server.
             */
        public class HelloServer {

            /**
             * Usage (property values are the defaults):
             * java HelloServer
             */
            public HelloServer() {
            super();
            }

            public static void main(String args[]) {
        HelloServer that = new HelloServer();
                try {
        that.go();
                } catch (Exception e) {
        e.printStackTrace();
                }
            }

            /**
             * Run the test
             */

            private void go() throws Exception {

        org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init((String[])null, null);

        HelloImpl helloImpl = new HelloImpl();
        // If HelloImpl does not extend PortableRemoteObject,
        // then need to explicitly export it.
                PortableRemoteObject.exportObject(helloImpl);
                Stub helloStub = (Stub)PortableRemoteObject.toStub(helloImpl);

                //Stub helloStub = (Stub)PortableRemoteObject.toStub(new HelloImpl());

                helloStub.connect(orb);

        FileOutputStream f = new FileOutputStream("t.tmp");
                ObjectOutputStream s = new ObjectOutputStream(f);
                s.writeObject(helloStub);

                // Hang around
        System.out.println("Entering orb.run()");
        orb.run();
            }
        }

        #!/bin/bash
        set -e
        PS4="runtest> "
        set -x
        java examples.hello.HelloServer&
        sleep 5
        server=$!
        java examples.hello.HelloClient
        kill -9 $server
        (Review ID: 113809)

        ======================================================================

        *******************************************************************************
        muthu.anbumani@eng 2001-07-27


        - Verification of the Attached Testcase against the Following builds Done Successfully.

        - Build: j2sdk-1_4_0-beta_refresh-bin-b73-solsparc-25_jul_2001
        - Build: j2sdk-1_3_1_01-fcs-bin-solsparc-27_jun_2001
        ********************************************************************************

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                eandersosunw Everett Anderson (Inactive)
                Reporter:
                kryansunw Kevin Ryan (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: