[
https://issues.apache.org/jira/browse/KAFKA-5417?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ismael Juma updated KAFKA-5417:
-------------------------------
Fix Version/s: 0.11.0.0
> Clients get inconsistent connection states when SASL/SSL connection is marked
> CONECTED and DISCONNECTED at the same time
> ------------------------------------------------------------------------------------------------------------------------
>
> Key: KAFKA-5417
> URL: https://issues.apache.org/jira/browse/KAFKA-5417
> Project: Kafka
> Issue Type: Bug
> Components: clients
> Affects Versions: 0.10.2.1
> Reporter: dongeforever
> Priority: Critical
> Fix For: 0.11.0.0, 0.10.2.2
>
>
> 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
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)