JDK-6520484 : OrbReuseTracker can prematurely destroy Orbs
  • Type: Bug
  • Component: core-libs
  • Sub-Component: javax.naming
  • Affected Version: 6
  • Priority: P2
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2007-02-01
  • Updated: 2010-04-02
  • Resolved: 2007-06-25
Related Reports
Relates :  
Bug Description: The com/sun/jndi/cosnaming/CNCtx class now uses a class called OrbReuseTracker to try to manage ORB destruction (I believe this is to try to address an Object leak issue).

This uses a reference counting strategy to detect when an Orb can be destroyed.

An OrbReuseTracker instance is only created if the ORB is created within CNCtx, not if one is passed to it.

However, that ORB can validly "escape" from the CNCtx object and be used by code above, such that the CNCtx goes out of scope, is collected and finalized, causing the OrbReuseTracker to destroy the ORB, even though the ORB is in use elsewhere.

A testcase has been uploaded to ftp://sunsolve.sun.com/cores as ibm-20070201.zip.

To reproduce the issue:

1. Extract the files.
2. Run javaidl.bat
3. The test hangs after a GC cycle and does not complete.

Expected behaviour:

The test completes. Run the same test on 5.0 to see the expected behaviour.

WORK AROUND Another work around is to let the application create an ORB object and pass it on to CNCtx.

EVALUATION From a quick glance at the source code reveals that the finalize() method is taking into account the reuse count. Needs a thorough investigation.

WORK AROUND I simply disabled the ORB destruction, which reverts to Java 5 behaviour, including (unfortunately) the object leak.