1
0
Fork 0

Be more gracefully when shutting down, however, alarm if we take longer than 10s for shutdown.

This commit is contained in:
Willi Goesgens 2015-01-15 16:26:22 +01:00
parent 786d7e1947
commit bc4a77828b
1 changed files with 14 additions and 4 deletions

View File

@ -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: ");