From d9d2fdaf7670f5dbd5f8c3e8f65df747156d8e45 Mon Sep 17 00:00:00 2001 From: elliott_c Date: Tue, 3 Jun 2008 15:15:30 +0000 Subject: ChangeLogTag: Tue Jun 3 15:15:10 UTC 2008 Chad Elliott --- TAO/ChangeLog | 16 +++++++++++++--- TAO/tao/Transport_Connector.cpp | 41 ++++++++++++++++++++--------------------- TAO/tao/Transport_Connector.h | 7 +++---- 3 files changed, 36 insertions(+), 28 deletions(-) diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 29c4cf1d8f6..85a934a6a3e 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,13 @@ +Tue Jun 3 15:15:10 UTC 2008 Chad Elliott + + * tao/Transport_Connector.h: + * tao/Transport_Connector.cpp: + + Changed the wait_for_transport() method to always use a timeout + when waiting through the active connect strategy. Not doing so + can cause a deadlock if another thread is already in the reactor + (through CORBA::ORB::run()). + Tue Jun 03 14:15:00 UTC 2008 Simon Massey * tao/TAO_Internal.cpp: @@ -7,10 +17,10 @@ Tue Jun 03 14:15:00 UTC 2008 Simon Massey Mon Jun 2 21:51:36 UTC 2008 Phil Mesnier * tao/TAO_Internal.cpp: - - Reordered the parsing of parameters and the registration of global + + Reordered the parsing of parameters and the registration of global services within TAO::ORB::open_global_services(), as the global - services registration needs to have the result of parsing out + services registration needs to have the result of parsing out -ORBNegotiateCodesets before it tries to load the codeset library. Mon Jun 2 14:58:26 UTC 2008 William R. Otte diff --git a/TAO/tao/Transport_Connector.cpp b/TAO/tao/Transport_Connector.cpp index ff62ce2b3ad..15f5e461c48 100644 --- a/TAO/tao/Transport_Connector.cpp +++ b/TAO/tao/Transport_Connector.cpp @@ -347,10 +347,9 @@ TAO_Connector::parallel_connect (TAO::Profile_Transport_Resolver *r, } bool -TAO_Connector::wait_for_transport(TAO::Profile_Transport_Resolver *r, - TAO_Transport *transport, - ACE_Time_Value *timeout, - bool force_wait) +TAO_Connector::wait_for_transport (TAO::Profile_Transport_Resolver *r, + TAO_Transport *transport, + ACE_Time_Value *timeout) { if (transport->connection_handler ()->is_timeout ()) { @@ -394,7 +393,7 @@ TAO_Connector::wait_for_transport(TAO::Profile_Transport_Resolver *r, return true; } - else if (force_wait || r->blocked_connect ()) + else { if (TAO_debug_level > 2) { @@ -403,7 +402,21 @@ TAO_Connector::wait_for_transport(TAO::Profile_Transport_Resolver *r, ACE_TEXT(" waiting on transport [%d]\n"), transport->id () )); } - int result = this->active_connect_strategy_->wait (transport, timeout); + + // We must ensure that there is a timeout if there was none + // supplied and the connection isn't a blocking connection. If + // another thread has called ORB::run() prior to this attempted + // connection, the wait() call will block forever (or until the ORB + // thread leaves the reactor, which may not happen). + int result = 0; + if (timeout == 0 && !r->blocked_connect ()) + { + ACE_Time_Value tv (0, 500); + result = this->active_connect_strategy_->wait (transport, &tv); + } + else + result = this->active_connect_strategy_->wait (transport, timeout); + if (result == -1 && errno == ETIME) { if (TAO_debug_level > 2) @@ -448,20 +461,6 @@ TAO_Connector::wait_for_transport(TAO::Profile_Transport_Resolver *r, return true; } } - else - { - if (TAO_debug_level > 2) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT("TAO (%P|%t) - TAO_Connector::wait_for_transport, ") - ACE_TEXT(" Connection not complete [%d]\n"), - transport->id () )); - } - transport->connection_handler ()->reset_state ( - TAO_LF_Event::LFS_CONNECTION_WAIT); - - return true; - } return false; } @@ -626,7 +625,7 @@ TAO_Connector::connect (TAO::Profile_Transport_Resolver *r, } else // not making new connection { - (void) this->wait_for_transport (r, base_transport, timeout, true); + (void) this->wait_for_transport (r, base_transport, timeout); base_transport->remove_reference (); } } diff --git a/TAO/tao/Transport_Connector.h b/TAO/tao/Transport_Connector.h index d509a911868..cb250ff8897 100644 --- a/TAO/tao/Transport_Connector.h +++ b/TAO/tao/Transport_Connector.h @@ -193,10 +193,9 @@ protected: /// Note: no longer changes transport reference count /// @ returns true if wait was uneventful /// @ false if error occurred during wait - bool wait_for_transport(TAO::Profile_Transport_Resolver *r, - TAO_Transport *base_transport, - ACE_Time_Value * timeout, - bool force_wait); + bool wait_for_transport (TAO::Profile_Transport_Resolver *r, + TAO_Transport *base_transport, + ACE_Time_Value * timeout); /// Set the ORB Core pointer void orb_core (TAO_ORB_Core *orb_core); -- cgit v1.2.1