Please report new issues athttps://github.com/DOCGroup
Consider the following code from Servant_Activator.cpp PortableServer::Servant Servant_Activator::incarnate (const PortableServer::ObjectId &oid, PortableServer::POA_ptr) { CORBA::String_var str = PortableServer::ObjectId_to_string (oid); if (CIAO::debug_level () > 9) ACE_DEBUG ((LM_DEBUG, "CIAO (%P|%t) - Servant_Activator::incarnate, " "activating port name [%s] \n", str.in ())); { // i removed some code to just illucidate my point // we first acquire the mutex via ACE_Guard ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->mutex_, 0); for (size_t t = 0; t != sz; ++t) { if (ACE_OS::strcmp (tmp->oid (), str.in ()) == 0) { // We should try avoiding making outbound calls with the // lock held. Oh well, let us get some sense of sanity in // CIAO to do think about these. if (CIAO::debug_level () > 5) ACE_DEBUG ((LM_DEBUG, "Activating Port %s\n", str.in ())); return this->pa_[t]->activate (oid); } } } } Well, if we don't need to hold the lock before we make the outbound call, why are we doing it? Can't we do something like this instead? if (ACE_OS::strcmp (tmp->oid (), str.in ()) == 0) { // first obtain the pointer to Port_Activator // with the mutex held Port_Activator* pa = this->pa_[t]; // now release the mutex // when we release the mutex like this // it will not be released again when the scope // of the guard ends. Check ACE_Guard implementation // and bugzilla 2903 discussion. guard.release() // now activate, we're not holding the lock // on an outbound call. return this->pa_[t]->activate (oid); }
changed severity
Fix recently merged to head. We no longer hold the lock on the outbound call.