summaryrefslogtreecommitdiff
path: root/jstests/noPassthroughWithMongod
diff options
context:
space:
mode:
authorJonathan Reams <jbreams@mongodb.com>2016-10-12 12:15:00 -0400
committerJonathan Reams <jbreams@mongodb.com>2016-10-13 10:35:47 -0400
commit0344a7542f9318730cce289fe143295f6f99b4f8 (patch)
tree8dffa477f0ce2289391c7fc258cb4302d2f14fe8 /jstests/noPassthroughWithMongod
parentc3b7879a289740cd7acbdd066329a67664694b03 (diff)
downloadmongo-0344a7542f9318730cce289fe143295f6f99b4f8.tar.gz
SERVER-26596 Don't abort when javascript heap limit is set too low to initialize spidermonkey
Diffstat (limited to 'jstests/noPassthroughWithMongod')
-rw-r--r--jstests/noPassthroughWithMongod/low_js_heap_limit.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/jstests/noPassthroughWithMongod/low_js_heap_limit.js b/jstests/noPassthroughWithMongod/low_js_heap_limit.js
new file mode 100644
index 00000000000..9eb644271d4
--- /dev/null
+++ b/jstests/noPassthroughWithMongod/low_js_heap_limit.js
@@ -0,0 +1,13 @@
+// SERVER-26596 This tests that you can set a very low heap limit for javascript, and that it will
+// fail to run any javascript, but won't crash the server.
+(function() {
+ 'use strict';
+
+ assert.commandWorked(db.adminCommand({setParameter: 1, jsHeapLimitMB: 1}));
+
+ assert.commandFailedWithCode(db.runCommand({$eval: 'sleep(10000);'}),
+ ErrorCodes.ExceededMemoryLimit);
+
+ var returnCode = runProgram("mongo", "--jsHeapLimitMB=1", "--nodb", "--eval='exit();'");
+ assert.eq(returnCode, 1);
+}());