Bug 2533

Summary: tss resources of ORB_Core are leaking (never cleaned up)
Product: TAO Reporter: Martin Cornelius <Martin.Cornelius>
Component: ORBAssignee: Vladimir Zykov <vladimir.zykov>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 1.5.1   
Hardware: other   
OS: other   
Bug Depends on: 846    
Bug Blocks:    
Attachments: Proposed fix

Description Martin Cornelius 2006-05-11 07:27:12 CDT
The method TAO_Cleanup_Func_Registry::cleanup(), which is designed to clean up 
the tss resources of ORB_Core abjects is never called. This can simply be 
proven by commenting out the method declaration and it's implementation in 
files Cleanup_Func_Registry.*

My suggestion to fix this:

Add this before the end of TAO_ORB_Core::~TAO_ORB_Core()

this->tss_cleanup_funcs_.cleanup(tss_resources_->ts_objects_);

regards, Martin
Comment 1 Ossama Othman 2006-05-11 11:38:17 CDT
Looks fine to me.  Thanks Martin!
Comment 2 Johnny Willemsen 2007-04-25 03:52:25 CDT
Wed Apr 25 08:52:12 UTC 2007  Johnny Willemsen  <jwillemsen@remedy.nl>

        * tao/ORB_Core.cpp:
          Cleanup TSS resources in the destructor. This fixes bugzilla bug 2533.
          Thanks to Martin Cornelius <Martin dot Cornelius at smiths-heimann dot com>
          for reporting this.

        * tao/Cleanup_Func_Registry.h:
        * tao/PI/ORBInitInfo.cpp:
          Layout changes
Comment 3 Johnny Willemsen 2007-04-26 00:49:56 CDT
Thu Apr 26 05:48:12 UTC 2007  Johnny Willemsen  <jwillemsen@remedy.nl>

        Reverted the change below, this breaks the Portable_Interceptors/Slot
        and Portable_Interceptors/Bug_2510_Regression tests on linux

        Wed Apr 25 08:52:12 UTC 2007  Johnny Willemsen  <jwillemsen@remedy.nl>
        * tao/ORB_Core.cpp:
          Cleanup TSS resources in the destructor. This fixes bugzilla bug 2533.
          Thanks to Martin Cornelius <Martin dot Cornelius at smiths-heimann dot com>
          for reporting this.
Comment 4 Johnny Willemsen 2007-04-27 03:08:07 CDT
reassign to reporter, can you make an updated patch, this one causes some regression tests to fail
Comment 5 Vladimir Zykov 2010-07-20 09:53:19 CDT
Created attachment 1303 [details]
Proposed fix

We faced the same problem but we think that the fix must be different. In particular a good place for cleaning tss resources is ORB_Core::destroy(). The reason is stated in the patch but here is a copy of that explanation.

  // Clean TSS resources. This cannot be done in shutdown() since the later
  // can be called during an upcall and once it's done it will remove
  // resources such as PICurrent that are required after the upcall. And this
  // cannot be postponed to TAO_ORB_Core's destructor as fini() needs access
  // to orb core and what is more important orb core can be destroyed too late
  // when some required libraries are already unloaded and we'll get
  // 'pure virtual method called' during cleanup.

Reproducers for this leak are Portable_Interceptors/Slot, Portable_Interceptors/Bug_2510_Regression, Portable_Interceptors/PICurrent.
Comment 6 Vladimir Zykov 2010-07-21 05:05:09 CDT
Committed a fix in revision 91153.

Wed Jul 21 09:57:34 UTC 2010  Vladimir Zykov  <vladimir.zykov@prismtech.com>

        * tao/ORB_Core_TSS_Resources.cpp:
        * tao/ORB_Core.cpp:
        * tao/ORB_Core.inl:
        * tao/ORB_Core_TSS_Resources.h:
        * tao/ORB_Core.h:
          Fixed bug 2533. Now ORB_Core's TSS resources are cleaned during
          orb destroy.

        * tests/Portable_Interceptors/Slot/driver.cpp:
          Explicitely destroy orb since doing this implicitely when main()
          returns is too late.
Comment 7 Vladimir Zykov 2010-07-21 05:06:52 CDT
Added depends.