init.cpp:1635 prints mapBlockIndex.size() without cs_main. This is technically a race (though it is rather inconsequential). At some point someone should fix this so tsan stops complaining.
CBlockIndex *pindexWalk = chainActive.Tip();
        pindexWalk->nStatus |= BLOCK_FAILED_CHILD;
        setDirtyBlockIndex.insert(pindexWalk);
        setBlockIndexCandidates.erase(pindexWalk);
        
        
        if (!DisconnectTip(state, chainparams, &disconnectpool)) {
            
            
            UpdateMempoolForReorg(disconnectpool, false);
            return false;
        }
    }
    
    
    UpdateMempoolForReorg(disconnectpool, true);
    
    
    BlockMap::iterator it = mapBlockIndex.begin();
    while (it != mapBlockIndex.end()) {
        if (it->second->IsValid(BLOCK_VALID_TRANSACTIONS) && it->second->nChainTx && !setBlockIndexCandidates.value_comp()(it->second, chainActive.Tip())) {
            setBlockIndexCandidates.insert(it->second);
        }
        it++;
    }
    InvalidChainFound(pindex);
    uiInterface.NotifyBlockTip(IsInitialBlockDownload(), pindex->pprev);
    return true;
}
bool ResetBlockFailureFlags(CBlockIndex *pindex) {