summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2018-11-19 12:04:22 -0500
committerMark Benvenuto <mark.benvenuto@mongodb.com>2018-11-21 13:35:54 -0500
commitf5b4471bc5d0bee53474456761417222ddd4654e (patch)
tree14c5564a8d59804654eb01baec39c23bb33177a6 /src/mongo
parentebd39fc0df856937c0be9d5c686f841ef02abb55 (diff)
downloadmongo-f5b4471bc5d0bee53474456761417222ddd4654e.tar.gz
SERVER-36740 Sometimes crashes on windows don't provide a backtrace
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/scripting/mozjs/implscope.cpp12
-rw-r--r--src/mongo/scripting/mozjs/implscope.h2
2 files changed, 14 insertions, 0 deletions
diff --git a/src/mongo/scripting/mozjs/implscope.cpp b/src/mongo/scripting/mozjs/implscope.cpp
index abdc627a530..85eba66d5f9 100644
--- a/src/mongo/scripting/mozjs/implscope.cpp
+++ b/src/mongo/scripting/mozjs/implscope.cpp
@@ -124,6 +124,14 @@ struct MozJSImplScope::MozJSEntry {
void MozJSImplScope::_reportError(JSContext* cx, const char* message, JSErrorReport* report) {
auto scope = getScope(cx);
+ // If we are recursively calling _reportError because of ReportOverRecursed, lets just quit now
+ if (scope->_inReportError) {
+ return;
+ }
+
+ scope->_inReportError = true;
+ const auto guard = MakeGuard([&] { scope->_inReportError = false; });
+
if (!JSREPORT_IS_WARNING(report->flags)) {
std::string exceptionMsg;
@@ -394,6 +402,9 @@ MozJSImplScope::MozRuntime::MozRuntime(const MozJSScriptEngine* engine) {
// stored on the stack which increases the stack pressure. It does not affects non-debug
// builds.
const decltype(available_stack_space) reserve_stack_space = 96 * 1024;
+#elif defined(_WIN32)
+ // Windows is greedy for stack space while processing exceptions.
+ const decltype(available_stack_space) reserve_stack_space = 96 * 1024;
#else
const decltype(available_stack_space) reserve_stack_space = 64 * 1024;
#endif
@@ -433,6 +444,7 @@ MozJSImplScope::MozJSImplScope(MozJSScriptEngine* engine)
_generation(0),
_requireOwnedObjects(false),
_hasOutOfMemoryException(false),
+ _inReportError(false),
_binDataProto(_context),
_bsonProto(_context),
_codeProto(_context),
diff --git a/src/mongo/scripting/mozjs/implscope.h b/src/mongo/scripting/mozjs/implscope.h
index 6ea7c91264a..7e129477b0f 100644
--- a/src/mongo/scripting/mozjs/implscope.h
+++ b/src/mongo/scripting/mozjs/implscope.h
@@ -428,6 +428,8 @@ private:
bool _requireOwnedObjects;
bool _hasOutOfMemoryException;
+ bool _inReportError;
+
WrapType<BinDataInfo> _binDataProto;
WrapType<BSONInfo> _bsonProto;
WrapType<CodeInfo> _codeProto;