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

Clients get inconsistent connection states when SASL/SSL connection is marked CONECTED and DISCONNECTED at the same time

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 0.10.2.1
    • 0.11.0.1, 1.0.0
    • clients
    • None

    Description

      Assume the SASL or SSL Connection is established successfully, but be reset when writing data into it (This will happen frequently in LVS Proxy environment )
      Selecter poll will act like follows:
      try {
      ...
      //finish connect successfully
      if (channel.finishConnect())

      { this.connected.add(channel.id()); (1) }

      //the prepare will fail, for sasl or ssl will do handshake and write data
      //throw exception
      if (channel.isConnected() && !channel.ready())
      channel.prepare();
      ....
      } catch {
      close(channel);
      this.disconnected.add(channel.id()); (2)
      }

      The code line named (1) and (2) will mark the connection CONNECTED and DISCONNECTED at the same time.

      And the NetworkClient poll will:
      handleDisconnections(responses, updatedNow); //remove the channel
      handleConnections(); //mark the channel CONNECTED

      So get the inconsistent ConnectionStates, and such state will block the messages sent into this channel in Sender:
      For the channel will never be ready and never be connected again:

      public boolean ready(Node node, long now)

      { if (node.isEmpty()) throw new IllegalArgumentException("Cannot connect to empty node " + node); //return false, for the channel dose not exist actually if (isReady(node, now)) return true; //return false, for the channel is marked CONNECTED if (connectionStates.canConnect(node.idString(), now)) // if we are interested in sending to a node and we don't have a connection to it, initiate one initiateConnect(node, now); return false; }

      So all messages sent to such channel will be expired eventually

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            zander dongeforever
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment