summaryrefslogtreecommitdiff
path: root/jstests/replsets/repl_startup_error_no_hang_on_shutdown.js
blob: a8ef97020bf5a89b7b6aabf58d1ef0e7dab7cdb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
 * Tests that errors generated as part of ReplicationCoordinatorImpl startup do not cause the server
 * to hang during shutdown.
 *
 * @tags: [requires_persistence, requires_fcv_60]
 */

(function() {
"use strict";

load("jstests/libs/fail_point_util.js");

const rst = new ReplSetTest({
    name: jsTestName(),
    nodes: [{
        setParameter: {
            "failpoint.throwBeforeRecoveringTenantMigrationAccessBlockers":
                tojson({mode: "alwaysOn"})
        }
    }],
});
rst.startSet();
rst.initiate();

jsTestLog("Done initiating set. Stopping node.");

rst.stop(0);

clearRawMongoProgramOutput();

// We set the fail point to make the node encounter a fatal error while trying to load its on-disk
// config. This code does not run before the restart because there is no config on disk yet.
jsTestLog("Restarting node. It should fassert.");
const node = rst.restart(0, {startClean: false, waitForConnect: false});

const exitCode = waitProgram(node.pid);
assert.eq(exitCode, MongoRunner.EXIT_ABRUPT);

assert.soon(
    function() {
        return rawMongoProgramOutput().search(/Fatal assertion.*6111701/) >= 0;
    },
    "Node should have fasserted upon encountering a fatal error during startup",
    ReplSetTest.kDefaultTimeoutMS);
})();