From 5fbb78f4e3a7705261c935866a286c9d12c9d18b Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Mon, 19 Mar 2018 13:26:13 +0100 Subject: [PATCH] Bug fix/fix context allocation (#4892) --- arangod/V8Server/V8DealerFeature.cpp | 27 +-------------------------- arangod/V8Server/V8DealerFeature.h | 1 - 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/arangod/V8Server/V8DealerFeature.cpp b/arangod/V8Server/V8DealerFeature.cpp index 6aa5e81f6c..72ba0f1b17 100644 --- a/arangod/V8Server/V8DealerFeature.cpp +++ b/arangod/V8Server/V8DealerFeature.cpp @@ -322,7 +322,7 @@ V8Context* V8DealerFeature::addContext() { // no other thread can use the context when we are here, as the // context has not been added to the global list of contexts yet - loadJavaScriptFileInContextNoLock(database->systemDatabase(), "server/initialize.js", context); + loadJavaScriptFileInContext(database->systemDatabase(), "server/initialize.js", context, nullptr); return context; } catch (...) { delete context; @@ -1342,31 +1342,6 @@ bool V8DealerFeature::loadJavaScriptFileInContext(TRI_vocbase_t* vocbase, return true; } -bool V8DealerFeature::loadJavaScriptFileInContextNoLock(TRI_vocbase_t* vocbase, - std::string const& file, V8Context* context) { - TRI_ASSERT(vocbase != nullptr); - TRI_ASSERT(context != nullptr); - - if (_stopping) { - return false; - } - - if (!vocbase->use()) { - return false; - } - - prepareLockedContext(vocbase, context, true); - - try { - loadJavaScriptFileInternal(file, context, nullptr); - } catch (...) { - LOG_TOPIC(WARN, Logger::V8) << "caught exception while executing JavaScript file '" << file << "' in context #" << context->id(); - throw; - } - - return true; -} - void V8DealerFeature::loadJavaScriptFileInternal(std::string const& file, V8Context* context, VPackBuilder* builder) { v8::HandleScope scope(context->_isolate); auto localContext = diff --git a/arangod/V8Server/V8DealerFeature.h b/arangod/V8Server/V8DealerFeature.h index 177bff14b4..3783919102 100644 --- a/arangod/V8Server/V8DealerFeature.h +++ b/arangod/V8Server/V8DealerFeature.h @@ -133,7 +133,6 @@ class V8DealerFeature final : public application_features::ApplicationFeature { void loadJavaScriptFileInternal(std::string const& file, V8Context* context, VPackBuilder* builder); bool loadJavaScriptFileInContext(TRI_vocbase_t*, std::string const& file, V8Context* context, VPackBuilder* builder); - bool loadJavaScriptFileInContextNoLock(TRI_vocbase_t*, std::string const& file, V8Context* context); void prepareLockedContext(TRI_vocbase_t*, V8Context*, bool allowUseDatabase); void exitContextInternal(V8Context*); void cleanupLockedContext(V8Context*);