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

ConcurrentModificationException while processing connection setup timeouts

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.7.0
    • Component/s: network
    • Labels:
      None

      Description

      From Guozhang Wang in https://github.com/apache/kafka/pull/8683:

      java.util.ConcurrentModificationException
      at java.util.HashMap$HashIterator.nextNode(HashMap.java:1445)
      at java.util.HashMap$KeyIterator.next(HashMap.java:1469)
      at org.apache.kafka.clients.NetworkClient.handleTimedOutConnections(NetworkClient.java:822)
      at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:574)
      at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.poll(ConsumerNetworkClient.java:265)
      at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.poll(ConsumerNetworkClient.java:236)
      at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.poll(ConsumerNetworkClient.java:215)
      at org.apache.kafka.clients.consumer.internals.AbstractCoordinator.joinGroupIfNeeded(AbstractCoordinator.java:419)
      at org.apache.kafka.clients.consumer.internals.AbstractCoordinator.ensureActiveGroup(AbstractCoordinator.java:359)

      While processing connection set up timeouts, we are iterating through the connecting nodes to process timeouts and we disconnect within the loop, removing the entry from the set in the loop that it iterating over the set:

          for (String nodeId : connectingNodes) {
                  if (connectionStates.isConnectionSetupTimeout(nodeId, now)) {
                      this.selector.close(nodeId);
                      log.debug(
                          "Disconnecting from node {} due to socket connection setup timeout. " +
                          "The timeout value is {} ms.",
                          nodeId,
                          connectionStates.connectionSetupTimeoutMs(nodeId));
                      processDisconnection(responses, nodeId, now, ChannelState.LOCAL_CLOSE);
                  }
          }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dajac David Jacot
                Reporter:
                rsivaram Rajini Sivaram
                Reviewer:
                Rajini Sivaram
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: