PYTHON-6226ClosedFixed
AsyncMongoClient stays stuck in ReplicaSetNoPrimary after a monitor task cancels itself
h3. Description We hit this in production when a replica set node ran out of memory (OOM) and restarted. The client kept failing server selection and only recovered after the client process was restarted. We verified that the bug described below was the cause. If a server's own {{hello}} response removes it from the topology, {{_update_servers()}} closes that server from inside its own monitor task. {{AsyncPeriodicExecutor.close()}} then cancels the current task: {{CancelledError}}