mirror of https://gitee.com/bigwinds/arangodb
Bug fix/v8 syslog (#3055)
* don't try to return something from a void function * log to syslog if V8 aborts
This commit is contained in:
parent
b4c58d757f
commit
e3acec24b6
|
@ -10,6 +10,10 @@
|
|||
#include "src/base/debug/stack_trace.h"
|
||||
#include "src/base/platform/platform.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#include <syslog.h>
|
||||
#endif
|
||||
|
||||
namespace v8 {
|
||||
namespace base {
|
||||
|
||||
|
@ -51,8 +55,13 @@ extern "C" void V8_Fatal(const char* file, int line, const char* format, ...) {
|
|||
fflush(stderr);
|
||||
v8::base::OS::PrintError("\n\n#\n# Fatal error in %s, line %d\n# ", file,
|
||||
line);
|
||||
#ifdef __linux__
|
||||
::syslog(LOG_CRIT, "V8 fatal error in %s:%d", file, line);
|
||||
#endif
|
||||
|
||||
va_list arguments;
|
||||
va_start(arguments, format);
|
||||
|
||||
v8::base::OS::VPrintError(format, arguments);
|
||||
va_end(arguments);
|
||||
v8::base::OS::PrintError("\n#\n");
|
||||
|
|
|
@ -27,6 +27,10 @@
|
|||
#include <sys/sysctl.h> // NOLINT, for sysctl
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#include <syslog.h>
|
||||
#endif
|
||||
|
||||
#undef MAP_TYPE
|
||||
|
||||
#if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT)
|
||||
|
@ -249,6 +253,10 @@ void OS::Sleep(TimeDelta interval) {
|
|||
|
||||
|
||||
void OS::Abort() {
|
||||
#ifdef __linux__
|
||||
::syslog(LOG_CRIT, "V8 fatal error. Aborting process");
|
||||
#endif
|
||||
|
||||
if (g_hard_abort) {
|
||||
V8_IMMEDIATE_CRASH();
|
||||
}
|
||||
|
|
|
@ -549,7 +549,6 @@ static void DocumentVocbase(
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void RemoveVocbaseCol(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||
|
||||
v8::Isolate* isolate = args.GetIsolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
OperationOptions options;
|
||||
|
@ -1595,8 +1594,7 @@ static void JS_PropertiesVocbaseCol(
|
|||
static void JS_RemoveVocbaseCol(
|
||||
v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
||||
return RemoveVocbaseCol(args);
|
||||
|
||||
RemoveVocbaseCol(args);
|
||||
// cppcheck-suppress style
|
||||
TRI_V8_TRY_CATCH_END
|
||||
}
|
||||
|
@ -3190,8 +3188,7 @@ static void JS_CompletionsVocbase(
|
|||
|
||||
static void JS_RemoveVocbase(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
||||
return RemoveVocbase(args);
|
||||
|
||||
RemoveVocbase(args);
|
||||
// cppcheck-suppress style
|
||||
TRI_V8_TRY_CATCH_END
|
||||
}
|
||||
|
|
|
@ -389,8 +389,7 @@ static void JS_ChecksumCollection(
|
|||
|
||||
static void JS_EdgesQuery(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
||||
return EdgesQuery(TRI_EDGE_ANY, args);
|
||||
|
||||
EdgesQuery(TRI_EDGE_ANY, args);
|
||||
// cppcheck-suppress *
|
||||
TRI_V8_TRY_CATCH_END
|
||||
}
|
||||
|
@ -401,8 +400,7 @@ static void JS_EdgesQuery(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
|
||||
static void JS_InEdgesQuery(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
||||
return EdgesQuery(TRI_EDGE_IN, args);
|
||||
|
||||
EdgesQuery(TRI_EDGE_IN, args);
|
||||
// cppcheck-suppress *
|
||||
TRI_V8_TRY_CATCH_END
|
||||
}
|
||||
|
@ -413,8 +411,7 @@ static void JS_InEdgesQuery(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
|
||||
static void JS_OutEdgesQuery(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
||||
return EdgesQuery(TRI_EDGE_OUT, args);
|
||||
|
||||
EdgesQuery(TRI_EDGE_OUT, args);
|
||||
// cppcheck-suppress *
|
||||
TRI_V8_TRY_CATCH_END
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ static void JS_LastLoggerReplication( v8::FunctionCallbackInfo<v8::Value> const&
|
|||
TRI_V8_TRY_CATCH_END
|
||||
}
|
||||
|
||||
void addReplicationAuthentication(v8::Isolate* isolate,
|
||||
static void addReplicationAuthentication(v8::Isolate* isolate,
|
||||
v8::Handle<v8::Object> object,
|
||||
TRI_replication_applier_configuration_t &config) {
|
||||
bool hasUsernamePassword = false;
|
||||
|
|
|
@ -1881,17 +1881,17 @@ static void JS_TrustedProxies(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
|
||||
static void JS_AuthenticationEnabled(
|
||||
v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||
auto authentication = application_features::ApplicationServer::getFeature<AuthenticationFeature>(
|
||||
"Authentication");
|
||||
|
||||
TRI_ASSERT(authentication != nullptr);
|
||||
|
||||
// mop: one could argue that this is a function because this might be
|
||||
// changable on the fly at some time but the sad truth is server startup
|
||||
// order
|
||||
// v8 is initialized after GeneralServerFeature
|
||||
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
||||
v8::HandleScope scope(isolate);
|
||||
|
||||
auto authentication = application_features::ApplicationServer::getFeature<AuthenticationFeature>(
|
||||
"Authentication");
|
||||
|
||||
TRI_ASSERT(authentication != nullptr);
|
||||
|
||||
v8::Handle<v8::Boolean> result =
|
||||
v8::Boolean::New(isolate, authentication->isActive());
|
||||
|
@ -2017,18 +2017,16 @@ static void JS_DecodeRev(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief decode a _rev time stamp
|
||||
/// @brief returns the current context
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void JS_ArangoDBContext(v8::FunctionCallbackInfo<v8::Value> const& args)
|
||||
{
|
||||
void JS_ArangoDBContext(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
||||
v8::HandleScope scope(isolate);
|
||||
|
||||
if (args.Length() != 0) {
|
||||
TRI_V8_THROW_EXCEPTION_USAGE("ARANGODB_CONTEXT()");
|
||||
}
|
||||
|
||||
|
||||
v8::Handle<v8::Object> result = v8::Object::New(isolate);
|
||||
auto context = Thread::currentWorkContext();
|
||||
|
|
Loading…
Reference in New Issue