Files
mongo/jstests/core/recursion.js
Max Hirschhorn 35b5b72146 SERVER-32522 Clean up {read,write}Concern and readPreference overrides.
Introduces OverrideHelpers object with convenience methods for
inspecting certain aggregation and map-reduce commands, as well as
overriding startParallelShell(), Mongo.prototype.runCommand(), and
Mongo.prototype.runCommandWithMetadata().

Also removes a number of tests that were incorrectly blacklisted from
the read_concern_majority_passthrough.yml and
read_concern_linearizable_passthrough.yml test suites.
2018-01-30 19:45:42 -05:00

48 lines
1.2 KiB
JavaScript

// Basic tests for a form of stack recursion that's been shown to cause C++ side stack overflows in
// the past. See SERVER-19614.
//
// @tags: [
// does_not_support_stepdowns,
// requires_eval_command,
// requires_non_retryable_commands,
// ]
(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);
}());