GitHub user tbrooks8 opened a pull request: https://github.com/apache/kafka/pull/1637
KAFKA-2311: Consumer's ensureNotClosed method not thread safe Here is the patch on github @ijuma. Acquiring the consumer lock (the single thread access controls) requires that the consumer be open. I changed the closed variable to be volatile so that another thread's writes will visible to the reading thread. Additionally, there was an additional check if the consumer was closed after the lock was acquired. This check is no longer necessary. This is my original work and I license it to the project under the project's open source license. You can merge this pull request into a Git repository by running: $ git pull https://github.com/tbrooks8/kafka KAFKA-2311 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/1637.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1637 ---- commit 23e457ae0b6008306ea7c4ef6fcd63f409db84a5 Author: Tim Brooks <t...@uncontended.net> Date: 2016-07-19T17:08:18Z Change closed indicator to volatile. Remove unnecessary closed check. ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---