diff options
-rw-r--r-- | TAO/bin/imr_tests.lst | 1 | ||||
-rw-r--r-- | TAO/bin/tao_other_tests.lst | 7 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/Activator_Options.cpp | 26 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/Activator_Options.h | 5 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp | 91 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.h | 4 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.cpp | 42 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.h | 6 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp | 14 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp | 44 | ||||
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/LiveCheck.h | 9 | ||||
-rwxr-xr-x | TAO/orbsvcs/tests/ImplRepo/RestartServer/run_test.pl | 7 | ||||
-rwxr-xr-x | TAO/orbsvcs/tests/ImplRepo/kill_server/run_test.pl | 98 | ||||
-rwxr-xr-x | TAO/orbsvcs/tests/ImplRepo/run_test.pl | 12 |
15 files changed, 290 insertions, 78 deletions
diff --git a/TAO/bin/imr_tests.lst b/TAO/bin/imr_tests.lst index db263502cf2..0a38fde0fc9 100644 --- a/TAO/bin/imr_tests.lst +++ b/TAO/bin/imr_tests.lst @@ -31,6 +31,7 @@ TAO/orbsvcs/tests/ImplRepo/kill_server/run_test.pl -rm2523: !MINIMUM !CORBA_E_CO TAO/orbsvcs/tests/ImplRepo/kill_server/run_test.pl -rm2523 -start_delay 3: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !LynxOS !ACE_FOR_TAO TAO/orbsvcs/tests/ImplRepo/kill_server/run_test.pl -rm2523 -force: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !LynxOS !ACE_FOR_TAO TAO/orbsvcs/tests/ImplRepo/kill_server/run_test.pl -rm2523 -force -signal 15: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !LynxOS !ACE_FOR_TAO +TAO/orbsvcs/tests/ImplRepo/kill_server/run_test.pl -rm2523ol: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !LynxOS !ACE_FOR_TAO TAO/orbsvcs/tests/ImplRepo/kill_slow_server/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !LynxOS !ACE_FOR_TAO TAO/orbsvcs/tests/ImplRepo/oneway/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !LynxOS !ACE_FOR_TAO TAO/orbsvcs/tests/ImplRepo/locked/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !LynxOS !ACE_FOR_TAO !OSX diff --git a/TAO/bin/tao_other_tests.lst b/TAO/bin/tao_other_tests.lst index 398ec11f066..ad484c7fd0c 100644 --- a/TAO/bin/tao_other_tests.lst +++ b/TAO/bin/tao_other_tests.lst @@ -116,9 +116,9 @@ TAO/orbsvcs/tests/ImplRepo/run_test.pl nestea_ir: !MINIMUM !CORBA_E_COMPACT !COR TAO/orbsvcs/tests/ImplRepo/run_test.pl airplane_ir: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO TAO/orbsvcs/tests/ImplRepo/run_test.pl persistent_ir: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO TAO/orbsvcs/tests/ImplRepo/run_test.pl nt_service_ir: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR Win32 !ACE_FOR_TAO -TAO/orbsvcs/tests/ImplRepo/run_test.pl shutdown: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !LynxOS !ACE_FOR_TAO +TAO/orbsvcs/tests/ImplRepo/run_test.pl shutdown: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !LynxOS !ACE_FOR_TAO !OSX TAO/orbsvcs/tests/ImplRepo/run_test.pl perclient: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO -TAO/orbsvcs/tests/ImplRepo/run_test.pl persistent_ir_hash: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO +TAO/orbsvcs/tests/ImplRepo/run_test.pl persistent_ir_hash: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !OSX TAO/orbsvcs/tests/ImplRepo/run_test.pl persistent_ir_shared: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !Win32 TAO/orbsvcs/tests/ImplRepo/run_test.pl failover -replica: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !Win32 TAO/orbsvcs/tests/ImplRepo/run_test.pl backup_restart -replica: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !Win32 @@ -136,9 +136,10 @@ TAO/orbsvcs/tests/ImplRepo/kill_server/run_test.pl -rm2523: !MINIMUM !CORBA_E_CO TAO/orbsvcs/tests/ImplRepo/kill_server/run_test.pl -rm2523 -start_delay 3: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !LynxOS !ACE_FOR_TAO TAO/orbsvcs/tests/ImplRepo/kill_server/run_test.pl -rm2523 -force: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !LynxOS !ACE_FOR_TAO TAO/orbsvcs/tests/ImplRepo/kill_server/run_test.pl -rm2523 -force -signal 15: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !LynxOS !ACE_FOR_TAO +TAO/orbsvcs/tests/ImplRepo/kill_server/run_test.pl -rm2523ol: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !LynxOS !ACE_FOR_TAO TAO/orbsvcs/tests/ImplRepo/kill_slow_server/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !LynxOS !ACE_FOR_TAO TAO/orbsvcs/tests/ImplRepo/oneway/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !LynxOS !ACE_FOR_TAO -TAO/orbsvcs/tests/ImplRepo/locked/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !LynxOS !ACE_FOR_TAO +TAO/orbsvcs/tests/ImplRepo/locked/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !LynxOS !ACE_FOR_TAO !OSX TAO/orbsvcs/tests/ImplRepo/manual_start/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !LynxOS !ACE_FOR_TAO !OpenVMS TAO/orbsvcs/tests/ImplRepo/scale/run_test.pl -servers 5 -objects 5: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !LynxOS TAO/orbsvcs/tests/ImplRepo/scale_clients/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO !WCHAR !ACE_FOR_TAO !LynxOS diff --git a/TAO/orbsvcs/ImplRepo_Service/Activator_Options.cpp b/TAO/orbsvcs/ImplRepo_Service/Activator_Options.cpp index 0b270324eb7..84935d591f6 100644 --- a/TAO/orbsvcs/ImplRepo_Service/Activator_Options.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/Activator_Options.cpp @@ -26,6 +26,13 @@ Activator_Options::Activator_Options () , service_command_(SC_NONE) , env_buf_len_ (Activator_Options::ENVIRONMENT_BUFFER) , max_env_vars_ (Activator_Options::ENVIRONMENT_MAX_VARS) +, detach_child_ ( +#if defined IMR_DETACH_CHILD_DEF + true +#else + false +#endif + ) { } @@ -171,6 +178,19 @@ Activator_Options::parse_args (int &argc, ACE_TCHAR *argv[]) } this->induce_delay_ = ACE_OS::atoi (shifter.get_current ()); } + else if (ACE_OS::strcasecmp (shifter.get_current (), + ACE_TEXT ("-detach")) == 0) + { + shifter.consume_arg (); + + if (!shifter.is_anything_left () || shifter.get_current ()[0] == '-') + { + ORBSVCS_ERROR ((LM_ERROR, "Error: -detach option needs a value\n")); + this->print_usage (); + return -1; + } + this->detach_child_ = ACE_OS::atoi (shifter.get_current ()) != 0; + } else { @@ -431,3 +451,9 @@ Activator_Options::max_env_vars (void) const { return this->max_env_vars_; } + +bool +Activator_Options::detach_child (void) const +{ + return this->detach_child_; +} diff --git a/TAO/orbsvcs/ImplRepo_Service/Activator_Options.h b/TAO/orbsvcs/ImplRepo_Service/Activator_Options.h index 9e1012a5613..7e9b375611a 100644 --- a/TAO/orbsvcs/ImplRepo_Service/Activator_Options.h +++ b/TAO/orbsvcs/ImplRepo_Service/Activator_Options.h @@ -84,6 +84,8 @@ public: int max_env_vars (void) const; + bool detach_child (void) const; + private: /// Parses and pulls out arguments for the ImR int parse_args (int &argc, ACE_TCHAR *argv[]); @@ -122,6 +124,9 @@ private: /// Maximum number of environment variables int max_env_vars_; + + /// Control signal handling related to child processes + bool detach_child_; }; #endif diff --git a/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp index 85375e9bab3..552b2043790 100644 --- a/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp @@ -21,14 +21,16 @@ AsyncAccessManager::AsyncAccessManager (UpdateableServerInfo &info, rh_list_ (), status_ (ImplementationRepository::AAM_INIT), refcount_ (1), - lock_ () + lock_ (), + prev_pid_ (0) { if (ImR_Locator_i::debug () > 4) { ORBSVCS_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) AsyncAccessManager(%@)::ctor server = %C\n"), - this, info->ping_id ())); + ACE_TEXT ("(%P|%t) AsyncAccessManager(%@)::ctor server = %C pid = %d, %d\n"), + this, info->ping_id (), info->pid, info_->pid)); } + this->prev_pid_ = info_->pid; } AsyncAccessManager::~AsyncAccessManager (void) @@ -61,6 +63,20 @@ AsyncAccessManager::has_server (const char *s) } void +AsyncAccessManager::report (void) +{ + ORBSVCS_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) AsyncAccessManager(%@) - Server: %C, pid: %d, lastpid: %d, status: %C, waiters: %d\n"), + this, info_->ping_id (), info_->pid, this->prev_pid_, status_name (this->status_), this->rh_list_ .size())); +} + +void +AsyncAccessManager::update_prev_pid (void) +{ + this->prev_pid_ = this->info_->pid; +} + +void AsyncAccessManager::add_interest (ImR_ResponseHandler *rh, bool manual) { { @@ -163,7 +179,7 @@ AsyncAccessManager::remote_state (ImplementationRepository::AAM_Status state) if (this->is_terminating ()) { AsyncAccessManager_ptr aam (this->_add_ref()); - this->locator_.make_terminating (aam); + this->locator_.make_terminating (aam,this->info_->ping_id(), this->info_->pid); this->notify_waiters (); } if (AsyncAccessManager::is_final (state)) @@ -374,12 +390,12 @@ AsyncAccessManager::shutdown_initiated (void) ACE_TEXT ("on server <%C> pid=%d current status = %s\n"), this, this->info_->ping_id(), this->info_->pid, status_name (this->status_))); } - + this->prev_pid_ = this->info_->pid; this->status (ImplementationRepository::AAM_ACTIVE_TERMINATE); if (this->info_->pid != 0) { AsyncAccessManager_ptr aam (this->_add_ref()); - this->locator_.make_terminating (aam); + this->locator_.make_terminating (aam,this->info_->ping_id(), this->info_->pid); } this->notify_waiters (); } @@ -391,10 +407,10 @@ AsyncAccessManager::server_is_shutting_down (void) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) AsyncAccessManager(%@)::server_is_shutting_down ") - ACE_TEXT ("on server <%C> pid=%d current status = %s\n"), - this, this->info_->ping_id(), this->info_->pid, status_name (this->status_))); + ACE_TEXT ("on server <%C> pid = %d prev_pid = %d, current status = %s\n"), + this, this->info_->ping_id(), this->info_->pid, this->prev_pid_, status_name (this->status_))); } - + this->prev_pid_ = this->info_->pid; this->status (ImplementationRepository::AAM_SERVER_DEAD); this->final_state (); } @@ -451,10 +467,10 @@ AsyncAccessManager::notify_child_death (int pid) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) AsyncAccessManager(%@), child death, pid = %d, ") - ACE_TEXT ("this pid = %d, waiter count = %d\n"), - this, pid, this->info_->pid, this->rh_list_.size() )); + ACE_TEXT ("this info_.pid = %d, prev_pid = %d, waiter count = %d\n"), + this, pid, this->info_->pid, this->prev_pid_, this->rh_list_.size() )); } - if (this->info_->pid == pid) + if (this->info_->pid == pid || this->prev_pid_) { if (this->status_ == ImplementationRepository::AAM_WAIT_FOR_DEATH && this->rh_list_.size() > 0) @@ -470,6 +486,21 @@ AsyncAccessManager::notify_child_death (int pid) } void +AsyncAccessManager::listener_disconnected (void) +{ + if (ImR_Locator_i::debug () > 4) + { + ORBSVCS_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) AsyncAccessManager(%@)::listener_disconnected,") + ACE_TEXT (" this status %s\n"), + this, status_name (this->status_))); + } + + this->status (ImplementationRepository::AAM_SERVER_DEAD); + +} + +void AsyncAccessManager::ping_replied (LiveStatus server) { if (ImR_Locator_i::debug () > 4) @@ -487,6 +518,18 @@ AsyncAccessManager::ping_replied (LiveStatus server) case LS_TIMEDOUT: this->status (ImplementationRepository::AAM_SERVER_READY); break; + case LS_CANCELLED: + { + if (this->status_ == ImplementationRepository::AAM_WAIT_FOR_PING) + { + AccessLiveListener *l = 0; + ACE_NEW (l, AccessLiveListener (this->info_->ping_id(), + this, + this->locator_.pinger())); + LiveListener_ptr llp(l); + } + return; + } case LS_DEAD: { if (this->status_ == ImplementationRepository::AAM_WAIT_FOR_PING) @@ -721,28 +764,40 @@ AccessLiveListener::AccessLiveListener (const char *server, AccessLiveListener::~AccessLiveListener (void) { + if (!this->aam_.is_nil()) + { + aam_->listener_disconnected(); + } } bool AccessLiveListener::start (void) { - bool rtn = this->per_client_ ? + bool started = this->per_client_ ? this->pinger_.add_per_client_listener (this, srv_ref_.in()) : this->pinger_.add_listener (this); - return rtn; + if (!started) + { + this->aam_ = 0; + } + return started; } bool AccessLiveListener::status_changed (LiveStatus status) { this->status_ = status; - if (status == LS_TRANSIENT) + switch (status_) { + case LS_TRANSIENT: { return false; } - else - { - this->aam_->ping_replied (status); + default: + if (!this->aam_.is_nil()) + { + this->aam_->ping_replied (status); + } + this->aam_ = 0; } return true; } diff --git a/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.h b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.h index 299cf0f10c6..02688459cd0 100644 --- a/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.h +++ b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.h @@ -73,11 +73,14 @@ class Locator_Export AsyncAccessManager void shutdown_initiated (void); bool notify_child_death (int pid); void ping_replied (LiveStatus server); + void listener_disconnected (void); AsyncAccessManager *_add_ref (void); void _remove_ref (void); static const ACE_TCHAR *status_name (ImplementationRepository::AAM_Status s); static bool is_final (ImplementationRepository::AAM_Status s); + void report (void); + void update_prev_pid (void); private: void final_state (bool active = true); @@ -98,6 +101,7 @@ class Locator_Export AsyncAccessManager int refcount_; TAO_SYNCH_MUTEX lock_; + int prev_pid_; }; typedef TAO_Intrusive_Ref_Count_Handle<AsyncAccessManager> AsyncAccessManager_ptr; diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.cpp b/TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.cpp index eea6c5cc5e1..13c16d00345 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.cpp @@ -120,6 +120,8 @@ ImR_Activator_i::init_with_orb (CORBA::ORB_ptr orb, const Activator_Options& opt induce_delay_ = opts.induce_delay (); env_buf_len_ = opts.env_buf_len (); max_env_vars_ = opts.max_env_vars (); + detach_child_ = opts.detach_child (); + if (opts.name ().length () > 0) { name_ = opts.name(); @@ -332,9 +334,10 @@ ImR_Activator_i::kill_server (const char* name, CORBA::Long lastpid, CORBA::Shor { if (debug_ > 1) ORBSVCS_DEBUG((LM_DEBUG, - "ImR Activator: Killing server <%C>...\n", - name)); - pid_t pid = static_cast<pid_t>(lastpid); + "ImR Activator: Killing server <%C>, lastpid = %d\n", + name, lastpid)); + pid_t lpid = static_cast<pid_t>(lastpid); + pid_t pid = 0; bool found = false; int result = -1; for (ProcessMap::iterator iter = process_map_.begin(); @@ -343,7 +346,7 @@ ImR_Activator_i::kill_server (const char* name, CORBA::Long lastpid, CORBA::Shor if (iter->item () == name) { pid = iter->key (); - found = true; + found = pid == lpid; } } #if defined (ACE_WIN32) @@ -356,11 +359,17 @@ ImR_Activator_i::kill_server (const char* name, CORBA::Long lastpid, CORBA::Shor (signum != 9) ? ACE_OS::kill (pid, signum) : #endif ACE::terminate_process (pid); + + if (this->running_server_list_.remove (name) == 0) + { + this->dying_server_list_.insert (name); + } + if (debug_ > 1) ORBSVCS_DEBUG((LM_DEBUG, "ImR Activator: Killing server <%C> " - "signal %d to pid %d, result = %d\n", - name, signum, static_cast<int> (pid), result)); + "signal %d to pid %d, found %d, this->notify_imr_ %d, result = %d\n", + name, signum, static_cast<int> (pid), found, this->notify_imr_, result)); if (!found && result == 0 && this->notify_imr_) { this->process_map_.bind (pid, name); @@ -390,7 +399,7 @@ ImR_Activator_i::still_alive (CORBA::Long pid) bool ImR_Activator_i::still_running_i (const char *name, pid_t &pid) { - bool is_running = this->server_list_.find (name) == 0; + bool is_running = this->running_server_list_.find (name) == 0; if (is_running) { @@ -472,7 +481,13 @@ ImR_Activator_i::start_server(const char* name, // process's environment. proc_opts.enable_unicode_environment (); - proc_opts.setgroup (0); + // Guard against possible signal reflection which can happen on very heavily + // loaded systems. Detaching the child process avoids that possibility but at + // the cost of required explicit child termination prior to activator shutdown + if (this->detach_child_) + { + proc_opts.setgroup (0); + } proc_opts.setenv (ACE_TEXT ("TAO_USE_IMR"), ACE_TEXT ("1")); if (!CORBA::is_nil (this->locator_.in ())) @@ -509,7 +524,7 @@ ImR_Activator_i::start_server(const char* name, this->process_map_.rebind (pid, name); if (unique) { - this->server_list_.insert (name); + this->running_server_list_.insert (name); } if (!CORBA::is_nil (this->locator_.in ())) { @@ -548,7 +563,10 @@ ImR_Activator_i::handle_exit_i (pid_t pid) this->process_map_.unbind (pid); } - this->server_list_.remove (name); + if (this->running_server_list_.remove (name) == -1) + { + this->dying_server_list_.remove (name); + } if (this->notify_imr_ && !CORBA::is_nil (this->locator_.in ())) { @@ -584,8 +602,8 @@ ImR_Activator_i::handle_exit (ACE_Process * process) { ORBSVCS_DEBUG ((LM_DEBUG, - ACE_TEXT ("Process %d exited with exit code %d\n"), - process->getpid (), process->return_value ())); + ACE_TEXT ("Process %d exited with exit code %d, delay = %d\n"), + process->getpid (), process->return_value (), this->induce_delay_)); } if (this->induce_delay_ > 0) diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.h b/TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.h index 6c8286d8547..7d03030df46 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.h +++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.h @@ -142,13 +142,17 @@ private: ProcessMap process_map_; - UniqueServerList server_list_; + UniqueServerList running_server_list_; + UniqueServerList dying_server_list_; /// The default environment buffer length int env_buf_len_; /// Maximum number of environment variables int max_env_vars_; + + bool detach_child_; + }; #endif /* IMR_ACTIVATOR_I_H */ diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp index e38859affe6..d18152aa4f9 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp @@ -562,6 +562,16 @@ ImR_Locator_i::spawn_pid if (! info.null ()) { info.edit ()->active_info ()->pid = pid; + AsyncAccessManager_ptr aam (this->find_aam (name)); + if (aam.is_nil ()) + { + aam = this->find_aam (name, false); + } + else + { + aam->update_prev_pid (); + } + info.edit ()->active_info ()->death_notify = true; } else @@ -1662,10 +1672,12 @@ ImR_Locator_i::remove_aam (const char *name) } void -ImR_Locator_i::make_terminating (AsyncAccessManager_ptr &aam) +ImR_Locator_i::make_terminating (AsyncAccessManager_ptr &aam, + const char *name, pid_t pid) { this->aam_active_.remove (aam); this->aam_terminating_.insert_tail (aam); + this->pinger_.remove_server (name, pid); } AsyncAccessManager * diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h index 2a977305994..3577dc69a51 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h +++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h @@ -174,7 +174,7 @@ public: void remove_aam (const char *name); AsyncAccessManager *find_aam (const char *name, bool active = true); AsyncAccessManager *create_aam (UpdateableServerInfo &info, bool running = false); - void make_terminating (AsyncAccessManager_ptr &aam); + void make_terminating (AsyncAccessManager_ptr &aam, const char *name, int pid); /// Receiving an update from remote peer void remote_access_update (const char *name, ImplementationRepository::AAM_Status state); diff --git a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp index edadc0e8bac..c0bcb9ddb36 100644 --- a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp @@ -86,6 +86,8 @@ LiveEntry::status_name (LiveStatus s) return ACE_TEXT ("LAST_TRANSIENT"); case LS_TIMEDOUT: return ACE_TEXT ("TIMEDOUT"); + case LS_CANCELLED: + return ACE_TEXT ("CANCELLED"); } return ACE_TEXT ("<undefined status>"); } @@ -595,11 +597,11 @@ PingReceiver::ping_excep (Messaging::ExceptionHolder * excep_holder) LC_TimeoutGuard::LC_TimeoutGuard (LiveCheck *owner, LC_token_type token) :owner_ (owner), token_ (token), - blocked_ (owner->handle_timeout_busy_ == 0) + blocked_ (owner->in_handle_timeout ()) { if (!blocked_) { - --owner_->handle_timeout_busy_; + owner_->enter_handle_timeout (); } } @@ -610,7 +612,7 @@ LC_TimeoutGuard::~LC_TimeoutGuard (void) return; } - ++owner_->handle_timeout_busy_; + owner_->exit_handle_timeout (); owner_->remove_deferred_servers (); @@ -683,6 +685,24 @@ LiveCheck::~LiveCheck (void) } void +LiveCheck::enter_handle_timeout (void) +{ + --this->handle_timeout_busy_; +} + +void +LiveCheck::exit_handle_timeout (void) +{ + ++this->handle_timeout_busy_; +} + +bool +LiveCheck::in_handle_timeout (void) +{ + return this->handle_timeout_busy_ == 0; +} + +void LiveCheck::init (CORBA::ORB_ptr orb, const ACE_Time_Value &pi) { @@ -804,6 +824,10 @@ LiveCheck::add_server (const char *server, { LiveEntry *old = 0; result = entry_map_.rebind (s, entry, old); + if (old) + { + old->status (LS_CANCELLED); + } delete old; } } @@ -826,10 +850,12 @@ LiveCheck::remove_server (const char *server, int pid) LiveEntry *entry = 0; if (entry_map_.find (s, entry) != -1 && entry->has_pid (pid)) { - if (this->handle_timeout_busy_ > 0) + if (!this->in_handle_timeout ()) { if (entry_map_.unbind (s, entry) == 0) - delete entry; + { + delete entry; + } } else { @@ -848,9 +874,9 @@ LiveCheck::remove_server (const char *server, int pid) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) LiveCheck::remove_server %s ") - ACE_TEXT ("pid %d does not match entry\n"), + ACE_TEXT ("pid %d does not match entry\n"), server, pid)); - } + } } } @@ -902,7 +928,7 @@ LiveCheck::add_per_client_listener (LiveListener *l, { entry->add_listener (l); - if (this->handle_timeout_busy_ > 0) + if (!this->in_handle_timeout ()) { ++this->token_; this->reactor()->schedule_timer (this, @@ -987,7 +1013,7 @@ LiveCheck::schedule_ping (LiveEntry *entry) ACE_Time_Value now (ACE_High_Res_Timer::gettimeofday_hr()); ACE_Time_Value next = entry->next_check (); - if (this->handle_timeout_busy_ > 0) + if (!this->in_handle_timeout () ) { ACE_Time_Value delay = ACE_Time_Value::zero; if (next > now) diff --git a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h index d92cebc566f..7fe157c61f0 100644 --- a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h +++ b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h @@ -48,7 +48,8 @@ enum LiveStatus { LS_ALIVE, LS_TRANSIENT, LS_LAST_TRANSIENT, - LS_TIMEDOUT + LS_TIMEDOUT, + LS_CANCELLED }; //--------------------------------------------------------------------------- @@ -257,7 +258,6 @@ class Locator_Export LiveCheck : public ACE_Event_Handler ImplementationRepository::ServerObject_ptr ref); void set_pid (const char *server, int pid); void remove_server (const char *server, int pid = 0); - void remove_deferred_servers (void); bool remove_per_client_entry (LiveEntry *entry); bool add_listener (LiveListener *listener); bool add_poll_listener (LiveListener *listener); @@ -269,6 +269,11 @@ class Locator_Export LiveCheck : public ACE_Event_Handler const ACE_Time_Value &ping_interval (void) const; private: + void enter_handle_timeout (void); + void exit_handle_timeout (void); + bool in_handle_timeout (void); + void remove_deferred_servers (void); + typedef ACE_Hash_Map_Manager_Ex<ACE_CString, LiveEntry *, ACE_Hash<ACE_CString>, diff --git a/TAO/orbsvcs/tests/ImplRepo/RestartServer/run_test.pl b/TAO/orbsvcs/tests/ImplRepo/RestartServer/run_test.pl index 89b0666acb1..6a4e788632e 100755 --- a/TAO/orbsvcs/tests/ImplRepo/RestartServer/run_test.pl +++ b/TAO/orbsvcs/tests/ImplRepo/RestartServer/run_test.pl @@ -152,6 +152,10 @@ sub kill_imr { my $msg = shift; print STDERR "ERROR: $msg\n" if (length ($msg) > 0); + if ($mode eq "-a MANUAL ") { + $TI->Arguments ("$tiinitref kill MessengerService"); + $TI->SpawnWaitKill ($ti->ProcessStartWaitInterval() + $extra_timeout); + } $ACT->Kill (); $ACT->TimedWait (1); $IR->Kill (); $IR->TimedWait (1); return 1; @@ -282,9 +286,6 @@ $C1_status = $C1->SpawnWaitKill ($c1->ProcessStartWaitInterval() + $extra_timeou if ($C1_status == 2) { print STDERR "Warning: This test does not currently run under this operating system.\n"; - if ($mode eq "-a MANUAL ") { - ti_cmd ("shutdown"); - } kill_imr (); exit 0; } diff --git a/TAO/orbsvcs/tests/ImplRepo/kill_server/run_test.pl b/TAO/orbsvcs/tests/ImplRepo/kill_server/run_test.pl index a148293776e..4725743604e 100755 --- a/TAO/orbsvcs/tests/ImplRepo/kill_server/run_test.pl +++ b/TAO/orbsvcs/tests/ImplRepo/kill_server/run_test.pl @@ -25,18 +25,18 @@ my $force = 0; if ($#ARGV >= 0) { my $sn_set = 0; for (my $i = 0; $i <= $#ARGV; $i++) { - if ($ARGV[$i] eq '-debug') { - $orb_debug = 4; + if ($ARGV[$i] eq '-debug') { + $orb_debug = 4; $imr_debug = 6; - } - elsif ($ARGV[$i] eq "-servers") { - $i++; - $servers_count = $ARGV[$i]; - } - elsif ($ARGV[$i] eq "-servers_to_kill") { - $i++; - $servers_kill_count = $ARGV[$i]; - } + } + elsif ($ARGV[$i] eq "-servers") { + $i++; + $servers_count = $ARGV[$i]; + } + elsif ($ARGV[$i] eq "-servers_to_kill") { + $i++; + $servers_kill_count = $ARGV[$i]; + } elsif ($ARGV[$i] eq "-signal") { $i++; $signalnum = $ARGV[$i]; @@ -47,6 +47,11 @@ if ($#ARGV >= 0) { $signalnum = 15; $servers_count = 3; } + elsif ($ARGV[$1] eq "-rm2523ol") { + $rm2523 = 2; + $signalnum = 15; + $servers_count = 3; + } elsif ($ARGV[$i] eq "-force") { $rm_opts = "-f"; $force = 1; @@ -55,10 +60,10 @@ if ($#ARGV >= 0) { $i++; $start_delay = $ARGV[$i]; } - else { - usage(); - exit 1; - } + else { + usage(); + exit 1; + } } $rm_opts .= " -s $signalnum" if ($force == 1 && $sn_set == 1); } @@ -76,7 +81,7 @@ for(my $i = 0; $i < $servers_count; $i++) { } my $refstyle = " -ORBobjrefstyle URL"; -my $obj_count = ($rm2523 == 1) ? 1 : 2; +my $obj_count = ($rm2523 > 0) ? 1 : 2; my $port = 9876; my $objprefix = "TestObject"; @@ -84,15 +89,19 @@ my $client_wait_time = 10; $imriorfile = "imr_locator.ior"; $actiorfile = "imr_activator.ior"; +$imrlogfile = "imr.log"; +$actlogfile = "act.log"; my $imr_imriorfile = $imr->LocalFile ($imriorfile); my $act_imriorfile = $act->LocalFile ($imriorfile); my $ti_imriorfile = $ti->LocalFile ($imriorfile); my $srv_imriorfile = $srv[0]->LocalFile ($imriorfile); my $act_actiorfile = $act->LocalFile ($actiorfile); +my $imr_imrlogfile = $imr->LocalFile ($imrlogfile); +my $act_actlogfile = $act->LocalFile ($actlogfile); -$IMR = $imr->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/tao_imr_locator"); -$ACT = $act->CreateProcess ("$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/tao_imr_activator"); +$IMR = $imr->CreateProcess ("../../../ImplRepo_Service/tao_imr_locator"); +$ACT = $act->CreateProcess ("../../../ImplRepo_Service/tao_imr_activator"); $TI = $ti->CreateProcess ("$ENV{ACE_ROOT}/bin/tao_imr"); $CLI = $cli->CreateProcess ("client"); @@ -109,6 +118,8 @@ $act->DeleteFile ($imriorfile); $ti->DeleteFile ($imriorfile); $srv[0]->DeleteFile ($imriorfile); $act->DeleteFile ($actiorfile); +$imr->DeleteFile ($imrlogfile); +$act->DeleteFile ($actlogfile); my $stdout_file = "test.out"; my $stderr_file = "test.err"; @@ -127,7 +138,7 @@ END $ti->DeleteFile ($stdout_file); $ti->DeleteFile ($stderr_file); - # Remove any stray server status files caused by aborting services + # Remove any stray server status files caused by aborting services unlink <*.status>; } @@ -148,7 +159,7 @@ sub restore_output() sub servers_setup () { my $imr_args = "-v 1000 -o $imr_imriorfile -orbendpoint iiop://localhost:$port"; - $imr_args .= " -d $imr_debug -orbdebuglevel $orb_debug -orbverboselogging 1 -orblogfile imr.log" if ($imr_debug > 0); + $imr_args .= " -d $imr_debug -orbdebuglevel $orb_debug -orbverboselogging 1 -orblogfile $imr_imrlogfile" if ($imr_debug > 0); print "$imr_args \n"; $IMR->Arguments ($imr_args); @@ -185,8 +196,8 @@ sub servers_setup () } my $act_args = "-l -o $act_actiorfile -ORBInitRef ImplRepoService=file://$act_imriorfile -orbendpoint iiop://localhost:"; - $act_args .= " -d $imr_debug -orbdebuglevel $orb_debug -orbverboselogging 1 -orblogfile act.log" if ($imr_debug > 0); - $act_args .= " -delay $act_delay" if ($rm2523 == 1 && $OSNAME ne "MSWin32"); + $act_args .= " -d $imr_debug -orbdebuglevel $orb_debug -orbverboselogging 1 -orblogfile $actlogfile" if ($imr_debug > 0); + $act_args .= " -delay $act_delay" if ($rm2523 > 0 && $OSNAME ne "MSWin32"); $ACT->Arguments ($act_args); $ACT_status = $ACT->Spawn (); @@ -219,7 +230,7 @@ sub servers_setup () $IMR->Kill (); $IMR->TimedWait (1); return 1; } - if ($rm2523 == 1) { + if ($rm2523 > 0) { $TI->Arguments ("-ORBInitRef ImplRepoService=file://$ti_imriorfile ". "link $objprefix" . '_' . $i . "_a " . " -p $objprefix" . '_' . $i . "_b "); @@ -407,6 +418,43 @@ sub count_active_servers($) return $active_servers; } + +sub rm2523_update_test +{ + print "Running slow activator kill test with $servers_count servers \n"; + + my $result = 0; + my $start_time = time(); + servers_setup(); + + print "make server requests\n"; + make_server_requests(); + list_servers("-a"); + + print "kill then start the server twice\n"; + kill_the_one(); + trigger_the_one (); + start_the_one (); + print "pausing 2 seconds\n"; + sleep (2); + wait_for_client (); + shutdown_servers (0, $servers_count, 9); + + my $ACT_status = $ACT->TerminateWaitKill ($act->ProcessStopWaitInterval()); + if ($ACT_status != 0) { + print STDERR "ERROR: IMR Activator returned $ACT_status\n"; + $status = 1; + } + + my $IMR_status = $IMR->TerminateWaitKill ($imr->ProcessStopWaitInterval()); + if ($IMR_status != 0) { + print STDERR "ERROR: IMR returned $IMR_status\n"; + $status = 1; + } + +} + + sub rm2523_test { print "Running slow activator kill test with $servers_count servers \n"; @@ -545,5 +593,7 @@ sub usage() { ############################################################################### ############################################################################### -my $ret = ($rm2523 == 1) ? rm2523_test() : servers_kill_test(); +my $ret = ($rm2523 > 0) ? + ($rm2523 == 1) ? rm2523_test () : rm2523_update_test() + : servers_kill_test(); exit $ret; diff --git a/TAO/orbsvcs/tests/ImplRepo/run_test.pl b/TAO/orbsvcs/tests/ImplRepo/run_test.pl index 409a097c19b..1ae7c769922 100755 --- a/TAO/orbsvcs/tests/ImplRepo/run_test.pl +++ b/TAO/orbsvcs/tests/ImplRepo/run_test.pl @@ -403,7 +403,7 @@ sub shutdown_servers_using_tao_imr "shutdown $a_srv_name[$index]"); my $TI_status = $repo_ref->[$index]->{TI}->SpawnWaitKill ( $repo_ref->[$index]->{ti}->ProcessStartWaitInterval()); - if ($TI_status != 0) { + if ($TI_status != 0 ) { print STDERR "ERROR: tao_imr ($index) returned $TI_status\n"; kill_act(); kill_imr(); @@ -429,7 +429,11 @@ sub shutdown_servers_using_ior "shutdown $a_srv_name[$index]"); my $TI_status = $TI->SpawnWaitKill ( $target->ProcessStartWaitInterval()); - if ($TI_status != 0) { + if ($TI_status == 5) { + print STDERR "INFO: tao_imr ($index) returned NOT_FOUND\n"; + $TI_status = 0 + } + elsif ($TI_status != 0) { print STDERR "ERROR: tao_imr ($index) returned $TI_status\n"; kill_act(); kill_imr(); @@ -2008,8 +2012,8 @@ sub persistent_ir_test sub failover_test { if (!$replica) { - # The failover test needs the -replica flag - return 0; + print STDERR "The failover test needs the -replica flag\n"; + return 0; } my $status = 0; |