Skip to main content

Problem

  • Product : VisiBroker for C
  • Product Version: 6.0
  • Platform : Unix
  • Product Component : ORB

Server process hangs when a CORBA invocation on another object residing in the same POA is made in a servant's destructor. The issue can be reproduced in Solaris and Linux but not on Windows. A CR 1426 has been raised for this issue.

Resolution

Root Cause:

A deadlock has occurred in this scenario.

1. The Server deactivate an object by calling "poa->deactivate_object(oid)".
2. The DeactivateObject thread locks mutex (_mtx) in the POA before trying to deactivate the object.
3. The destructor is called after the ref count reaches zero. Note that the customer was using their own implementation of _remove_ref() and add_ref(). This problem does not occur when our PortableServer::RefCountServantBase implementation is used instead.
4. But the servant destructor makes a CORBA invocation on another in-process object which resides in the same POA.
5. This causes the POA to be locked again and result in the deadlock.

The following stack trace shows the issue:

[1] __lwp_park(0x4, 0x0, 0x0, 0x0, 0xcaf68, 0xcc888), at 0xfe9f5e8c
[2] mutex_lock_queue(0xfea08b44, 0x0, 0x12d9a0, 0xfea08000, 0x86, 0x86), at 0xfe9f1c08
[3] slow_lock(0x12d9a0, 0xfe651000, 0x1, 0x5d2f27ea, 0xb, 0x2c), at 0xfe9f2608
[4] VISMutex_var::VISMutex_var(0xfdefba58, 0x12d998, 0x1, 0x38e937a0, 0x1b, 0x97e50366), at 0xfebb9264
[5] VISPOA::preinvoke(0x163548, 0x0, 0x165548, 0x164158, 0x0, 0xfdefba48), at 0xfeed2ea8
....
[9] Bank::Account::close(this = 0x1463d0), line 246 in "Bank_c.cc"
[10] AccountImpl::cleanup(this = 0x149378), line 34 in "BankImpl.h"
[11] AccountImpl::~AccountImpl(this = 0x149378), line 19 in "BankImpl.h"
[12] __SLIP.DELETER__IC(0x149378, 0x1, 0xc9af4, 0x394dc, 0x0, 0x1), at 0x2c1d0
[13] AccountImpl::_remove_ref(this = 0x149378), line 52 in "BankImpl.h"
[14] VISPOA::_deactivate_object(0x12d730, 0x163088, 0xff34ec4c, 0xff078a4c, 0xca8e4, 0x1), at 0xfeed9724
[15] VISDeactivateObject::begin(0x1497d8, 0x164e38, 0x164e38, 0x4, 0x1, 0x1), at 0xfeeeb69c

 The CR: 1426 has been fixed in VisiBroker 7.0 GA.


#Security
#1426
#hang
#mutex_lock_queue
#deadlock
#destructor
#VisiBroker