From 1f6a4fd58d81ede8a9872a7407fb40e8579f6c2d Mon Sep 17 00:00:00 2001 From: Max Neunhoeffer Date: Wed, 23 Mar 2016 14:07:09 +0100 Subject: [PATCH 1/2] Fix potential shutdown crash. --- arangod/Cluster/ApplicationCluster.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arangod/Cluster/ApplicationCluster.cpp b/arangod/Cluster/ApplicationCluster.cpp index 9d152779b9..fba7c2ae92 100644 --- a/arangod/Cluster/ApplicationCluster.cpp +++ b/arangod/Cluster/ApplicationCluster.cpp @@ -449,6 +449,10 @@ void ApplicationCluster::stop() { } } + while (_heartbeat->isRunning()) { + usleep(50000); + } + // ClusterComm::cleanup(); AgencyComm::cleanup(); } From 9322e477402297d824d821d6feb016f60736b5d2 Mon Sep 17 00:00:00 2001 From: Max Neunhoeffer Date: Wed, 23 Mar 2016 14:07:46 +0100 Subject: [PATCH 2/2] Fix a few uninitialized shared_ptrs. --- arangod/Replication/ContinuousSyncer.cpp | 4 ++-- arangod/Replication/InitialSyncer.cpp | 14 +++++++------- arangod/Replication/Syncer.cpp | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/arangod/Replication/ContinuousSyncer.cpp b/arangod/Replication/ContinuousSyncer.cpp index 8d08dcfa36..67b41eec50 100644 --- a/arangod/Replication/ContinuousSyncer.cpp +++ b/arangod/Replication/ContinuousSyncer.cpp @@ -909,7 +909,7 @@ int ContinuousSyncer::applyLog(SimpleHttpResult* response, processedMarkers++; - std::shared_ptr builder; + auto builder = std::make_shared(); try { VPackParser parser(builder); @@ -1242,7 +1242,7 @@ int ContinuousSyncer::fetchMasterState(std::string& errorMsg, startTick = toTick; } - std::shared_ptr builder; + auto builder = std::make_shared(); int res = parseResponse(builder, response.get()); if (res != TRI_ERROR_NO_ERROR) { diff --git a/arangod/Replication/InitialSyncer.cpp b/arangod/Replication/InitialSyncer.cpp index cc2b75057e..e2520ce280 100644 --- a/arangod/Replication/InitialSyncer.cpp +++ b/arangod/Replication/InitialSyncer.cpp @@ -228,7 +228,7 @@ int InitialSyncer::run(std::string& errorMsg, bool incremental) { StringUtils::itoa(response->getHttpReturnCode()) + ": " + response->getHttpReturnMessage(); } else { - std::shared_ptr builder; + auto builder = std::make_shared(); res = parseResponse(builder, response.get()); if (res != TRI_ERROR_NO_ERROR) { @@ -346,7 +346,7 @@ int InitialSyncer::sendStartBatch(std::string& errorMsg) { return TRI_ERROR_REPLICATION_MASTER_ERROR; } - std::shared_ptr builder; + auto builder = std::make_shared(); int res = parseResponse(builder, response.get()); if (res != TRI_ERROR_NO_ERROR) { @@ -495,7 +495,7 @@ int InitialSyncer::applyCollectionDump( TRI_ASSERT(q <= end); - std::shared_ptr builder; + auto builder = std::make_shared(); try { VPackParser parser(builder); @@ -923,7 +923,7 @@ int InitialSyncer::handleCollectionSync( this->sleep(static_cast(sleepTime * 1000.0 * 1000.0)); } - std::shared_ptr builder; + auto builder = std::make_shared(); int res = parseResponse(builder, response.get()); if (res != TRI_ERROR_NO_ERROR) { @@ -1148,7 +1148,7 @@ int InitialSyncer::handleSyncKeys(TRI_vocbase_col_t* col, return TRI_ERROR_REPLICATION_MASTER_ERROR; } - std::shared_ptr builder; + auto builder = std::make_shared(); int res = parseResponse(builder, response.get()); if (res != TRI_ERROR_NO_ERROR) { @@ -1350,7 +1350,7 @@ int InitialSyncer::handleSyncKeys(TRI_vocbase_col_t* col, return TRI_ERROR_REPLICATION_MASTER_ERROR; } - std::shared_ptr builder; + auto builder = std::make_shared(); int res = parseResponse(builder, response.get()); if (res != TRI_ERROR_NO_ERROR) { @@ -1520,7 +1520,7 @@ int InitialSyncer::handleSyncKeys(TRI_vocbase_col_t* col, return TRI_ERROR_REPLICATION_MASTER_ERROR; } - std::shared_ptr builder; + auto builder = std::make_shared(); int res = parseResponse(builder, response.get()); if (res != TRI_ERROR_NO_ERROR) { diff --git a/arangod/Replication/Syncer.cpp b/arangod/Replication/Syncer.cpp index 423aff1cf4..d9d2352195 100644 --- a/arangod/Replication/Syncer.cpp +++ b/arangod/Replication/Syncer.cpp @@ -206,7 +206,7 @@ int Syncer::sendCreateBarrier(std::string& errorMsg, TRI_voc_tick_t minTick) { ": HTTP " + StringUtils::itoa(response->getHttpReturnCode()) + ": " + response->getHttpReturnMessage(); } else { - std::shared_ptr builder; + auto builder = std::make_shared(); res = parseResponse(builder, response.get()); if (res == TRI_ERROR_NO_ERROR) { @@ -642,7 +642,7 @@ int Syncer::getMasterState(std::string& errorMsg) { } - std::shared_ptr builder; + auto builder = std::make_shared(); int res = parseResponse(builder, response.get()); if (res == TRI_ERROR_NO_ERROR) {