Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ConcurrentModificationException in IncrementalPublishingKafkaIndexTaskRunner #5907

Merged
merged 2 commits into from
Jul 1, 2018

Conversation

jihoonson
Copy link
Contributor

@jihoonson jihoonson commented Jun 27, 2018

Fixes #5745.


This change is Reviewable

@@ -1504,7 +1505,7 @@ public DateTime getStartTime(@Context final HttpServletRequest req)
private final int sequenceId;
private final String sequenceName;
private final Map<Integer, Long> startOffsets;
private final Map<Integer, Long> endOffsets;
private final ConcurrentHashMap<Integer, Long> endOffsets;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include a comment that explains two things:

  1. why this is a ConcurrentHashMap
  2. who is allowed to modify it (do you need to be a specific thread or acquire a specific lock)? I bet that if multiple threads modify this concurrently then unexpected things will happen.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the problem is that setEndOffsets() can be called by both the main thread and the http thread. Actually setEndOffsets() also sets checkpointed variable too, so I changed to acquire a lock before modifying endOffsets and checkpointed variables.

I bet that if multiple threads modify this concurrently then unexpected things will happen.

I have no idea about this.

@gianm gianm merged commit b76a056 into apache:master Jul 1, 2018
@jihoonson jihoonson added this to the 0.12.2 milestone Jul 3, 2018
jihoonson added a commit to implydata/druid-public that referenced this pull request Jul 3, 2018
…xTaskRunner (apache#5907)

* Fix ConcurrentModificationException in IncrementalPublishingKafkaIndexTaskRunner

* fix lock and add comments
gianm added a commit to implydata/druid-public that referenced this pull request Jul 5, 2018
…xTaskRunner (apache#5907)

Ported without cherry-pick, since the original commit depends on the patch that
splits KafkaIndexTask.
jihoonson pushed a commit to jihoonson/druid that referenced this pull request Jul 7, 2018
…xTaskRunner (apache#5907)

Ported without cherry-pick, since the original commit depends on the patch that
splits KafkaIndexTask.
jihoonson added a commit that referenced this pull request Jul 9, 2018
…xTaskRunner (#5907) (#5973)

Ported without cherry-pick, since the original commit depends on the patch that
splits KafkaIndexTask.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants