diff options
author | Jason Carey <jcarey@argv.me> | 2016-02-05 16:11:10 -0500 |
---|---|---|
committer | Ramon Fernandez <ramon@mongodb.com> | 2016-02-09 19:25:46 -0500 |
commit | ef07be66578231cc7bb7d2958ccb4fd4ad4dc391 (patch) | |
tree | 8061b498cc5f36e845bec91d3a5eb0b9a2d6821a | |
parent | abe971536f732f7cb1387723d8d60a9300ffc6e3 (diff) | |
download | mongo-ef07be66578231cc7bb7d2958ccb4fd4ad4dc391.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.
(cherry picked from commit 93f767caeebda5ffd295f935e734e0bf02da3356)
-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()) { |