diff options
author | Phil Mesnier <mesnier_p@ociweb.com> | 2013-04-29 16:41:37 +0000 |
---|---|---|
committer | Phil Mesnier <mesnier_p@ociweb.com> | 2013-04-29 16:41:37 +0000 |
commit | 02529e9fa519d491fbd06fe7d7be06dda88f3d16 (patch) | |
tree | fc29e181eef425aa69bd4e3efa54dfc852e72b7c | |
parent | e9865eef8177389b66a41aaad1d543b506b2d990 (diff) | |
download | ATCD-02529e9fa519d491fbd06fe7d7be06dda88f3d16.tar.gz |
Mon Apr 29 16:35:35 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com>
-rw-r--r-- | TAO/ChangeLog | 22 | ||||
-rw-r--r-- | TAO/bin/tao_other_tests.lst | 1 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp | 8 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp | 67 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h | 6 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp | 66 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/LiveCheck.h | 6 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp | 6 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/client.cpp | 79 | ||||
-rwxr-xr-x | TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/run_test.pl | 138 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/server.cpp | 62 |
11 files changed, 296 insertions, 165 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 691967f33c6..974ea36db2a 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,25 @@ +Mon Apr 29 16:35:35 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com> + + * bin/tao_other_tests.lst: + + * orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp: + * orbsvcs/ImplRepo_Service/ImR_Locator_i.h: + * orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp: + * orbsvcs/ImplRepo_Service/LiveCheck.h: + * orbsvcs/ImplRepo_Service/LiveCheck.cpp: + * orbsvcs/ImplRepo_Service/Locator_Options.cpp: + + Clean up and add more debugging output. Fix the scenario where a + registered server takes longer than 16.610 seconds to get from + creating a POA to activating that POA. + + * orbsvcs/tests/ImplRepo/servers_interact_on_startup/client.cpp: + * orbsvcs/tests/ImplRepo/servers_interact_on_startup/run_test.pl: + * orbsvcs/tests/ImplRepo/servers_interact_on_startup/server.cpp: + + Add a test variant for using the IMR command line utility to + start a delayed server to validate that use case. + Sun Apr 28 14:37:50 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com> * orbsvcs/ImplRepo_Service/LiveCheck.cpp: diff --git a/TAO/bin/tao_other_tests.lst b/TAO/bin/tao_other_tests.lst index acb28a152bc..48f13413c1f 100644 --- a/TAO/bin/tao_other_tests.lst +++ b/TAO/bin/tao_other_tests.lst @@ -138,6 +138,7 @@ TAO/orbsvcs/tests/ImplRepo/ReconnectServer/run_test.pl -forwardonce: !MINIMUM !C TAO/orbsvcs/tests/ImplRepo/ReconnectServer/run_test.pl -pingexternal: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !LynxOS TAO/orbsvcs/tests/ImplRepo/RestartServer/run_test.pl: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !LynxOS !OpenVMS TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/run_test.pl: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !LynxOS !OpenVMS +TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/run_test.pl -delay 20 -imr_start: !ST !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !LynxOS !OpenVMS TAO/orbsvcs/examples/ImR/Combined_Service/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !STATIC !ST !ACE_FOR_TAO !LynxOS TAO/orbsvcs/examples/CosEC/TypedSimple/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !NO_IFR !ACE_FOR_TAO !WCHAR TAO/orbsvcs/tests/CosEvent/Timeout/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !ST !NO_MESSAGING !ACE_FOR_TAO !LynxOS diff --git a/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp index 1ebe4c69361..321680b3dab 100644 --- a/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp @@ -5,6 +5,8 @@ #include "ImR_Locator_i.h" #include "Locator_Repository.h" +#include "orbsvcs/Log_Macros.h" + //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- @@ -223,6 +225,12 @@ AsyncAccessManager::server_is_running (const char *partial_ior, void AsyncAccessManager::ping_replied (LiveStatus server) { + if (ImR_Locator_i::debug () > 2) + { + ORBSVCS_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) AsyncAccessManager, status = %d\n"), + server)); + } switch (server) { case LS_ALIVE: diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp index 8a49b6a4dc4..912c88e0276 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp @@ -53,11 +53,12 @@ createPersistentPOA (PortableServer::POA_ptr root_poa, const char* poa_name) { return poa._retn (); } +int ImR_Locator_i::debug_ = 0; + ImR_Locator_i::ImR_Locator_i (void) : dsi_forwarder_ (*this) , ins_locator_ (0) , aam_set_ () - , debug_ (0) , read_only_ (false) , ping_external_ (false) , unregister_if_address_reused_ (false) @@ -84,7 +85,7 @@ int ImR_Locator_i::init_with_orb (CORBA::ORB_ptr orb, Options& opts) { this->orb_ = CORBA::ORB::_duplicate (orb); - this->debug_ = opts.debug (); + ImR_Locator_i::debug_ = opts.debug (); this->read_only_ = opts.readonly (); this->startup_timeout_ = opts.startup_timeout (); this->ping_external_ = opts.ping_external (); @@ -98,7 +99,7 @@ ImR_Locator_i::init_with_orb (CORBA::ORB_ptr orb, Options& opts) this->dsi_forwarder_.init (orb); this->adapter_.init (& this->dsi_forwarder_); - this->pinger_.init (orb, this->ping_interval_, this->debug_); + this->pinger_.init (orb, this->ping_interval_); // Register the Adapter_Activator reference to be the RootPOA's // Adapter Activator. @@ -328,7 +329,7 @@ ImR_Locator_i::register_activator ACE_ASSERT (err == 0); ACE_UNUSED_ARG (err); - if (this->debug_ > 0) + if (debug_ > 0) ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: Activator registered for %C.\n"), aname)); @@ -346,7 +347,7 @@ ImR_Locator_i::unregister_activator if (! info.null ()) { - if (info->token != token && this->debug_ > 0) + if (info->token != token && debug_ > 0) { ORBSVCS_DEBUG (( LM_DEBUG, @@ -358,13 +359,13 @@ ImR_Locator_i::unregister_activator this->unregister_activator_i (aname); - if (this->debug_ > 0) + if (debug_ > 0) ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: Activator %C unregistered.\n"), aname)); } else { - if (this->debug_ > 0) + if (debug_ > 0) ORBSVCS_DEBUG (( LM_DEBUG, ACE_TEXT ("ImR: Ignoring unregister activator: %C. ") @@ -389,7 +390,7 @@ ImR_Locator_i::notify_child_death { ACE_ASSERT (name != 0); - if (this->debug_ > 1) + if (debug_ > 1) ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: Server has died <%C>.\n"), name)); UpdateableServerInfo info(this->repository_.get(), name); @@ -400,7 +401,7 @@ ImR_Locator_i::notify_child_death } else { - if (this->debug_ > 1) + if (debug_ > 1) ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: Failed to find server in repository.\n"))); } @@ -561,7 +562,7 @@ ImR_Locator_i::set_timeout_policy (CORBA::Object_ptr obj, const ACE_Time_Value& if (CORBA::is_nil (ret.in ())) { - if (this->debug_ > 0) + if (debug_ > 0) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: Unable to set timeout policy.\n"))); @@ -621,7 +622,7 @@ ImR_Locator_i::add_or_update_server UpdateableServerInfo info(this->repository_.get(), serverKey); if (info.null ()) { - if (this->debug_ > 1) + if (debug_ > 1) ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: Adding server <%C>.\n"), server)); this->repository_->add_server ("", @@ -636,7 +637,7 @@ ImR_Locator_i::add_or_update_server } else { - if (this->debug_ > 1) + if (debug_ > 1) ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: Updating server <%C>.\n"), server)); @@ -651,7 +652,7 @@ ImR_Locator_i::add_or_update_server info.update_repo(); } - if (this->debug_ > 1) + if (debug_ > 1) { // Note : The info var may be null, so we use options. ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: Server: %C\n") @@ -736,7 +737,7 @@ ImR_Locator_i::remove_server { if (this->repository_->remove_server (serverKey) == 0) { - if (this->debug_ > 1) + if (debug_ > 1) ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: Removing Server <%C>...\n"), name)); @@ -748,7 +749,7 @@ ImR_Locator_i::remove_server bool wait = false; poa->destroy (etherealize, wait); } - if (this->debug_ > 0) + if (debug_ > 0) ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: Removed Server <%C>.\n"), name)); @@ -787,7 +788,7 @@ ImR_Locator_i::shutdown_server { ACE_ASSERT (server != 0); - if (this->debug_ > 0) + if (debug_ > 0) ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: Shutting down server <%C>.\n"), server)); @@ -842,7 +843,7 @@ ImR_Locator_i::shutdown_server info.edit ()->reset (); // Note : This is a good thing. It means we didn't waste our time waiting for // the server to finish shutting down. - if (this->debug_ > 1) + if (debug_ > 1) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: Timeout while waiting for <%C> shutdown.\n"), @@ -854,7 +855,7 @@ ImR_Locator_i::shutdown_server } catch (CORBA::Exception&) { - if (this->debug_ > 1) + if (debug_ > 1) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: Exception ignored while shutting down <%C>\n"), @@ -884,7 +885,7 @@ ImR_Locator_i::server_is_running bool jacorb_server = false; this->parse_id(id, server_id, name, jacorb_server); - if (this->debug_ > 0) + if (debug_ > 0) ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: Server %C is running at %C.\n"), name.c_str (), partial_ior)); @@ -892,7 +893,7 @@ ImR_Locator_i::server_is_running CORBA::String_var ior = orb_->object_to_string (server); - if (this->debug_ > 1) + if (debug_ > 1) ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: Server %C callback at %C.\n"), name.c_str (), ior.in ())); @@ -907,7 +908,7 @@ ImR_Locator_i::server_is_running UpdateableServerInfo info(this->repository_.get(), name); if (info.null ()) { - if (this->debug_ > 0) + if (debug_ > 0) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: Auto adding NORMAL server <%C>.\n"), @@ -932,7 +933,7 @@ ImR_Locator_i::server_is_running Server_Info_Ptr temp_info = this->repository_->get_server(name); if (temp_info.null ()) { - if (this->debug_ > 0) + if (debug_ > 0) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: Auto adding failed, giving up <%C>\n"), @@ -999,7 +1000,7 @@ ImR_Locator_i::server_is_shutting_down UpdateableServerInfo info (this->repository_.get(), server); if (info.null ()) { - if (this->debug_ > 1) + if (debug_ > 1) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR_Locator_i::server_is_shutting_down: ") @@ -1010,7 +1011,7 @@ ImR_Locator_i::server_is_shutting_down return; } - if (this->debug_ > 0) + if (debug_ > 0) ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: Server <%C> is shutting down.\n"), server)); @@ -1049,7 +1050,7 @@ ImR_Locator_i::find { imr_info = info->createImRServerInfo (); - if (this->debug_ > 1) + if (debug_ > 1) ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: Found server %C.\n"), server)); } else @@ -1057,7 +1058,7 @@ ImR_Locator_i::find ACE_NEW_THROW_EX (imr_info, ImplementationRepository::ServerInformation, CORBA::NO_MEMORY ()); imr_info->startup.activation= ImplementationRepository::NORMAL; - if (this->debug_ > 1) + if (debug_ > 1) ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: Cannot find server <%C>\n"), server)); @@ -1081,7 +1082,7 @@ ImR_Locator_i::list ImplementationRepository::ServerInformationList_var server_list; ImplementationRepository::ServerInformationIterator_var server_iterator; - if (this->debug_ > 1) + if (debug_ > 1) ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: List servers.\n"))); // Initialize the out variables, so if we return early, they will @@ -1113,7 +1114,7 @@ ImR_Locator_i::list server_list->length (n); - if (this->debug_ > 1) + if (debug_ > 1) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR_Locator_i::list: Filling ServerList with %d servers\n"), @@ -1140,7 +1141,7 @@ ImR_Locator_i::list else { imr_info->activeStatus = ImplementationRepository::ACTIVE_NO; - if (this->debug_ > 0) + if (debug_ > 0) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: Server %s is not active\n"), @@ -1153,7 +1154,7 @@ ImR_Locator_i::list if (this->repository_->servers ().current_size () > n) { - if (this->debug_ > 1) + if (debug_ > 1) ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR_Locator_i::list: Creating ServerInformation ") ACE_TEXT ("Iterator\n"))); @@ -1264,7 +1265,7 @@ ImR_Locator_i::auto_start_servers (void) } catch (CORBA::Exception& ex) { - if (this->debug_ > 1) + if (debug_ > 1) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: AUTO_START Could not activate <%C>\n"), @@ -1337,9 +1338,9 @@ ImR_Locator_i::is_alive (UpdateableServerInfo& info) } int -ImR_Locator_i::debug () const +ImR_Locator_i::debug () { - return this->debug_; + return debug_; } LiveCheck& diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h index ac4caab0821..ebc01e2c2b3 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h +++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h @@ -59,7 +59,7 @@ public: /// Shutdown the orb. void shutdown (bool wait_for_completion); - int debug() const; + static int debug (void); // Note : See the IDL for descriptions of the operations. // Activator->Locator @@ -177,6 +177,8 @@ private: private: + static int debug_; + // The class that handles the forwarding. ImR_DSI_Forwarder dsi_forwarder_; @@ -197,8 +199,6 @@ private: PortableServer::POA_var root_poa_; PortableServer::POA_var imr_poa_; - int debug_; - auto_ptr<Locator_Repository> repository_; bool read_only_; diff --git a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp index 9ba4d2bd3d7..087d91666d8 100644 --- a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp @@ -1,12 +1,14 @@ // -*- C++ -*- // $Id$ -#include "orbsvcs/Log_Macros.h" #include "LiveCheck.h" +#include "ImR_Locator_i.h" + +#include "orbsvcs/Log_Macros.h" + #include "tao/ORB_Core.h" #include "ace/Reactor.h" #include "ace/High_Res_Timer.h" -#include "ace/Log_Msg.h" LiveListener::LiveListener (const char *server) : server_(server), @@ -249,6 +251,7 @@ LiveEntry::status (void) const { if (!this->may_ping_) return LS_ALIVE; + if ( this->liveliness_ == LS_ALIVE && this->owner_->ping_interval() != ACE_Time_Value::zero ) { @@ -279,11 +282,12 @@ LiveEntry::status (LiveStatus l) LiveStatus ls = this->liveliness_; if (ls == LS_TRANSIENT && ! this->reping_available()) ls = LS_LAST_TRANSIENT; + for (Listen_Set::ITERATOR i(this->listeners_); !i.done(); i.advance ()) { - if ((*i)->status_changed (this->liveliness_)) + if ((*i)->status_changed (ls)) { remove.insert (*i); } @@ -301,6 +305,12 @@ LiveEntry::status (LiveStatus l) if (this->listeners_.size() > 0) { + if (ImR_Locator_i::debug () > 2) + { + ORBSVCS_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) LiveEntry::status change, server = %C status = %d\n"), + this->server_.c_str(), this->liveliness_)); + } this->owner_->schedule_ping (this); } else @@ -318,7 +328,7 @@ LiveEntry::next_check (void) const bool LiveEntry::validate_ping (bool &want_reping, ACE_Time_Value& next) { - if (this->owner_->debug () > 2) + if (ImR_Locator_i::debug () > 2) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) LiveEntry::validate_ping, server = %C\n"), @@ -328,7 +338,7 @@ LiveEntry::validate_ping (bool &want_reping, ACE_Time_Value& next) this->liveliness_ == LS_DEAD || this->listeners_.size () == 0) { - if (this->owner_->debug () > 2) + if (ImR_Locator_i::debug () > 2) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) LiveEntry::validate_ping, first test, ") @@ -347,7 +357,7 @@ LiveEntry::validate_ping (bool &want_reping, ACE_Time_Value& next) want_reping = true; next = this->next_check_; } - if (this->owner_->debug () > 2) + if (ImR_Locator_i::debug () > 2) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) LiveEntry::validate_ping, second test, ") @@ -358,7 +368,6 @@ LiveEntry::validate_ping (bool &want_reping, ACE_Time_Value& next) } return false; } - switch (this->liveliness_) { case LS_UNKNOWN: @@ -377,13 +386,13 @@ LiveEntry::validate_ping (bool &want_reping, ACE_Time_Value& next) } else { - if (this->owner_->debug () > 2) + if (ImR_Locator_i::debug () > 2) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) LiveEntry::validate_ping, ") ACE_TEXT ("transient, no more repings\n"))); } - return false; + return false; } } break; @@ -478,8 +487,7 @@ PingReceiver::ping_excep (Messaging::ExceptionHolder * excep_holder) LiveCheck::LiveCheck () :ping_interval_(), running_ (false), - token_ (100), - debug_ (0) + token_ (100) { } @@ -497,11 +505,9 @@ LiveCheck::~LiveCheck (void) void LiveCheck::init (CORBA::ORB_ptr orb, - const ACE_Time_Value &pi, - int debug_level) + const ACE_Time_Value &pi) { this->ping_interval_ = pi; - this->debug_ = debug_level; ACE_Reactor *r = orb->orb_core()->reactor(); this->reactor (r); CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA"); @@ -531,7 +537,7 @@ LiveCheck::handle_timeout (const ACE_Time_Value &, #else ACE_INT32 token = reinterpret_cast<ACE_INT32>(tok); #endif - if (this->debug_ > 2) + if (ImR_Locator_i::debug () > 2) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) LiveCheck::handle_timeout(%d), ") @@ -552,7 +558,7 @@ LiveCheck::handle_timeout (const ACE_Time_Value &, if (entry->validate_ping (want_reping, next)) { entry->do_ping (poa_.in ()); - if (this->debug_ > 2) + if (ImR_Locator_i::debug () > 2) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) LiveCheck::handle_timeout(%d)") @@ -562,7 +568,7 @@ LiveCheck::handle_timeout (const ACE_Time_Value &, } else { - if (this->debug_ > 2) + if (ImR_Locator_i::debug () > 2) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) LiveCheck::handle_timeout(%d)") @@ -592,18 +598,19 @@ LiveCheck::handle_timeout (const ACE_Time_Value &, } } + if (want_reping) { ACE_Time_Value now (ACE_High_Res_Timer::gettimeofday_hr()); ACE_Time_Value delay = next - now; - if (this->debug_ > 2) + ++this->token_; + if (ImR_Locator_i::debug () > 2) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) LiveCheck::handle_timeout(%d),") ACE_TEXT (" want reping, delay = %d,%d\n"), token, delay.sec(), delay.usec())); } - ++this->token_; this->reactor()->schedule_timer (this, reinterpret_cast<void *>(this->token_), delay); } @@ -723,6 +730,14 @@ LiveCheck::schedule_ping (LiveEntry *entry) ++this->token_; if (next <= now) { + if (ImR_Locator_i::debug () > 2) + { + ORBSVCS_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) LiveCheck::Schdedule_ping(%d),") + ACE_TEXT (" immediate\n"), + this->token_)); + } + this->reactor()->schedule_timer (this, reinterpret_cast<void *>(this->token_), ACE_Time_Value::zero); @@ -730,6 +745,13 @@ LiveCheck::schedule_ping (LiveEntry *entry) else { ACE_Time_Value delay = next - now; + if (ImR_Locator_i::debug () > 2) + { + ORBSVCS_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) LiveCheck::Schdedule_ping(%d),") + ACE_TEXT (" delay = %d,%d\n"), + this->token_, delay.sec(), delay.usec())); + } this->reactor()->schedule_timer (this, reinterpret_cast<void *>(this->token_), delay); @@ -757,9 +779,3 @@ LiveCheck::is_alive (const char *server) } return LS_DEAD; } - -int -LiveCheck::debug (void) const -{ - return this->debug_; -} diff --git a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h index 72f417d6c0f..e975cf1a293 100644 --- a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h +++ b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h @@ -207,8 +207,7 @@ class Locator_Export LiveCheck : public ACE_Event_Handler ~LiveCheck (void); void init (CORBA::ORB_ptr orb, - const ACE_Time_Value &interval, - int debug_level); + const ACE_Time_Value &interval); void shutdown (void); int handle_timeout (const ACE_Time_Value ¤t_time, @@ -235,8 +234,6 @@ class Locator_Export LiveCheck : public ACE_Event_Handler const ACE_Time_Value &ping_interval (void) const; - int debug (void) const; - private: typedef ACE_Hash_Map_Manager_Ex<ACE_CString, LiveEntry *, @@ -251,7 +248,6 @@ class Locator_Export LiveCheck : public ACE_Event_Handler ACE_Time_Value ping_interval_; bool running_; int token_; - int debug_; }; #endif /* IMR_LIVECHECK_H_ */ diff --git a/TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp b/TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp index 368c258f47b..c9accb70efb 100644 --- a/TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/Locator_Options.cpp @@ -315,7 +315,7 @@ Options::print_usage (void) const ACE_TEXT ("\n") ACE_TEXT ("ImplRepo_Service [-c cmd] [-d 0|1|2] [-e] [-m] [-o file]\n") ACE_TEXT (" [-r|-p file|-x file|--directory dir [--primary|--backup] ]\n") - ACE_TEXT (" [-s] [-t secs] [-v secs]\n") + ACE_TEXT (" [-s] [-t secs] [-v msecs]\n") ACE_TEXT (" -c command Runs nt service commands ('install' or 'remove')\n") ACE_TEXT (" -d level Sets the debug level (default 1)\n") ACE_TEXT (" -e Erase the persisted repository at startup\n") @@ -330,8 +330,8 @@ Options::print_usage (void) const ACE_TEXT (" --backup Replicate the ImplRepo as the backup ImR\n") ACE_TEXT (" -r Use the registry for storing/loading settings\n") ACE_TEXT (" -s Run as a service\n") - ACE_TEXT (" -t secs Server startup timeout.(Default=60s)\n") - ACE_TEXT (" -v msecs Server verification interval.(Default=10s)\n") + ACE_TEXT (" -t secs Server startup timeout.(Default = 60s)\n") + ACE_TEXT (" -v msecs Server verification interval.(Default = 10000ms)\n") ACE_TEXT (" -i Ping servers without activators too. (Default=false)\n") )); } diff --git a/TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/client.cpp b/TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/client.cpp index 75a025f8551..81d986b2d69 100644 --- a/TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/client.cpp +++ b/TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/client.cpp @@ -7,16 +7,21 @@ int client_num = 0; ACE_TCHAR *server_ior = 0; +bool expect_transient = false; int parse_args (int argc, ACE_TCHAR *argv[]) { - ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:n:")); + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("ek:n:")); int c; while ((c = get_opts ()) != -1) switch (c) { + case 'e': + expect_transient = true; + break; + case 'k': server_ior = get_opts.opt_arg (); break; @@ -28,9 +33,10 @@ parse_args (int argc, ACE_TCHAR *argv[]) case '?': default: ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " - "-k <server-ior> " - "\n", + ACE_TEXT ("usage: %s ") + ACE_TEXT ("-e ") + ACE_TEXT ("-k <server-ior> ") + ACE_TEXT ("\n"), argv [0]), -1); } @@ -41,32 +47,51 @@ parse_args (int argc, ACE_TCHAR *argv[]) int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { - try { - // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - - if (parse_args (argc, argv) != 0) - return 1; + try + { + CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); - ACE_DEBUG ((LM_DEBUG, - "(%P|%t|%T) Client %d sending request to %s\n", - client_num, server_ior)); - CORBA::Object_var obj = - orb->string_to_object (server_ior); - ACE_ASSERT (!CORBA::is_nil (obj.in ())); - Test_var test = Test::_narrow (obj.in()); - ACE_ASSERT (!CORBA::is_nil (test.in())); - CORBA::Short n = test->get_server_num (); - ACE_DEBUG ((LM_DEBUG, - "(%P|%t|%T) Client %d received reply from server %d\n", - client_num, n)); + if (parse_args (argc, argv) != 0) + return 1; - return 0; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t|%T) Client %d sending request to %C\n"), + client_num, server_ior)); + try + { + CORBA::Object_var obj = + orb->string_to_object (server_ior); + ACE_ASSERT (!CORBA::is_nil (obj.in ())); + Test_var test = Test::_narrow (obj.in()); + ACE_ASSERT (!CORBA::is_nil (test.in())); + CORBA::Short n = test->get_server_num (); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t|%T) Client %d received reply from server %d\n"), + client_num, n)); + } + catch (CORBA::TRANSIENT &) + { + if (expect_transient) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t|%T) Client %d got expected transient exception\n"), + client_num)); + } + else + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t|%T) Client %d caught unexpected transent\n"), + client_num)); + return -1; + } + } + return 0; - } - catch(const CORBA::Exception& ex) { - ex._tao_print_exception ("client:"); - } + } + catch(const CORBA::Exception& ex) + { + ex._tao_print_exception (ACE_TEXT ("client:")); + } return -1; } diff --git a/TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/run_test.pl b/TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/run_test.pl index e430ff4ffc4..5448e778d0f 100755 --- a/TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/run_test.pl +++ b/TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/run_test.pl @@ -11,12 +11,14 @@ use PerlACE::TestTarget; $status = 0; -my $debug_level = '0'; -my $imr_debug_level = $debug_level; +my $debug_level = 0; +my $imr_debug_level = 0; my $servers_count = 3; my $client_count = 2; my $server_reply_delay = 5; my $usage = 0; +my $use_imr_start = 0; +my $expect_transient = ""; my $debuglog = ""; my @srvlogfile = ( "", "", "" ); @@ -30,25 +32,29 @@ my $verification_interval_msecs = 1000; if ($#ARGV >= 0) { for (my $i = 0; $i <= $#ARGV; $i++) { if ($ARGV[$i] eq "-debug") { - $debug_level = '10'; - $imr_debug_level = '2'; + $debug_level = 10; + $imr_debug_level = 2; $loclogfile = "imr_loc.log"; - $i++; } elsif ($ARGV[$i] eq "-debuglog") { - $debug_level = '10'; - $imr_debug_level = '3'; + $debug_level = 10; + $imr_debug_level = 3; $debuglog = "-ORBVerboseLogging 1 -ORBLogFile "; @srvlogfile = ( "server1.log", "server2.log", "server3.log" ); @cltlogfile = ( "client1.log", "client2.log", "client3.log" ); $actlogfile = "imr_act.log"; $loclogfile = "imr_loc.log"; - $i++; } - elsif ($ARGV[$i] eq "-server_reply_delay") { + elsif ($ARGV[$i] eq "-delay") { $i++; $server_reply_delay = $ARGV[$i]; + if ($server_reply_delay > 16) { + $expect_transient = "-e"; + } } + elsif ($ARGV[$i] eq "-imr_start") { + $use_imr_start = 1; + } elsif ($ARGV[$i] eq "-v") { $i++; $verification_interval_msecs = $ARGV[$i]; @@ -79,7 +85,7 @@ my $port = $imr->RandomPort(); my $forward_on_exception_arg = "-ORBForwardOnceOnTransient 1"; my $debug_arg = "-ORBDebugLevel $debug_level " . $debuglog; -my $imr_debug_arg = "-ORBDebugLevel $imr_debug_level "; +my $imr_debug_arg = "-ORBDebugLevel $debug_level "; if ($loclogfile ne "") { $imr_debug_arg = $imr_debug_arg . "-ORBVerboseLogging 1 -ORBLogFile $loclogfile "; } @@ -123,7 +129,7 @@ for(my $i = 0; $i < $servers_count; $i++) { } for(my $i = 0; $i < $client_count; $i++) { - push (@CLI, $cli[$i]->CreateProcess ("client", "$debug_arg $cltlogfile[$i] -k file://$srviorfile[0] -n $i $forward_on_exception_arg")); + push (@CLI, $cli[$i]->CreateProcess ("client", "$debug_arg $cltlogfile[$i] -k file://$srviorfile[0] -n $i $forward_on_exception_arg $expect_transient")); if ($cltlogfile[$i] ne "") { $cli[$i]->DeleteFile ($cltlogfile[$i]); } @@ -151,8 +157,7 @@ sub run_imr_util { my $cmd = shift; print "Running ImR utility with $cmd\n"; $TI->Arguments ("-ORBInitRef ImplRepoService=file://$ti_imriorfile $cmd"); -# print ">>> " . $TI->CommandLine () . "\n"; - return $TI->SpawnWaitKill($ti->ProcessStartWaitInterval()); + return $TI->SpawnWaitKill($ti->ProcessStartWaitInterval() +$server_reply_delay); } # Register a server with ImR to get its IOR, then register again so it can later be invoked. @@ -163,6 +168,7 @@ sub register_server_with_activator { $srv_args = "$debug_arg $srvlogfile[$srv_id] -orbuseimr 1 $refstyle ". + "$expect_transient ". "$forward_on_exception_arg ". "-ORBInitRef ImplRepoService=file://$imr_imriorfile -n $srv_id"; @@ -171,7 +177,7 @@ sub register_server_with_activator { print ">>> " . $SRV[$srv_id]->CommandLine () . "\n"; $SRV[$srv_id]->Spawn (); if ($srv[$srv_id]->WaitForFileTimed ($srvstatusfile[$srv_id], - $srv[$srv_id]->ProcessStartWaitInterval() + $srv_reply_delay) == -1) { + $srv[$srv_id]->ProcessStartWaitInterval() + $server_reply_delay) == -1) { print STDERR "ERROR: cannot find file $srvstatusfile[$srv_id]\n"; $IMR->Kill (); $IMR->TimedWait (1); return 1; @@ -188,7 +194,7 @@ my $start_time = time(); cleanup_output (); -sub run_test +sub init_test { print "Running test with $servers_count servers and $obj_count objects.\n"; @@ -272,8 +278,10 @@ sub run_test print_msg ("Start S3"); - $SRV[2]->Arguments ("$debug_arg $srvlogfile[2] -orbuseimr 1 $refstyle -ORBInitRef ImplRepoService=file://$imr_imriorfile ". - "-d $server_reply_delay -n 2"); + $SRV[2]->Arguments ("$debug_arg $srvlogfile[2] -orbuseimr 1 $refstyle ". + "-d $server_reply_delay ". + "-ORBInitRef ImplRepoService=file://$imr_imriorfile -n 2"); + print ">>> " . $SRV[2]->CommandLine () . "\n"; $SRV[2]-> Spawn(); if ($srv[2]->WaitForFileTimed ($srvstatusfile[2], $srv[2]->ProcessStartWaitInterval()) == -1) { @@ -295,40 +303,10 @@ sub run_test print_msg ("Register S1 with ImR to start on demand"); register_server_with_activator(0, 1); +} - ##### C1 invokes S1 ##### - - print_msg ("C1 invokes S1"); - - print ">>> " . $CLI[0]->CommandLine () . "\n"; - $CLI_status = $CLI[0]->Spawn (); - if ($CLI_status != 0) { - print STDERR "ERROR: client 1 returned $CLI_status\n"; - return 1; - } - - ##### C2 invokes S1 in parallel with C1 after ping interval ##### - - print_msg ("C2 invokes S1 in parallel with C1 after ping interval"); - - # Let ping interval pass to ensure another ping will be done. - sleep ($verification_interval_msecs / 1000 + 1); - - print ">>> " . $CLI[1]->CommandLine () . "\n"; - $CLI_status = $CLI[1]->Spawn (); - if ($CLI_status != 0) { - print STDERR "ERROR: client 2 returned $CLI_status\n"; - return 1; - } - - ##### Wait for clients to terminate ##### - print_msg ("Wait for clients to terminate"); - for (my $i = 0; $i < $client_count; $i++) { - if ($CLI[$i]->WaitKill ($cli[$i]->ProcessStopWaitInterval () + $server_reply_delay + 60) == -1) { - print STDERR "ERROR: client $i not terminated correctly\n"; - $status = 1; - } - } +sub fini_test +{ print_msg ("Shutting down"); @@ -368,6 +346,58 @@ sub run_test return $status; } + +sub run_imr_start_test +{ + init_test (); + + $result = run_imr_util ("start $obj[1]"); + $result |= fini_test (); + + return $result; +} + +sub run_client_activate_test +{ + init_test (); + + ##### C1 invokes S1 ##### + + print_msg ("C1 invokes S1"); + + print ">>> " . $CLI[0]->CommandLine () . "\n"; + $CLI_status = $CLI[0]->Spawn (); + if ($CLI_status != 0) { + print STDERR "ERROR: client 1 returned $CLI_status\n"; + return 1; + } + + ##### C2 invokes S1 in parallel with C1 after ping interval ##### + + print_msg ("C2 invokes S1 in parallel with C1 after ping interval"); + + # Let ping interval pass to ensure another ping will be done. + sleep ($verification_interval_msecs / 1000 + 1); + + print ">>> " . $CLI[1]->CommandLine () . "\n"; + $CLI_status = $CLI[1]->Spawn (); + if ($CLI_status != 0) { + print STDERR "ERROR: client 2 returned $CLI_status\n"; + return 1; + } + + ##### Wait for clients to terminate ##### + print_msg ("Wait for clients to terminate"); + for (my $i = 0; $i < $client_count; $i++) { + if ($CLI[$i]->WaitKill ($cli[$i]->ProcessStopWaitInterval () + $server_reply_delay + 60) == -1) { + print STDERR "ERROR: client $i not terminated correctly\n"; + $status = 1; + } + } + + return fini_test (); +} + END { if (! $usage) { @@ -385,6 +415,12 @@ sub usage() { ############################################################################### ############################################################################### -my $ret = run_test(); +my $ret = 0; +if ($use_imr_start == 1) { + $ret = run_imr_start_test (); +} +else { + $ret = run_client_activate_test (); +} exit $ret; diff --git a/TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/server.cpp b/TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/server.cpp index 2a642b40cd6..5f6906facac 100644 --- a/TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/server.cpp +++ b/TAO/orbsvcs/tests/ImplRepo/servers_interact_on_startup/server.cpp @@ -56,12 +56,18 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) int server_num = 0; int reply_delay_secs = 0; - ACE_Get_Opt get_opts (argc, argv, ACE_TEXT ("s:d:n:?")); + bool expect_transient = false; + + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT ("es:d:n:?")); int c; while ((c = get_opts ()) != -1) switch (c) { + case 'e': + expect_transient = true; + break; + case 's': other_server_ior = get_opts.opt_arg (); break; @@ -76,10 +82,11 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) case '?': ACE_DEBUG ((LM_DEBUG, - "usage: %s " - "-s <ior-of-server-to-invoke> " - "-d <seconds to delay before initializing POA> " - "-n Number of the server\n", + ACE_TEXT ("usage: %C ") + ACE_TEXT ("-e ") + ACE_TEXT ("-s <ior-of-server-to-invoke> ") + ACE_TEXT ("-d <seconds to delay before initializing POA> ") + ACE_TEXT ("-n Number of the server\n"), argv[0])); return 1; break; @@ -95,7 +102,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) PortableServer::POA_var test_poa = createPOA(root_poa.in(), poa_name.c_str ()); ACE_DEBUG ((LM_DEBUG, - "(%P|%t|%T) Server %d created POA %s\n", + ACE_TEXT ("(%P|%t|%T) Server %d created POA %C\n"), server_num, poa_name.c_str ())); PortableServer::Servant_var<Test_i> test_servant = @@ -128,16 +135,35 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) if (other_server_ior != 0) { ACE_DEBUG ((LM_DEBUG, - "(%P|%t|%T) Server %d sending request to %s\n", + ACE_TEXT ("(%P|%t|%T) Server %d sending request to %s\n"), server_num, other_server_ior)); - CORBA::Object_var other_server = - orb->string_to_object (other_server_ior); - ACE_ASSERT (!CORBA::is_nil (other_server.in ())); - Test_var test = Test::_narrow (other_server.in()); - ACE_ASSERT (!CORBA::is_nil (test.in())); - CORBA::Short n = test->get_server_num (); - ACE_DEBUG ((LM_DEBUG, - "(%P|%t|%T) Server %d received reply from server %d\n", server_num, n)); + try + { + CORBA::Object_var other_server = + orb->string_to_object (other_server_ior); + ACE_ASSERT (!CORBA::is_nil (other_server.in ())); + Test_var test = Test::_narrow (other_server.in()); + ACE_ASSERT (!CORBA::is_nil (test.in())); + CORBA::Short n = test->get_server_num (); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t|%T) Server %d received reply from server %d\n"), + server_num, n)); + } + catch (CORBA::TRANSIENT &) + { + if (expect_transient) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t|%T) Server %d got expected transient exception\n"), + server_num)); + } + else + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ("ERROR: (%P|%t|%T) Server %d got unexpected Transent\n"), + server_num)); + } + } } @@ -155,7 +181,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) mgr->activate(); ACE_DEBUG ((LM_DEBUG, - "(%P|%t|%T) Server %d started serving %s\n", + ACE_TEXT ("(%P|%t|%T) Server %d started serving %C\n"), server_num, poa_name.c_str())); { @@ -170,12 +196,12 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) orb->destroy(); ACE_DEBUG ((LM_DEBUG, - "(%P|%t|%T) Server %d ending serving of %s\n", + ACE_TEXT ("(%P|%t|%T) Server %d ending serving of %C\n"), server_num, poa_name.c_str ())); } catch(const CORBA::Exception& ex) { - ex._tao_print_exception ("Server main()"); + ex._tao_print_exception (ACE_TEXT ("Server main()")); return 1; } |