Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-17223

Retrying the call after encoutering UnsupportedVersionException will cause ConcurrentModificationException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 3.9.0
    • admin, clients
    • None

    Description

      [2024-07-31 07:11:03,928] ERROR Uncaught exception in thread 'kafka-admin-client-thread | adminclient-1': (org.apache.kafka.common.utils.KafkaThread:51)
      java.util.ConcurrentModificationException
      	at java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1013)
      	at java.base/java.util.ArrayList$Itr.remove(ArrayList.java:981)
      	at org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.maybeDrainPendingCalls(KafkaAdminClient.java:1207)
      	at org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.processRequests(KafkaAdminClient.java:1510)
      	at org.apache.kafka.clients.admin.KafkaAdminClient$AdminClientRunnable.run(KafkaAdminClient.java:1464)
      	at java.base/java.lang.Thread.run(Thread.java:840)
      

      The steps producing above error are shown below.

      1. maybeDrainPendingCall[0] encounter error when calling `call.nodeProvider.provide();`[1]
      2. `runnable.pendingCalls.add(this)`[2] adds the call back to `pendingCalls`
      3. `pendingIter.remove();` tries to remove item from the modified array list.

      IMHO, we should add call back to `newCalls` rather than `pendingCalls`. This approach is to revert a part of KAFKA-12432

      [0] https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java#L1206
      [1] https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java#L1219
      [2] https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java#L927
      [3] https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java#L1219

      Attachments

        Issue Links

          Activity

            People

              yangpoan PoAn Yang
              chia7712 Chia-Ping Tsai
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: