unlizhao opened a new pull request #9817: URL: https://github.com/apache/kafka/pull/9817
According to the idea of #7967, it made BufferPool support closing. Now, there are two places in the BufferPool#allocate() method to judge the 'closed' flag. One is when 'lock' is acquired, and the other is when 'condition' is awakened. However, if the memory is allocated outside the 'lock' code block after 'freeup', Therefore, it is possible for another thread to modify the 'closed' flag, causing this part of memory to be allocated in vain. So two modifications have been made, One is to add the 'volatile' modifier before 'closed', One is to determine whether to 'closed' before allocating memory. ---------------------------------------------------------------- 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: [email protected]
