GitHub user apurvam opened a pull request: https://github.com/apache/kafka/pull/3132
KAFKA-5147: Add missing synchronization to TransactionManager The basic idea is that exactly three collections, ie. `pendingRequests`, `newPartitionsToBeAddedToTransaction`, and `partitionsInTransaction` are accessed from the context of application threads. The first two are modified from the application threads, and the last is read from those threads. So to make the `TransactionManager` truly thread safe, we have to ensure that all accesses to these three members are done in a synchronized block. I inspected the code, and I believe this patch puts the synchronization in all the correct places. You can merge this pull request into a Git repository by running: $ git pull https://github.com/apurvam/kafka KAFKA-5147-transaction-manager-synchronization-fixes Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/3132.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 #3132 ---- commit 9c869396d09712ebc76ef03c55507cd099b47914 Author: Apurva Mehta <apu...@confluent.io> Date: 2017-05-24T05:28:15Z Add missing synchronization to TransactionManager ---- --- 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. ---