mirror of https://gitee.com/bigwinds/arangodb
Bug fix/fix context allocation (#4892)
This commit is contained in:
parent
5c70062929
commit
5fbb78f4e3
|
@ -322,7 +322,7 @@ V8Context* V8DealerFeature::addContext() {
|
||||||
|
|
||||||
// no other thread can use the context when we are here, as the
|
// 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
|
// 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;
|
return context;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
delete context;
|
delete context;
|
||||||
|
@ -1342,31 +1342,6 @@ bool V8DealerFeature::loadJavaScriptFileInContext(TRI_vocbase_t* vocbase,
|
||||||
return true;
|
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) {
|
void V8DealerFeature::loadJavaScriptFileInternal(std::string const& file, V8Context* context, VPackBuilder* builder) {
|
||||||
v8::HandleScope scope(context->_isolate);
|
v8::HandleScope scope(context->_isolate);
|
||||||
auto localContext =
|
auto localContext =
|
||||||
|
|
|
@ -133,7 +133,6 @@ class V8DealerFeature final : public application_features::ApplicationFeature {
|
||||||
void loadJavaScriptFileInternal(std::string const& file, V8Context* context,
|
void loadJavaScriptFileInternal(std::string const& file, V8Context* context,
|
||||||
VPackBuilder* builder);
|
VPackBuilder* builder);
|
||||||
bool loadJavaScriptFileInContext(TRI_vocbase_t*, 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 prepareLockedContext(TRI_vocbase_t*, V8Context*, bool allowUseDatabase);
|
||||||
void exitContextInternal(V8Context*);
|
void exitContextInternal(V8Context*);
|
||||||
void cleanupLockedContext(V8Context*);
|
void cleanupLockedContext(V8Context*);
|
||||||
|
|
Loading…
Reference in New Issue