The following test fails reproducibly in current `main` (af071ccc314a0975a9b6e1b6ce7d2a9f92d75a09):

    ./gradlew ':server:test' --tests "org.elasticsearch.cluster.coordination.AtomicRegisterCoordinatorTests.testClusterRecoversAfterExceptionDuringSerialization" -Dtests.seed=E6F4C7552A14BE28
server/src/main/java/org/elasticsearch/gateway/GatewayService.java
protected void doClose() {}
    @Override
    public void clusterChanged(final ClusterChangedEvent event) {
        if (lifecycle.stoppedOrClosed()) {
            return;
        }
        final ClusterState state = event.state();
        if (state.nodes().isLocalNodeElectedMaster() == false) {
            
            return;
        }
        if (state.blocks().hasGlobalBlock(STATE_NOT_RECOVERED_BLOCK) == false) {
            
            return;
        }
        final DiscoveryNodes nodes = state.nodes();
        if (state.nodes().getMasterNodeId() == null) {
            logger.debug("not recovering from gateway, no master elected yet");
        } else if (recoverAfterDataNodes != -1 && nodes.getDataNodes().size() < recoverAfterDataNodes) {
            logger.debug(
                "not recovering from gateway, nodes_size (data) [{}] < recover_after_data_nodes [{}]",
                nodes.getDataNodes().size(),
                recoverAfterDataNodes
            );
        } else {
            boolean enforceRecoverAfterTime;
            String reason;
            if (expectedDataNodes == -1) {
                
                enforceRecoverAfterTime = true;