diff --git a/arangod/Aql/Query.cpp b/arangod/Aql/Query.cpp index 893c254cf7..820cfe26cd 100644 --- a/arangod/Aql/Query.cpp +++ b/arangod/Aql/Query.cpp @@ -67,12 +67,14 @@ static std::string StateNames[] = { "instantiating plan", // PLAN_INSTANTIATION "optimizing plan", // PLAN_OPTIMIZATION "executing", // EXECUTION - "finalizing" // FINALIZATION + "finalizing", // FINALIZATION + + "invalid" // INVALID }; // make sure the state strings and the actual states match static_assert(sizeof(StateNames) / sizeof(std::string) == - static_cast(ExecutionState::INVALID_STATE), + static_cast(ExecutionState::INVALID_STATE) + 1, "invalid number of ExecutionState values"); //////////////////////////////////////////////////////////////////////////////// diff --git a/arangod/RestHandler/RestCursorHandler.cpp b/arangod/RestHandler/RestCursorHandler.cpp index 4efdccb125..e5846bc702 100644 --- a/arangod/RestHandler/RestCursorHandler.cpp +++ b/arangod/RestHandler/RestCursorHandler.cpp @@ -201,7 +201,6 @@ void RestCursorHandler::processQuery(VPackSlice const& slice) { } arangodb::JsonCursor* cursor = cursors->createFromVelocyPack( builder, batchSize, extra, ttl, count, queryResult.cached); - queryResult.json = nullptr; try { _response->body().appendChar('{'); diff --git a/arangod/VocBase/replication-applier.cpp b/arangod/VocBase/replication-applier.cpp index a2d5d50f92..08a610ccd3 100644 --- a/arangod/VocBase/replication-applier.cpp +++ b/arangod/VocBase/replication-applier.cpp @@ -1469,7 +1469,7 @@ void TRI_replication_applier_t::toVelocyPack(VPackBuilder& builder) const { // add server info builder.add("server", VPackValue(VPackValueType::Object)); builder.add("version", VPackValue(TRI_VERSION)); - builder.add("serverId", VPackValue(TRI_StringUInt64(TRI_GetIdServer()))); + builder.add("serverId", VPackValue(std::to_string(TRI_GetIdServer()))); builder.close(); // server if (config._endpoint != nullptr) { diff --git a/js/client/modules/@arangodb/testing.js b/js/client/modules/@arangodb/testing.js index 7a09d8d71f..23b7dba3df 100644 --- a/js/client/modules/@arangodb/testing.js +++ b/js/client/modules/@arangodb/testing.js @@ -329,6 +329,10 @@ function readImportantLogLines(logPath) { /// # and know the PID plus the process name for later use. /// kernel.core_uses_pid = 1 /// kernel.core_pattern = /var/tmp/core-%e-%p-%t +/// +/// If you set coreDirectory to empty, this behavior is changed: The core file +/// expected to be named simply "core" and should exist in the current +/// directory. //////////////////////////////////////////////////////////////////////////////// function analyzeCoreDump(instanceInfo, options, storeArangodPath, pid) { @@ -340,7 +344,12 @@ function analyzeCoreDump(instanceInfo, options, storeArangodPath, pid) { command += "echo quit;"; command += "sleep 2"; command += ") | gdb " + storeArangodPath + " "; - command += options.coreDirectory + "/*core*" + pid + '*'; + + if (options.coreDirectory === "") { + command += "core"; + } else { + command += options.coreDirectory + "/*core*" + pid + '*'; + } const args = ['-c', command]; print(JSON.stringify(args)); @@ -408,9 +417,12 @@ function checkInstanceAliveSingleServer(instanceInfo, options) { print("Core dump written; copying arangod to " + instanceInfo.tmpDataDir + " for later analysis."); + let corePath = (options.coreDirectory === "") ? + "core" : + options.coreDirectory + "/core*" + instanceInfo.pid.pid + "*'"; + res.gdbHint = "Run debugger with 'gdb " + - storeArangodPath + " " + options.coreDirectory + - "/core*" + instanceInfo.pid.pid + "*'"; + storeArangodPath + " " + corePath; if (require("internal").platform.substr(0, 3) === 'win') { // Windows: wait for procdump to do its job... diff --git a/lib/Basics/Exceptions.cpp b/lib/Basics/Exceptions.cpp index 817491a4f3..9cad09e8e9 100644 --- a/lib/Basics/Exceptions.cpp +++ b/lib/Basics/Exceptions.cpp @@ -46,17 +46,36 @@ Exception::Exception(int code, char const* file, int line) _file(file), _line(line), _code(code) { -#ifdef TRI_ENABLE_MAINTAINER_MODE -#if HAVE_BACKTRACE - if (WithBackTrace) { - _errorMessage += std::string("\n\n"); - TRI_GetBacktrace(_errorMessage); - _errorMessage += std::string("\n\n"); - } -#endif -#endif + + appendLocation(); } +//////////////////////////////////////////////////////////////////////////////// +/// @brief constructor, for creating an exception with an already created +/// error message (normally based on error templates containing %s, %d etc.) +//////////////////////////////////////////////////////////////////////////////// + +Exception::Exception(int code, std::string const& errorMessage, + char const* file, int line) + : _errorMessage(errorMessage), _file(file), _line(line), _code(code) { + + appendLocation(); +} + +//////////////////////////////////////////////////////////////////////////////// +/// @brief constructor, for creating an exception with an already created +/// error message (normally based on error templates containing %s, %d etc.) +//////////////////////////////////////////////////////////////////////////////// + +Exception::Exception(int code, char const* errorMessage, char const* file, + int line) + : _errorMessage(errorMessage), _file(file), _line(line), _code(code) { + + appendLocation(); +} + +Exception::~Exception() throw() {} + //////////////////////////////////////////////////////////////////////////////// /// @brief returns the error message //////////////////////////////////////////////////////////////////////////////// @@ -75,52 +94,32 @@ int Exception::code() const throw() { return _code; } void Exception::addToMessage(std::string const& more) { _errorMessage += more; } -//////////////////////////////////////////////////////////////////////////////// -/// @brief constructor, for creating an exception with an already created -/// error message (normally based on error templates containing %s, %d etc.) -//////////////////////////////////////////////////////////////////////////////// - -Exception::Exception(int code, std::string const& errorMessage, - char const* file, int line) - : _errorMessage(errorMessage), _file(file), _line(line), _code(code) { -#ifdef TRI_ENABLE_MAINTAINER_MODE -#if HAVE_BACKTRACE - if (WithBackTrace) { - _errorMessage += std::string("\n\n"); - TRI_GetBacktrace(_errorMessage); - _errorMessage += std::string("\n\n"); - } -#endif -#endif -} - -//////////////////////////////////////////////////////////////////////////////// -/// @brief constructor, for creating an exception with an already created -/// error message (normally based on error templates containing %s, %d etc.) -//////////////////////////////////////////////////////////////////////////////// - -Exception::Exception(int code, char const* errorMessage, char const* file, - int line) - : _errorMessage(errorMessage), _file(file), _line(line), _code(code) { -#ifdef TRI_ENABLE_MAINTAINER_MODE -#if HAVE_BACKTRACE - if (WithBackTrace) { - _errorMessage += std::string("\n\n"); - TRI_GetBacktrace(_errorMessage); - _errorMessage += std::string("\n\n"); - } -#endif -#endif -} - -Exception::~Exception() throw() {} - //////////////////////////////////////////////////////////////////////////////// /// @brief return exception message //////////////////////////////////////////////////////////////////////////////// char const* Exception::what() const throw() { return _errorMessage.c_str(); } +//////////////////////////////////////////////////////////////////////////////// +/// @brief append original error location to message +//////////////////////////////////////////////////////////////////////////////// + +void Exception::appendLocation () { + if (_code == TRI_ERROR_INTERNAL) { + _errorMessage += std::string(" (location: ") + _file + ":" + std::to_string(_line) + "). Please report this error to arangodb.com"; + } + +#ifdef TRI_ENABLE_MAINTAINER_MODE +#if HAVE_BACKTRACE + if (WithBackTrace) { + _errorMessage += std::string("\n\n"); + TRI_GetBacktrace(_errorMessage); + _errorMessage += std::string("\n\n"); + } +#endif +#endif +} + //////////////////////////////////////////////////////////////////////////////// /// @brief construct an error message from a template string //////////////////////////////////////////////////////////////////////////////// diff --git a/lib/Basics/Exceptions.h b/lib/Basics/Exceptions.h index 10e772f248..c8eac8cb3d 100644 --- a/lib/Basics/Exceptions.h +++ b/lib/Basics/Exceptions.h @@ -100,6 +100,8 @@ class Exception : public virtual std::exception { std::string message() const throw(); int code() const throw(); void addToMessage(std::string const&); + private: + void appendLocation (); protected: std::string _errorMessage;