1
0
Fork 0

fixed race conditions

This commit is contained in:
Jan Steemann 2014-02-19 14:53:13 +01:00
parent 726144ce39
commit dd5b172e2c
3 changed files with 11 additions and 4 deletions

View File

@ -155,9 +155,14 @@ bool ApplicationCluster::prepare () {
} }
} }
// initialise ClusterComm library
ClusterComm::instance()->initialise();
// initialise cluster info library // initialise cluster info library
ClusterInfo::instance(); ClusterInfo::instance();
usleep(1000);
return true; return true;
} }
@ -258,9 +263,6 @@ bool ApplicationCluster::start () {
_myAddress.c_str(), _myAddress.c_str(),
ServerState::roleToString(role).c_str()); ServerState::roleToString(role).c_str());
// initialise ClusterComm library
ClusterComm::instance()->initialise();
if (! _disableHeartbeat) { if (! _disableHeartbeat) {
AgencyCommResult result = comm.getValues("Sync/HeartbeatIntervalMs", false); AgencyCommResult result = comm.getValues("Sync/HeartbeatIntervalMs", false);

View File

@ -445,7 +445,7 @@ ClusterCommResult* ClusterComm::wait (
double timeleft; double timeleft;
if (0.0 == timeout) { if (0.0 == timeout) {
endtime = 1.0e50; // this is the Sankt Nimmerleinstag endtime = TRI_microtime() + 24.0 * 60.0 * 60.0; // this is the Sankt Nimmerleinstag
} }
else { else {
endtime = TRI_microtime() + timeout; endtime = TRI_microtime() + timeout;
@ -895,6 +895,7 @@ void ClusterCommThread::run () {
if (0 != _stop) { if (0 != _stop) {
break; break;
} }
{ {
basics::ConditionLocker locker(&cc->somethingToSend); basics::ConditionLocker locker(&cc->somethingToSend);
if (cc->toSend.empty()) { if (cc->toSend.empty()) {

View File

@ -285,6 +285,10 @@ launchActions.startServers = function (dispatchers, cmd, isRelaunch) {
pids.push(executeExternal(arangodPath, args)); pids.push(executeExternal(arangodPath, args));
endpoints.push(exchangePort(dispatchers[cmd.dispatcher].endpoint,port)); endpoints.push(exchangePort(dispatchers[cmd.dispatcher].endpoint,port));
} }
console.info("Waiting for servers to come to live...");
wait(5);
return {"error": false, "isStartServers": true, return {"error": false, "isStartServers": true,
"pids": pids, "endpoints": endpoints, "roles": roles}; "pids": pids, "endpoints": endpoints, "roles": roles};
}; };