mirror of https://gitee.com/bigwinds/arangodb
Take care for successfull shutdown, so we see whether we have crashes after the last test.
This commit is contained in:
parent
ee1a2e4ce1
commit
786d7e1947
|
@ -493,6 +493,9 @@ shutdownActions.startServers = function (dispatchers, cmd, run) {
|
|||
var i;
|
||||
var url;
|
||||
var r;
|
||||
var serverStates = {};
|
||||
var error = false;
|
||||
|
||||
for (i = 0;i < run.endpoints.length;i++) {
|
||||
console.info("Using API to shutdown %s", JSON.stringify(run.pids[i]));
|
||||
url = endpointToURL(run.endpoints[i])+"/_admin/shutdown";
|
||||
|
@ -514,13 +517,20 @@ shutdownActions.startServers = function (dispatchers, cmd, run) {
|
|||
for (i = 0;i < run.pids.length;i++) {
|
||||
var s = statusExternal(run.pids[i]);
|
||||
if (s.status !== "TERMINATED") {
|
||||
console.info("Shutting down %s the hard way...",
|
||||
JSON.stringify(run.pids[i]));
|
||||
killExternal(run.pids[i]);
|
||||
console.info("done.");
|
||||
if (s.hasOwnProperty('signal')) {
|
||||
error = true;
|
||||
console.info("done - with problems: " + s);
|
||||
}
|
||||
else {
|
||||
console.info("Shutting down %s the hard way...",
|
||||
JSON.stringify(run.pids[i]));
|
||||
s.killedState = killExternal(run.pids[i]);
|
||||
console.info("done.");
|
||||
}
|
||||
serverStates[run.pids[i]] = s;
|
||||
}
|
||||
}
|
||||
return {"error": false, "isStartServers": true};
|
||||
return {"error": error, "isStartServers": true, "serverStates" : serverStates};
|
||||
};
|
||||
|
||||
cleanupActions.startAgent = function (dispatchers, cmd) {
|
||||
|
|
|
@ -433,26 +433,59 @@ function checkInstanceAlive(instanceInfo, options) {
|
|||
}
|
||||
|
||||
function shutdownInstance (instanceInfo, options) {
|
||||
if (!checkInstanceAlive(instanceInfo, options)) {
|
||||
print("Server already dead, doing nothing. This shouldn't happen?");
|
||||
}
|
||||
if (options.cluster) {
|
||||
instanceInfo.kickstarter.shutdown();
|
||||
var rc = instanceInfo.kickstarter.shutdown();
|
||||
if (options.cleanup) {
|
||||
instanceInfo.kickstarter.cleanup();
|
||||
}
|
||||
if (rc.error) {
|
||||
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.");
|
||||
serverCrashed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (typeof(instanceInfo.exitStatus) === 'undefined') {
|
||||
download(instanceInfo.url+"/_admin/shutdown","",
|
||||
makeAuthorisationHeaders(options));
|
||||
|
||||
if (typeof(options.valgrind) === 'string') {
|
||||
print("Waiting for server shut down");
|
||||
var res = statusExternal(instanceInfo.pid, true);
|
||||
print("Server gone: ");
|
||||
print(res);
|
||||
}
|
||||
else {
|
||||
wait(10);
|
||||
killExternal(instanceInfo.pid);
|
||||
print("Waiting for server shut down");
|
||||
var count = 0;
|
||||
while (1) {
|
||||
instanceInfo.exitStatus = statusExternal(instanceInfo.pid, false);
|
||||
if (instanceInfo.exitStatus.status === "RUNNING") {
|
||||
count ++;
|
||||
if (typeof(options.valgrind) === 'string') {
|
||||
continue;
|
||||
}
|
||||
if (count > 10) {
|
||||
print("forcefully terminating " + instanceInfo.pid + " after 10 s grace period.");
|
||||
serverCrashed = true;
|
||||
killExternal(instanceInfo.pid);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
wait(1);
|
||||
}
|
||||
}
|
||||
else if (instanceInfo.exitStatus.status !== "TERMINATED") {
|
||||
if (instanceInfo.exitStatus.hasOwnProperty('signal')) {
|
||||
print("Server shut down with : " + instanceInfo.exitStatus + " marking build as crashy.");
|
||||
serverCrashed = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
print("Server shutdown: Success.");
|
||||
break; // Success.
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue