Skip to content

Fix ConcurrentModificationException in IncrementalPublishingKafkaIndexTaskRunner#5907

Merged
gianm merged 2 commits intoapache:masterfrom
jihoonson:druid-5745
Jul 1, 2018
Merged

Fix ConcurrentModificationException in IncrementalPublishingKafkaIndexTaskRunner#5907
gianm merged 2 commits intoapache:masterfrom
jihoonson:druid-5745

Conversation

@jihoonson
Copy link
Copy Markdown
Contributor

@jihoonson jihoonson commented Jun 27, 2018

Fixes #5745.


This change is Reviewable

private final String sequenceName;
private final Map<Integer, Long> startOffsets;
private final Map<Integer, Long> endOffsets;
private final ConcurrentHashMap<Integer, Long> endOffsets;
Copy link
Copy Markdown
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
Copy Markdown
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.

2 participants