mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-25 01:19:02 +00:00
The iteration over `timeoutClusterStateListeners` starts when the CS applier thread is still running. This can lead to entries being added to it that never get their listener resolved on shutdown and thus leak that listener as observed in a stuck test in #62863. Since `listener.onClose()` is idempotent we can just call it if we run into a stopped service on the CS thread to avoid the race with certainty (because the iteration in `doStop` starts after the stopped state has been set). Closes #62863