Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-986

In QuoromCnxManager we are adding sent messgae to lastMessageSent, but we are never removing that message from it after sending it, so this will lead to sending the same message again in next round

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Not A Problem
    • Affects Version/s: 3.3.2
    • Fix Version/s: 3.5.0
    • Component/s: quorum
    • Labels:
    • Environment:

      Windows

      Description

      Function for sending out the notification message to corresponding peer for leader election

      private void processMessages() throws Exception {
      try {
      ByteBuffer b = getLastMessageSent(sid);
      if (b != null)

      { send(b); }
      } catch (IOException e) { LOG.error("Failed to send last message to " + sid, e); throw e; }
      try {
      ArrayBlockingQueue<ByteBuffer> bq = queueSendMap.get(sid);
      if (bq == null) { dumpQueueSendMap(); throw new Exception("No queue for incoming messages for " + "sid=" + sid); }
      while (running && !shutdown && sock != null) {
      ByteBuffer b = null;
      try {
      b = bq.poll(1000, TimeUnit.MILLISECONDS);
      if(b != null){ recordLastMessageSent(sid, b); send(b); }
      } catch (InterruptedException e) { LOG.warn("Interrupted while waiting for message on " + "queue", e); }
      }
      } catch (Exception e) { LOG.warn("Exception when using channel: for id " + sid + " my id = " + self.getId() + " error = ", e); throw e; }
      }

      This is the code taken from zookeeper patch 932.
      Here we are adding the message to be sent in current round to lastMessageSent. But in next round that message will still be there. So when we try to send a new message to server it will again do

      ByteBuffer b = getLastMessageSent(sid);
      if (b != null) { send(b); }

      and it will again send back that old message to that server. So in this way it will send back every message twice. Though it will not affect the correctness of FLE but sending message twice it create an extra overhead and slow down the election process.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              sandep.amit Sandeep Maheshwari
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: