summaryrefslogtreecommitdiff
path: root/jstests/replsets
diff options
context:
space:
mode:
authorVesselina Ratcheva <vesselina.ratcheva@10gen.com>2022-03-28 14:10:08 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-03-28 16:20:39 +0000
commit4f57c205480557f133535c65f743b88414d32280 (patch)
treedd1b71b81de3434b2c7207813549dd76e1607253 /jstests/replsets
parente6bae62861fbc97245fadd2efff98e2fc15ab250 (diff)
downloadmongo-4f57c205480557f133535c65f743b88414d32280.tar.gz
SERVER-61117 Prevent uncaught errors in ReplicationCoordinatorImpl::startLoadLocalConfig from causing server hangs
Diffstat (limited to 'jstests/replsets')
-rw-r--r--jstests/replsets/repl_startup_error_no_hang_on_shutdown.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/jstests/replsets/repl_startup_error_no_hang_on_shutdown.js b/jstests/replsets/repl_startup_error_no_hang_on_shutdown.js
new file mode 100644
index 00000000000..61160705195
--- /dev/null
+++ b/jstests/replsets/repl_startup_error_no_hang_on_shutdown.js
@@ -0,0 +1,50 @@
+/**
+ * Tests that errors generated as part of ReplicationCoordinatorImpl startup do not cause the server
+ * to hang during shutdown.
+ *
+ * @tags: [requires_persistence, requires_fcv_53]
+ */
+
+(function() {
+"use strict";
+
+load("jstests/libs/fail_point_util.js");
+
+const name = jsTestName();
+const rst = new ReplSetTest({
+ name: jsTestName(),
+ nodes: [{
+ setParameter: {
+ "failpoint.throwBeforeRecoveringTenantMigrationAccessBlockers":
+ tojson({mode: "alwaysOn"})
+ }
+ }],
+});
+rst.startSet();
+rst.initiate();
+
+let primary = rst.getPrimary();
+
+jsTestLog("Done initiating set. Restarting.");
+
+const exitCode = MongoRunner.EXIT_ABRUPT;
+let exceptionThrown = false;
+try {
+ rst.restart(0, {
+ startClean: false,
+ });
+} catch (e) {
+ assert(e.message.includes("MongoDB process stopped with exit code: " + exitCode),
+ () => tojson(e));
+ exceptionThrown = true;
+}
+
+assert.soon(
+ function() {
+ return rawMongoProgramOutput().search(/Fatal assertion.*6111701/) >= 0;
+ },
+ "Node should have fasserted upon encountering a fatal error during startup",
+ ReplSetTest.kDefaultTimeoutMS);
+
+assert(exceptionThrown, "Expected restart to fail.");
+})();