summaryrefslogtreecommitdiff
path: root/TAO
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2018-12-05 12:02:38 +0100
committerJohnny Willemsen <jwillemsen@remedy.nl>2018-12-05 12:02:38 +0100
commitae3f22860a533dbe736a87f956a8d28907f43f50 (patch)
treeaeac98b60ef74d4304504343898d2eac9ed74990 /TAO
parentaae3b9ad2545c2941122c58c1be52d7c19496ae3 (diff)
downloadATCD-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')
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp35
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/LiveCheck.h5
2 files changed, 25 insertions, 15 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 ();
}
diff --git a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h
index 26a5b68e529..25c70fe5f45 100644
--- a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h
+++ b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h
@@ -283,7 +283,8 @@ class Locator_Export LiveCheck : public ACE_Event_Handler
ACE_Equal_To<ACE_CString>,
ACE_Null_Mutex> LiveEntryMap;
typedef ACE_Unbounded_Set<LiveEntry *> PerClientStack;
- typedef ACE_Unbounded_Set<ACE_CString> NameStack;
+ typedef std::pair<ACE_CString, int> NamePidPair;
+ typedef ACE_Unbounded_Set<NamePidPair> NamePidStack;
LiveEntryMap entry_map_;
PerClientStack per_client_;
@@ -298,7 +299,7 @@ class Locator_Export LiveCheck : public ACE_Event_Handler
/// these will be removed at the end of the handle_timeout. Be aware that
/// between the moment the server has been added to the list and the handling
/// of this list the server can already be restarted again.
- NameStack removed_entries_;
+ NamePidStack removed_entries_;
};
#endif /* IMR_LIVECHECK_H_ */