GitHub user guozhangwang opened a pull request:
https://github.com/apache/kafka/pull/3275
HOTFIX: use atomic boolean for inject errors in streams eos integration test
Originally we assume the task will be created exactly three times (twice
upon starting up, once for each thread, and then one more time when rebalancing
upon the thread failure). However there is a likelihood that upon starting up
more than one rebalance will be triggered, and hence the tasks will be
initialized more than 3 times, i.e. there will be more than three hashcodes of
the `Transformer` object, causing the `errorInjected` to never be taken and
exception never thrown.
The current fix is to use an atomic boolean instead and let threads compete
on compare-and-set to make sure exactly one thread will throw exception, and
will only throw once.
Without this patch I can reproduce the issue on my local machine with a
single core ever 3-5 times; with this patch I have been running successfully
for 10+ runs.
Ping @mjsax @ijuma for reviews.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/guozhangwang/kafka
KHotfix-eos-integration-test
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/kafka/pull/3275.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 #3275
commit ef0d8440a880ecdd93db3c043e4f9e6467e3aac3
Author: Guozhang Wang
Date: 2017-06-08T23:36:27Z
use atomic boolean for inject errors
---
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.
---