From 2c53404f0a825e77d5322649f428f42b7ac2fed0 Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Tue, 26 May 2020 15:04:44 +0200 Subject: [PATCH] Fixed IceGrid port bug where exception callback wasn't called --- cpp/src/IceGrid/NodeI.cpp | 3 ++- cpp/src/IceGrid/ServerI.cpp | 7 ++++++- scripts/IceGridUtil.py | 16 +++++++++++----- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/cpp/src/IceGrid/NodeI.cpp b/cpp/src/IceGrid/NodeI.cpp index 32a244deb6a..61daf5b67bc 100644 --- a/cpp/src/IceGrid/NodeI.cpp +++ b/cpp/src/IceGrid/NodeI.cpp @@ -1254,7 +1254,8 @@ NodeI::loadServer(shared_ptr descriptor, string replic try { - command = server->load(descriptor, replicaName, noRestart, std::move(response), std::move(exception)); + // Don't std::move response/exception as we may need to loop and call again load. + command = server->load(descriptor, replicaName, noRestart, response, exception); } catch(const Ice::ObjectNotExistException&) { diff --git a/cpp/src/IceGrid/ServerI.cpp b/cpp/src/IceGrid/ServerI.cpp index 9d402157f2d..b14999cf5ed 100644 --- a/cpp/src/IceGrid/ServerI.cpp +++ b/cpp/src/IceGrid/ServerI.cpp @@ -1268,7 +1268,8 @@ ServerI::load(const shared_ptr& desc, const string& re { adapters.insert({ adapter.first, adapter.second->getProxy() }); } - response(_this, adapters, secondsToInt(_activationTimeout), secondsToInt(_deactivationTimeout)); } + response(_this, adapters, secondsToInt(_activationTimeout), secondsToInt(_deactivationTimeout)); + } else if(_state == InternalServerState::Active) { _load->addCallback(response, exception); // Must be called before startRuntimePropertiesUpdate! @@ -1629,6 +1630,10 @@ ServerI::activate() { _node->getMasterNodeSession()->waitForApplicationUpdateAsync(desc->uuid, desc->revision, [self = shared_from_this()] + { + self->waitForApplicationUpdateCompleted(); + }, + [self = shared_from_this()](exception_ptr) { self->waitForApplicationUpdateCompleted(); }); diff --git a/scripts/IceGridUtil.py b/scripts/IceGridUtil.py index f42b4cf6cf3..57a5fc0f0d2 100644 --- a/scripts/IceGridUtil.py +++ b/scripts/IceGridUtil.py @@ -142,10 +142,11 @@ def setup(self, current): def teardown(self, current, success): Server.teardown(self, current, success) # Remove the database directory tree - try: - shutil.rmtree(self.dbdir) - except: - pass + if success or current.driver.isInterrupted(): + try: + shutil.rmtree(self.dbdir) + except: + pass def getProps(self, current): props = { @@ -235,6 +236,11 @@ def init(self, mapping, testsuite): def setupClientSide(self, current): if self.application: + try: + self.runadmin(current, "application remove Test", quiet=True) + except: + pass + javaHome = os.environ.get("JAVA_HOME", None) serverProps = Server().getProps(current) variables = { @@ -264,7 +270,7 @@ def setupClientSide(self, current): self.runadmin(current, "application add -n {0} {1} {2}".format(application, varStr, targets)) def teardownClientSide(self, current, success): - if self.application: + if (success or current.driver.isInterrupted()) and self.application: self.runadmin(current, "application remove Test") for p in self.icegridnode + self.icegridregistry: