1
0
Fork 0

Bug fix/fix context allocation (#4892)

This commit is contained in:
Wilfried Goesgens 2018-03-19 13:26:13 +01:00 committed by Jan
parent 5c70062929
commit 5fbb78f4e3
2 changed files with 1 additions and 27 deletions

View File

@ -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 =

View File

@ -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*);