1
0
Fork 0

hunting down invalid mutex in shutdown of agency

This commit is contained in:
Kaveh Vahedipour 2016-06-01 12:51:56 +00:00
parent b73a811c65
commit ac2fc7b8a0
3 changed files with 11 additions and 7 deletions

View File

@ -44,7 +44,7 @@ AgencyFeature::AgencyFeature(application_features::ApplicationServer* server)
_notify(false),
_supervision(false),
_waitForSync(true),
_supervisionFrequency(5.0),
_supervisionFrequency(1.0),
_compactionStepSize(1000) {
setOptional(true);
requiresElevatedPrivileges(false);

View File

@ -381,13 +381,15 @@ void Agent::beginShutdown() {
// Personal hygiene
Thread::beginShutdown();
// Stop supervision
if (_config.supervision) {
_supervision.beginShutdown();
}
// Stop constituent and key value stores
_constituent.beginShutdown();
_spearhead.beginShutdown();
_readDB.beginShutdown();
if (_config.supervision) {
_supervision.beginShutdown();
}
// Wake up all waiting REST handler (waitFor)
CONDITION_LOCKER(guard, _appendCV);

View File

@ -124,7 +124,9 @@ std::vector<check_t> Supervision::checkDBServers() {
report->close();
report->close();
report->close();
if (!this->isStopping()) {
_agent->write(report);
}
}
@ -235,7 +237,7 @@ bool Supervision::start(Agent* agent) {
bool Supervision::updateAgencyPrefix (size_t nTries, int intervalSec) {
// Try nTries to get agency's prefix in intervals
for (size_t i = 0; i < nTries; i++) {
while (!this->isStopping()) {
_snapshot = _agent->readDB().get("/");
if (_snapshot.children().size() > 0) {
_agencyPrefix = std::string("/") + _snapshot.children().begin()->first;
@ -256,7 +258,7 @@ void Supervision::getUniqueIds() {
uint64_t latestId;
// Run forever, supervision does not make sense before the agency data
// is initialized by some other server...
while (true) {
while (!this->isStopping()) {
try {
latestId = std::stoul(
_agent->readDB().get(_agencyPrefix + "/Sync/LatestID").slice().toJson());