summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2019-07-25 13:19:49 +0200
committerBenoit Foucher <benoit@zeroc.com>2019-07-25 17:38:50 +0200
commit78ed3f7c8781a70f43c31a4115dcec67b1ebb08d (patch)
tree061942c829d88ab342adaab29bc967a13cf08184
parentSchannel build fixes (diff)
downloadice-78ed3f7c8781a70f43c31a4115dcec67b1ebb08d.tar.bz2
ice-78ed3f7c8781a70f43c31a4115dcec67b1ebb08d.tar.xz
ice-78ed3f7c8781a70f43c31a4115dcec67b1ebb08d.zip
Fixed IceGrid node to not terminate session with master on interrupt, fixes #464
-rw-r--r--CHANGELOG-3.6.md3
-rw-r--r--cpp/src/IceGrid/IceGridNode.cpp12
-rw-r--r--cpp/src/IceGrid/NodeSessionManager.cpp6
-rw-r--r--cpp/src/IceGrid/NodeSessionManager.h1
-rw-r--r--cpp/src/IceGrid/SessionManager.h7
5 files changed, 28 insertions, 1 deletions
diff --git a/CHANGELOG-3.6.md b/CHANGELOG-3.6.md
index 73740e25939..f69c8bca1b7 100644
--- a/CHANGELOG-3.6.md
+++ b/CHANGELOG-3.6.md
@@ -60,6 +60,9 @@ These are the changes since Ice 3.6.4 included in this pre-release.
## C++ Changes
+- Fixed IceGrid issue where gracefully interrupted IceGrid node wouldn't notify
+ observers of the deactivation of its servers.
+
- Fixed bug where the `IceGrid.Registry.CryptPasswords` or
`IceGrid.Registry.AdminCryptPasswords` properties were ignored if the IceGrid
registry was collocated with the IceGrid node executable using the
diff --git a/cpp/src/IceGrid/IceGridNode.cpp b/cpp/src/IceGrid/IceGridNode.cpp
index c869719ae72..8585ca66766 100644
--- a/cpp/src/IceGrid/IceGridNode.cpp
+++ b/cpp/src/IceGrid/IceGridNode.cpp
@@ -170,7 +170,17 @@ NodeService::shutdown()
{
assert(_activator && _sessions.get());
_activator->shutdown();
- _sessions->terminate(); // Unblock the main thread if it's blocked on waitForCreate()
+
+ //
+ // If the session manager waits for session creation with the master, we interrupt
+ // the session creation. This is necessary to unblock the main thread which might
+ // be waiting for waitForCreate to return.
+ //
+ if(_sessions->isWaitingForCreate())
+ {
+ _sessions->terminate();
+ }
+
return true;
}
diff --git a/cpp/src/IceGrid/NodeSessionManager.cpp b/cpp/src/IceGrid/NodeSessionManager.cpp
index 1a38bfb1f30..81b220b19b6 100644
--- a/cpp/src/IceGrid/NodeSessionManager.cpp
+++ b/cpp/src/IceGrid/NodeSessionManager.cpp
@@ -307,6 +307,12 @@ NodeSessionManager::activate()
}
bool
+NodeSessionManager::isWaitingForCreate()
+{
+ return _thread->isWaitingForCreate();
+}
+
+bool
NodeSessionManager::waitForCreate()
{
assert(_thread);
diff --git a/cpp/src/IceGrid/NodeSessionManager.h b/cpp/src/IceGrid/NodeSessionManager.h
index 8345f79be9e..71b5ef53324 100644
--- a/cpp/src/IceGrid/NodeSessionManager.h
+++ b/cpp/src/IceGrid/NodeSessionManager.h
@@ -58,6 +58,7 @@ public:
void create(const NodeIPtr&);
void create(const InternalRegistryPrx&);
void activate();
+ bool isWaitingForCreate();
bool waitForCreate();
void terminate();
void destroy();
diff --git a/cpp/src/IceGrid/SessionManager.h b/cpp/src/IceGrid/SessionManager.h
index de0f2ab4af2..8db4f9949a3 100644
--- a/cpp/src/IceGrid/SessionManager.h
+++ b/cpp/src/IceGrid/SessionManager.h
@@ -181,6 +181,13 @@ public:
}
}
+ bool
+ isWaitingForCreate()
+ {
+ Lock sync(*this);
+ return _state != Destroyed && _state != Connected;
+ }
+
virtual bool
waitForCreate()
{