1
0
Fork 0

Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel

This commit is contained in:
gschwab 2014-03-07 16:58:34 +01:00
commit c06ea80ee9
5 changed files with 49 additions and 40 deletions

View File

@ -454,15 +454,15 @@ int main (int argc, char* argv[]) {
#endif
// shutdown sub-systems
TRIAGENS_REST_SHUTDOWN;
TRI_GlobalExitFunction(res, NULL);
if (ArangoInstance != 0) {
delete ArangoInstance;
ArangoInstance = 0;
}
// shutdown sub-systems
TRIAGENS_REST_SHUTDOWN;
TRI_GlobalExitFunction(res, NULL);
return res;
}

View File

@ -134,7 +134,7 @@
deleteDatabase: function(e) {
this.hideModal('editDatabaseModal');
this.dbToDelete = $('#editDatabaseName').html();
this.showModal('deleteDatabaseModal')
this.showModal('deleteDatabaseModal');
},
currentDatabase: function() {
@ -162,7 +162,7 @@
$('#editDatabaseName').html(dbName);
var button = $('#deleteDatabase');
if(dbName === this.currentDB) {
var element
var element;
button.prop('disabled', true);
button.removeClass('button-danger');
button.addClass('button-neutral');

View File

@ -356,13 +356,10 @@ launchActions.createSystemColls = function (dispatchers, cmd, isRelaunch) {
shutdownActions.startAgent = function (dispatchers, cmd, run) {
console.info("Shutting down agent %s", JSON.stringify(run.pid));
killExternal(run.pid);
statusExternal(run.pid);
return {"error": false, "isStartAgent": true};
};
shutdownActions.sendConfiguration = function (dispatchers, cmd, run) {
console.info("Waiting for 3 seconds for servers before shutting down agency.");
wait(3);
return {"error": false, "isSendConfiguration": true};
};
@ -379,12 +376,15 @@ shutdownActions.startServers = function (dispatchers, cmd, run) {
}
download(url,"",{method:"GET", headers: hdrs});
}
console.info("Waiting 3 seconds for servers to shutdown gracefully...");
wait(3);
console.info("Waiting 5 seconds for servers to shutdown gracefully...");
wait(5);
for (i = 0;i < run.pids.length;i++) {
console.info("Shutting down %s the hard way...", JSON.stringify(run.pids[i]));
killExternal(run.pids[i]);
statusExternal(run.pids[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]);
}
}
return {"error": false, "isStartServers": true};
};

View File

@ -970,7 +970,12 @@ TRI_external_status_t TRI_CheckExternalProcess (TRI_external_id_t pid,
#ifndef _WIN32
static bool ourKillProcess(TRI_external_t* pid) {
return (0 != kill(pid->_pid, SIGTERM));
bool success;
int loc;
success = (0 != kill(pid->_pid, SIGTERM));
// And wait for it to avoid a zombie:
waitpid(pid->_pid, &loc, WUNTRACED);
return success;
}
#else
static bool ourKillProcess(TRI_external_t* pid) {
@ -1019,6 +1024,8 @@ bool TRI_KillExternalProcess (TRI_external_id_t pid) {
TRI_external_t* external;
size_t i;
bool ok = true;
bool success;
int loc;
TRI_LockMutex(&ExternalProcessesLock);
@ -1034,7 +1041,10 @@ bool TRI_KillExternalProcess (TRI_external_id_t pid) {
TRI_UnlockMutex(&ExternalProcessesLock);
#ifndef _WIN32
// Kill just in case:
return (0 != kill(pid._pid, SIGTERM));
success = (0 != kill(pid._pid, SIGTERM));
// And wait for it to avoid a zombie:
waitpid(pid._pid, &loc, WUNTRACED);
return success;
#else
return ourKillProcessPID(pid._pid);
#endif

View File

@ -52,6 +52,27 @@
int TRI_closesocket (TRI_socket_t s) {
int res = 0;
#ifdef _WIN32
if (s.fileHandle != TRI_INVALID_SOCKET) {
res = shutdown(s.fileHandle, SD_SEND);
if (res != 0) {
// Windows complains about shutting down a socket that was not bound
// so we will not print out the error here
// LOG_WARNING("socket shutdown error: %d", WSAGetLastError());
}
else {
char buf[256];
int len;
do {
len = TRI_readsocket(s, buf, sizeof(buf), 0);
} while (len > 0);
}
res = closesocket(s.fileHandle);
if (res != 0) {
LOG_WARNING("socket close error: %d", WSAGetLastError());
}
if (s.fileDescriptor != -1) {
res = _close(s.fileDescriptor);
/*
@ -60,30 +81,8 @@ int TRI_closesocket (TRI_socket_t s) {
so it is not necessary to call the Win32 function CloseHandle on the original handle.
*/
}
else if (s.fileHandle != TRI_INVALID_SOCKET) {
res = shutdown(s.fileHandle, SD_SEND);
if (res != 0) {
// Windows complains about shutting down a socket that was not bound
// so we will not print out the error here
// LOG_WARNING("socket shutdown error: %d", WSAGetLastError());
}
else {
char buf[256];
int len;
do {
len = TRI_readsocket(s, buf, sizeof(buf), 0);
}
while (len > 0);
res = closesocket(s.fileHandle);
if (res != 0) {
LOG_WARNING("socket close error: %d", WSAGetLastError());
}
}
}
#else
}
#else
if (s.fileDescriptor != TRI_INVALID_SOCKET) {
res = close(s.fileDescriptor);
}