JDK-4895776 : ORB.disconnect() throws OBJ_ADAPTER for not connected objects
  • Type: Bug
  • Component: other-libs
  • Sub-Component: corba:orb
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2003-07-24
  • Updated: 2004-01-16
  • Resolved: 2004-01-16
Description

Name: jl125535			Date: 07/24/2003


FULL PRODUCT VERSION :
java version "1.3.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)

java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)


FULL OS VERSION :
Microsoft Windows 2000 [Version 5.00.2195]

EXTRA RELEVANT SYSTEM CONFIGURATION :
No special configuration.

A DESCRIPTION OF THE PROBLEM :
For objects that have not been connected to the ORB before, the ORB.disconnect() operation throws an OBJ_ADAPTER exception.  According to the org.omg.CORBA.ORB.disconnect() javadocs "Calling the method disconnect has no effect if the servant is not connected to the ORB."

This situation arises because we have a CORBA based application that disconnects objects from the ORB for memory management purposes.  Due to the peer to peer structure of the application, some objects to disconnect were not published to other distributed applications and thus have not been connected to the ORB before.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
The demo application can be used for reproduction.  The single point of interest is the main() method.

When the application is executed it creates an instance of an org.omg.CORBA.Object (actually an BindingIterator, but this works for all classes) and disconnects it from the ORB.

The result is an OBJ_ADAPTER exception being printed to System.err

EXPECTED VERSUS ACTUAL BEHAVIOR :
The expected result is that ORB.disconnect() silently handles the call.

Actual result is the OBJ_ADAPTER exception.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Stack trace for 1.3:
org.omg.CORBA.OBJ_ADAPTER:   minor code: 1398079492 completed: Maybe
	at com.sun.corba.se.internal.corba.ORB.disconnect(ORB.java:1117)
	at disconnect.DisconnectAnomaly.main(DisconnectAnomaly.java:48)

Stack trace for 1.4:
org.omg.CORBA.OBJ_ADAPTER:   vmcid: SUN  minor code: 202 completed: Maybe
        at com.sun.corba.se.internal.corba.ORB.disconnect(ORB.java:2071)
        at disconnect.DisconnectAnomaly.main(DisconnectAnomaly.java:45)


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
/*
 * Demonstrates the ORB.disconnect() problem.
 */
package disconnect;

import org.omg.CosNaming.*;



/**
 * The main() method creates an instance of the class and
 * intentionally disconnects this from the ORB without ever connecting it
 * before.
 */
public class DisconnectAnomaly
  extends _BindingIteratorImplBase
{
  public static void main( String[] argv )
  {
    // Create an instance of an or.omg.CORBA.Object
    DisconnectAnomaly da = new DisconnectAnomaly();
    org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init( argv, null );

    try
    {
      // As a workaround connect the object, this will result in a successful
      // disconnect below.
      // orb.connect( da );

      orb.disconnect( da );
    }
    catch ( Exception e )
    {
      System.err.println( " --- Received exception ---" );
      e.printStackTrace();
    }
  }


  /**
   * The following code implements a valid org.omg.CORBA object without real
   * functionality just for demo purposes.  The BindingIterator was used since
   * it was the simplest org.omg.CORBA.Object class available in the jdk.
   */
  public DisconnectAnomaly()
  {
  }
  /**
   * Dummy implementation.  Not used in demo.
   */
  public boolean next_one( BindingHolder bh )
  {
    return false;
  }
  /**
   * Dummy implementation.  Not used in demo.
   */
  public boolean next_n( int n, BindingListHolder bh )
  {
    return false;
  }
  /**
   * Dummy implementation.  Not used in demo.
   */
  public void destroy()
  {
  }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :

Before disconnect()ing the object, it can be connect()ed.  This sequence of calls works.

OR

Catching and ignoring the OBJ_ADAPTER exception.
(Incident Review ID: 184123) 
======================================================================

Comments
EVALUATION ###@###.### 2004-01-16
16-01-2004