Description
We have the following access pattern that can introduce a deadlock.
AbstractFetcherThread.processPartitionsWithError() ->
ConsumerFetcherThread.processPartitionsWithError() ->
ConsumerFetcherManager.addPartitionsWithError() wait for lock ->
LeaderFinderThread holding lock while calling AbstractFetcherManager.shutdownIdleFetcherThreads() ->
AbstractFetcherManager calling fetcher.shutdown, which needs to wait until AbstractFetcherThread.processPartitionsWithError() completes.