From 371a9fd046521a2f13e8d51a3f37fdb9ec6beb09 Mon Sep 17 00:00:00 2001 From: jsteemann Date: Sat, 6 Feb 2016 00:37:32 +0100 Subject: [PATCH] prevent lock from being moved from one thread to another --- arangod/Utils/CollectionExport.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arangod/Utils/CollectionExport.cpp b/arangod/Utils/CollectionExport.cpp index 6e298000cc..e8860461f5 100644 --- a/arangod/Utils/CollectionExport.cpp +++ b/arangod/Utils/CollectionExport.cpp @@ -57,6 +57,7 @@ CollectionExport::~CollectionExport() { _ditch->ditches()->freeDocumentDitch(_ditch, false); } + // if not already done delete _guard; } @@ -136,4 +137,14 @@ void CollectionExport::run(uint64_t maxWaitTime, size_t limit) { trx.finish(res); } + + // delete guard right now as we're about to return + // if we would continue holding the guard's collection lock and return, + // and the export object gets later freed in a different thread, then all + // would be lost. so we'll release the lock here and rely on the cleanup + // thread not unloading the collection (as we've acquired a document ditch + // for the collection already - this will prevent unloading of the collection's + // datafiles etc.) + delete _guard; + _guard = nullptr; }