The test out_max_time_ms.js runs some test logic against both a standalone node as well as a two-node replica set. The test also depends on enabling the "maxTimeNeverTimeOut" failpoint on the nodes involved in the test. This is done in order to prevent operations with a maxTimeMS from timing out prematurely.
In the case of testing against a replica set, however, there are scenarios in which the test can fail to enable "maxTimeNeverTimeOut" against all of the nodes in the replica set. In particular, this assertion passes the same connection three times to the forceAggregationToHangAndCheckMaxTimeMsExpires(). The helper function then enables the failpoint on the passed in connections. But if both of these connections are to the secondary node, for example, then the failpoint is left disabled on the primary. This can result in operations timing out prematurely, which in turn can cause the test to hang for 10 minutes and fail on an assert.soon() here.
We should change the test logic so that it unconditionally enables/disables the failpoint for both nodes in the replica set, making it impossible to leave any failpoint in the wrong state.