chia7712 commented on a change in pull request #9887: URL: https://github.com/apache/kafka/pull/9887#discussion_r557479126
########## File path: streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java ########## @@ -951,12 +948,15 @@ private StreamThread createAndAddStreamThread(final long cacheSizePerThread, fin if (isRunningOrRebalancing()) { final int threadIdx; final long cacheSizePerThread; + final StreamThread streamThread; synchronized (changeThreadCount) { threadIdx = getNextThreadIndex(); cacheSizePerThread = getCacheSizePerThread(threads.size() + 1); resizeThreadCache(cacheSizePerThread); + // Creating thread should hold the lock in order to avoid duplicate thread index. + // If the duplicate index happen, the metadata of thread may be duplicate too. + streamThread = createAndAddStreamThread(cacheSizePerThread, threadIdx); Review comment: fix for case 2) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org