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 i;
|
||||||
var url;
|
var url;
|
||||||
var r;
|
var r;
|
||||||
|
var serverStates = {};
|
||||||
|
var error = false;
|
||||||
|
|
||||||
for (i = 0;i < run.endpoints.length;i++) {
|
for (i = 0;i < run.endpoints.length;i++) {
|
||||||
console.info("Using API to shutdown %s", JSON.stringify(run.pids[i]));
|
console.info("Using API to shutdown %s", JSON.stringify(run.pids[i]));
|
||||||
url = endpointToURL(run.endpoints[i])+"/_admin/shutdown";
|
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++) {
|
for (i = 0;i < run.pids.length;i++) {
|
||||||
var s = statusExternal(run.pids[i]);
|
var s = statusExternal(run.pids[i]);
|
||||||
if (s.status !== "TERMINATED") {
|
if (s.status !== "TERMINATED") {
|
||||||
console.info("Shutting down %s the hard way...",
|
if (s.hasOwnProperty('signal')) {
|
||||||
JSON.stringify(run.pids[i]));
|
error = true;
|
||||||
killExternal(run.pids[i]);
|
console.info("done - with problems: " + s);
|
||||||
console.info("done.");
|
}
|
||||||
|
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) {
|
cleanupActions.startAgent = function (dispatchers, cmd) {
|
||||||
|
|
|
@ -433,26 +433,59 @@ function checkInstanceAlive(instanceInfo, options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function shutdownInstance (instanceInfo, options) {
|
function shutdownInstance (instanceInfo, options) {
|
||||||
|
if (!checkInstanceAlive(instanceInfo, options)) {
|
||||||
|
print("Server already dead, doing nothing. This shouldn't happen?");
|
||||||
|
}
|
||||||
if (options.cluster) {
|
if (options.cluster) {
|
||||||
instanceInfo.kickstarter.shutdown();
|
var rc = instanceInfo.kickstarter.shutdown();
|
||||||
if (options.cleanup) {
|
if (options.cleanup) {
|
||||||
instanceInfo.kickstarter.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 {
|
else {
|
||||||
if (typeof(instanceInfo.exitStatus) === 'undefined') {
|
if (typeof(instanceInfo.exitStatus) === 'undefined') {
|
||||||
download(instanceInfo.url+"/_admin/shutdown","",
|
download(instanceInfo.url+"/_admin/shutdown","",
|
||||||
makeAuthorisationHeaders(options));
|
makeAuthorisationHeaders(options));
|
||||||
|
|
||||||
if (typeof(options.valgrind) === 'string') {
|
print("Waiting for server shut down");
|
||||||
print("Waiting for server shut down");
|
var count = 0;
|
||||||
var res = statusExternal(instanceInfo.pid, true);
|
while (1) {
|
||||||
print("Server gone: ");
|
instanceInfo.exitStatus = statusExternal(instanceInfo.pid, false);
|
||||||
print(res);
|
if (instanceInfo.exitStatus.status === "RUNNING") {
|
||||||
}
|
count ++;
|
||||||
else {
|
if (typeof(options.valgrind) === 'string') {
|
||||||
wait(10);
|
continue;
|
||||||
killExternal(instanceInfo.pid);
|
}
|
||||||
|
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 {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue