confluentinc / kafka-connect-hdfs

Kafka Connect HDFS connector

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

java.util.ConcurrentModificationException during task rebalancing

smj19 opened this issue · comments

commented

We're using 5.4.3 version of Confluent and observed that during a task rebalancing, it threw the below exception for multiple partitions:

[ERROR] 2021-12-12 03:34:16,891 org.apache.kafka.connect.runtime.WorkerTask doRun - WorkerSinkTask{id=hdfs-connector-prod-399} Task threw an uncaught and unrecoverable exception
java.util.ConcurrentModificationException
	at java.util.HashMap$HashIterator.nextNode(Unknown Source)
	at java.util.HashMap$KeyIterator.next(Unknown Source)
	at io.confluent.connect.hdfs.TopicPartitionWriter.close(TopicPartitionWriter.java:463)
	at io.confluent.connect.hdfs.DataWriter.close(DataWriter.java:457)
	at io.confluent.connect.hdfs.HdfsSinkTask.close(HdfsSinkTask.java:161)

It looks like this is thrown in this for loop
https://github.com/confluentinc/kafka-connect-hdfs/blob/5.4.3-post/src/main/java/io/confluent/connect/hdfs/TopicPartitionWriter.java#L463
It is looping over writers Map and also removing the encodedPartition from the Map here

io.confluent.connect.storage.format.RecordWriter writer = writers.remove(encodedPartition);

Could that be the reason for this exception?

commented

Can someone help with this, please? We're seeing this issue in Production.