diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2018-12-05 12:02:38 +0100 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2018-12-05 12:02:38 +0100 |
commit | ae3f22860a533dbe736a87f956a8d28907f43f50 (patch) | |
tree | aeac98b60ef74d4304504343898d2eac9ed74990 /TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp | |
parent | aae3b9ad2545c2941122c58c1be52d7c19496ae3 (diff) | |
download | ATCD-ae3f22860a533dbe736a87f956a8d28907f43f50.tar.gz |
When we get a remove server during handle timeout we need to store name and pid and check that before really removing the server, the server can already be restarted and have a new pid
* TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp:
* TAO/orbsvcs/ImplRepo_Service/LiveCheck.h:
Diffstat (limited to 'TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp')
-rw-r--r-- | TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp index 0e5c3f5e9df..477979aa94e 100644 --- a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp @@ -871,10 +871,16 @@ LiveCheck::set_pid (const char *server, int pid) void LiveCheck::remove_server (const char *server, int pid) { + if (ImR_Locator_i::debug () > 0) + { + ORBSVCS_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) LiveCheck::remove_server <%C> pid <%d>\n"), + server, pid)); + } ACE_CString s(server); LiveEntry *entry = 0; int const result = entry_map_.find (s, entry); - if (result != -1 && entry->has_pid (pid)) + if (result != -1 && entry != 0 && entry->has_pid (pid)) { if (!this->in_handle_timeout ()) { @@ -888,10 +894,10 @@ LiveCheck::remove_server (const char *server, int pid) if (ImR_Locator_i::debug () > 0) { ORBSVCS_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) LiveCheck::remove_server <%C> ") - ACE_TEXT ("called during handle_timeout\n"), server)); + ACE_TEXT ("(%P|%t) LiveCheck::remove_server <%C> pid <%d> ") + ACE_TEXT ("called during handle_timeout\n"), server, pid)); } - this->removed_entries_.insert_tail (s); + this->removed_entries_.insert_tail (std::make_pair (server, pid)); } } else @@ -911,23 +917,26 @@ LiveCheck::remove_deferred_servers (void) { if (!this->removed_entries_.is_empty ()) { - NameStack::iterator re_end = this->removed_entries_.end(); - for (NameStack::iterator re = this->removed_entries_.begin(); + NamePidStack::iterator re_end = this->removed_entries_.end(); + for (NamePidStack::iterator re = this->removed_entries_.begin(); re != re_end; ++re) { + NamePidPair const & name_pid_pair = (*re); if (ImR_Locator_i::debug () > 0) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) LiveCheck::remove_deferred_entries ") - ACE_TEXT ("removing <%C>\n"), (*re).c_str())); - } - LiveEntry *entry = 0; - int const result = entry_map_.unbind (*re, entry); - if (result == 0) - { - delete entry; + ACE_TEXT ("removing <%C> pid <%d>\n"), + name_pid_pair.first.c_str(), name_pid_pair.second)); } + // Now try to remove the server, remove_server + // will make sure that we only remove the server when the + // name and pid match. These could potentially not + // match when the server has already been restarted between the + // moment it got in the removed_entries_ stack and this point + // where we remove it from the internal administration + this->remove_server (name_pid_pair.first.c_str(), name_pid_pair.second); } this->removed_entries_.reset (); } |