summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2015-10-13 15:28:45 -0400
committerAndrew Morrow <acm@mongodb.com>2015-10-13 16:44:10 -0400
commit804f8c7b926f999cd1eeaf4ebe50dfb99f7acfad (patch)
tree1236a90fb4867177714a53d413206c0c2d77545e
parent15350b5087dfd09cb2b25a22f422804abc8c2654 (diff)
downloadmongo-804f8c7b926f999cd1eeaf4ebe50dfb99f7acfad.tar.gz
SERVER-19614 Temporarily disable JS recursion depth protections
-rw-r--r--jstests/core/recursion.js81
-rw-r--r--src/mongo/scripting/mozjs/implscope.cpp10
2 files changed, 50 insertions, 41 deletions
diff --git a/jstests/core/recursion.js b/jstests/core/recursion.js
index dc7b51be845..c35cef4accb 100644
--- a/jstests/core/recursion.js
+++ b/jstests/core/recursion.js
@@ -1,41 +1,46 @@
// Basic tests for a form of stack recursion that's been shown to cause C++
// side stack overflows in the past. See SERVER-19614.
-(function () {
- "use strict";
-
- db.recursion.drop();
-
- // Make sure the shell doesn't blow up
- function shellRecursion() {
- shellRecursion.apply();
- }
- assert.throws(shellRecursion);
-
- // Make sure db.eval doesn't blow up
- function dbEvalRecursion() {
- db.eval(function () {
- function recursion() {
- recursion.apply();
- }
- recursion();
- });
- }
- assert.commandFailedWithCode(assert.throws(dbEvalRecursion), ErrorCodes.JSInterpreterFailure);
-
- // Make sure mapReduce doesn't blow up
- function mapReduceRecursion() {
- db.recursion.mapReduce(function(){
- (function recursion(){
- recursion.apply();
- })();
- }, function(){
- }, {
- out: 'inline'
- });
- }
-
- db.recursion.insert({});
- assert.commandFailedWithCode(
- assert.throws(mapReduceRecursion), ErrorCodes.JSInterpreterFailure);
-}());
+// TODO: Re-enable this test once SERVER-19614 has been resolved in a
+// way that does not conflict with SERVER-20678. See the similar
+// comment in src/mongo/scripting/mozjs/implscope.cpp for additional
+// details.
+//
+// (function () {
+// "use strict";
+//
+// db.recursion.drop();
+//
+// // Make sure the shell doesn't blow up
+// function shellRecursion() {
+// shellRecursion.apply();
+// }
+// assert.throws(shellRecursion);
+//
+// // Make sure db.eval doesn't blow up
+// function dbEvalRecursion() {
+// db.eval(function () {
+// function recursion() {
+// recursion.apply();
+// }
+// recursion();
+// });
+// }
+// assert.commandFailedWithCode(assert.throws(dbEvalRecursion), ErrorCodes.JSInterpreterFailure);
+//
+// // Make sure mapReduce doesn't blow up
+// function mapReduceRecursion() {
+// db.recursion.mapReduce(function(){
+// (function recursion(){
+// recursion.apply();
+// })();
+// }, function(){
+// }, {
+// out: 'inline'
+// });
+// }
+//
+// db.recursion.insert({});
+// assert.commandFailedWithCode(
+// assert.throws(mapReduceRecursion), ErrorCodes.JSInterpreterFailure);
+// }());
diff --git a/src/mongo/scripting/mozjs/implscope.cpp b/src/mongo/scripting/mozjs/implscope.cpp
index aa2cd004d8f..6b10c52f6b0 100644
--- a/src/mongo/scripting/mozjs/implscope.cpp
+++ b/src/mongo/scripting/mozjs/implscope.cpp
@@ -227,9 +227,13 @@ MozJSImplScope::MozRuntime::MozRuntime() {
_runtime = JS_NewRuntime(kMaxBytesBeforeGC);
- static_assert(kMaxStackBytes > (32 * 1024), "kMaxStackBytes must be larger than 32k");
-
- JS_SetNativeStackQuota(_runtime, kMaxStackBytes - (32 * 1024));
+ // TODO: Re-enable this when it can be done in a way that does
+ // not conflict with the performance fix in SERVER-20678. The
+ // jscore/recursion.js tes tshould be re-enabled when this is
+ // uncommented.
+ //
+ // static_assert(kMaxStackBytes > (32 * 1024), "kMaxStackBytes must be larger than 32k");
+ // JS_SetNativeStackQuota(_runtime, kMaxStackBytes - (32 * 1024));
}
uassert(ErrorCodes::JSInterpreterFailure, "Failed to initialize JSRuntime", _runtime);