From bc4a77828bff733139b929d7897f95b9657bc8be Mon Sep 17 00:00:00 2001 From: Willi Goesgens Date: Thu, 15 Jan 2015 16:26:22 +0100 Subject: [PATCH] Be more gracefully when shutting down, however, alarm if we take longer than 10s for shutdown. --- js/server/modules/org/arangodb/testing.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/js/server/modules/org/arangodb/testing.js b/js/server/modules/org/arangodb/testing.js index 1652db87bc..7814f296f6 100644 --- a/js/server/modules/org/arangodb/testing.js +++ b/js/server/modules/org/arangodb/testing.js @@ -445,7 +445,7 @@ function shutdownInstance (instanceInfo, options) { for (var i in rc.serverStates) { if (rc.serverStates.hasOwnProperty(i)){ if (rc.serverStates[i].hasOwnProperty('signal')) { - print("Server shut down with : " + rc.serverStates[i] + " marking run as crashy."); + print("Server shut down with : " + JSON.stringify(rc.serverStates[i]) + " marking run as crashy."); serverCrashed = true; } } @@ -459,6 +459,7 @@ function shutdownInstance (instanceInfo, options) { print("Waiting for server shut down"); var count = 0; + var bar = "["; while (1) { instanceInfo.exitStatus = statusExternal(instanceInfo.pid, false); if (instanceInfo.exitStatus.status === "RUNNING") { @@ -466,8 +467,11 @@ function shutdownInstance (instanceInfo, options) { if (typeof(options.valgrind) === 'string') { continue; } - if (count > 10) { - print("forcefully terminating " + instanceInfo.pid + " after 10 s grace period."); + if (count % 10 ===0) { + bar = bar + "#"; + } + if (count > 600) { + print("forcefully terminating " + JSON.stringify(instanceInfo.pid) + " after 600 s grace period."); serverCrashed = true; killExternal(instanceInfo.pid); break; @@ -478,7 +482,7 @@ function shutdownInstance (instanceInfo, options) { } else if (instanceInfo.exitStatus.status !== "TERMINATED") { if (instanceInfo.exitStatus.hasOwnProperty('signal')) { - print("Server shut down with : " + instanceInfo.exitStatus + " marking build as crashy."); + print("Server shut down with : " + JSON.stringify(instanceInfo.exitStatus) + " marking build as crashy."); serverCrashed = true; } } @@ -487,6 +491,9 @@ function shutdownInstance (instanceInfo, options) { break; // Success. } } + if (count > 10) { + print("long Server shutdown: " + bar + ']'); + } } else { print("Server already dead, doing nothing."); @@ -1599,6 +1606,9 @@ function unitTestPrettyPrintResults(r) { if (r.all_ok !== true) { print(" Suites failed: " + testSuiteFail + " Tests Failed: " + testFail); } + if (r.crashed === true) { + print(" We had at least one unclean shutdown of an arangod during the testrun.") + } } catch (x) { print("exception caught while pretty printing result: ");