From 22090842a08c0bdc1169778466d1283ce83bc602 Mon Sep 17 00:00:00 2001 From: Peter Wilhelmsson Date: Fri, 13 Mar 2020 08:12:22 +0100 Subject: [PATCH] Retry start of neo4j service on Windows Prunsrv sometimes fails to start the neo4j service due to a timeout. Until the reason for why this timeout occures a one time retry of starting should make the integration tests green. When it fails to start it will be visible in the logs so we shouldn't forget about this problem. --- boltkit/controller.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/boltkit/controller.py b/boltkit/controller.py index ae6bd73..38c95a3 100644 --- a/boltkit/controller.py +++ b/boltkit/controller.py @@ -459,10 +459,19 @@ def extract(cls, archive, path): def os_dependent_config(cls, instance_id): return {config.WINDOWS_SERVICE_NAME_SETTING: instance_id} + def _start(self): + params = [path_join(self.home, "bin", "neo4j.bat"), "start"] + try: + _invoke(params) + except CalledProcessError: + # Try again to cover for weird prunsrv timeout when starting service. + # Remove this when investigated and solved! + _invoke(params) + def start(self, timeout=0): http_uri, bolt_uri = config.extract_http_and_bolt_uris(self.home) _invoke([path_join(self.home, "bin", "neo4j.bat"), "install-service"]) - _invoke([path_join(self.home, "bin", "neo4j.bat"), "start"]) + self._start() if timeout: wait_for_server(http_uri.hostname, http_uri.port, timeout=timeout) return InstanceInfo(http_uri, bolt_uri, self.home) @@ -566,7 +575,6 @@ def _install(edition, version, path, **kwargs): else: return home - def install(): parser = ArgumentParser( description="Download and extract a Neo4j server package for the current platform.\r\n"