diff options
author | Jason Carey <jcarey@argv.me> | 2016-02-05 16:11:10 -0500 |
---|---|---|
committer | Jason Carey <jcarey@argv.me> | 2016-02-08 10:53:15 -0500 |
commit | 93f767caeebda5ffd295f935e734e0bf02da3356 (patch) | |
tree | bcb35174eb0270d773b2fcfdcf49a226732dad50 | |
parent | 38cd69968a54a3a72b9c83f0bcdbc5acac03785a (diff) | |
download | mongo-93f767caeebda5ffd295f935e734e0bf02da3356.tar.gz |
SERVER-22349 Throw interruptions from loadStored
The JS engine's loadStored eats exceptions that occur while it's loading
functions from system.js. This also eats interruption exceptions, which
can lead to a situation where a map reduce job is killed during
loadStored, but the interrupt is lost. For tests where the map or reduce
stages are long or non-terminating, and we rely on killing them, this
can lead to hangs.
Re-throwing interrupts from the try/catch block around loadStored fixes
this behavior.
-rw-r--r-- | src/mongo/scripting/engine.cpp | 4 | ||||
-rw-r--r-- | src/mongo/scripting/mozjs/implscope.cpp | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/mongo/scripting/engine.cpp b/src/mongo/scripting/engine.cpp index 632957a5d08..1bee97838f8 100644 --- a/src/mongo/scripting/engine.cpp +++ b/src/mongo/scripting/engine.cpp @@ -231,6 +231,10 @@ void Scope::loadStored(OperationContext* txn, bool ignoreNotConnected) { thisTime.insert(n.valuestr()); _storedNames.insert(n.valuestr()); } catch (const DBException& setElemEx) { + if (setElemEx.getCode() == ErrorCodes::Interrupted) { + throw; + } + error() << "unable to load stored JavaScript function " << n.valuestr() << "(): " << setElemEx.what() << endl; } diff --git a/src/mongo/scripting/mozjs/implscope.cpp b/src/mongo/scripting/mozjs/implscope.cpp index 903b46529ef..52e3af75ca6 100644 --- a/src/mongo/scripting/mozjs/implscope.cpp +++ b/src/mongo/scripting/mozjs/implscope.cpp @@ -185,7 +185,7 @@ bool MozJSImplScope::_interruptCallback(JSContext* cx) { if (scope->_hasOutOfMemoryException) { scope->_status = Status(ErrorCodes::JSInterpreterFailure, "Out of memory"); } else if (scope->isKillPending()) { - scope->_status = Status(ErrorCodes::JSInterpreterFailure, "Interrupted by the host"); + scope->_status = Status(ErrorCodes::Interrupted, "Interrupted by the host"); } if (!scope->_status.isOK()) { |