Co-authored-by: Gregory Noma <gregory.noma@gmail.com> Co-authored-by: Alyssa Clark <alyssa.clark@mongodb.com> Co-authored-by: Thomas Goyne <thomas.goyne@mongodb.com> Co-authored-by: Philip Stoev <philip.stoev@mongodb.com> Co-authored-by: Joan Bruguera Micó (at MongoDB) <joan.bruguera-mico@mongodb.com> Co-authored-by: Matthew Boros <mattBoros@users.noreply.github.com> Co-authored-by: Finley Lau <finley.lau@mongodb.com> Co-authored-by: Daniel Moody <dmoody256@gmail.com> Co-authored-by: Ted Tuckman <TedTuckman@users.noreply.github.com> Co-authored-by: Yuhong Zhang <yuhong.zhang@mongodb.com> Co-authored-by: Copilot <copilot@github.com> GitOrigin-RevId: 0a318ad31b0a7881549f93fb6bc0dd4cb57934e3
42 lines
1.3 KiB
JavaScript
42 lines
1.3 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: [
|
|
// # The test runs commands that are not allowed with security token: mapReduce.
|
|
// not_allowed_with_signed_security_token,
|
|
// does_not_support_stepdowns,
|
|
// requires_non_retryable_commands,
|
|
// uses_map_reduce_with_temp_collections,
|
|
// # This test has statements that do not support non-local read concern.
|
|
// does_not_support_causal_consistency,
|
|
// requires_scripting,
|
|
// # Time-series collections are views which don't support map-reduce
|
|
// exclude_from_timeseries_crud_passthrough,
|
|
// # TODO SERVER-116053: Add support for mapReduce.
|
|
// mozjs_wasm_unsupported,
|
|
// ]
|
|
|
|
db.recursion.drop();
|
|
|
|
// Make sure the shell doesn't blow up.
|
|
function shellRecursion() {
|
|
shellRecursion.apply();
|
|
}
|
|
assert.throws(shellRecursion);
|
|
|
|
// Make sure server side stack overflow doesn't blow up.
|
|
function mapReduceRecursion() {
|
|
db.recursion.mapReduce(
|
|
function () {
|
|
(function recursion() {
|
|
recursion.apply();
|
|
})();
|
|
},
|
|
function () {},
|
|
{out: {merge: "out_coll"}},
|
|
);
|
|
}
|
|
|
|
assert.commandWorked(db.recursion.insert({}));
|
|
assert.commandFailedWithCode(assert.throws(mapReduceRecursion), ErrorCodes.JSInterpreterFailure);
|