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



    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Not A Problem
    • 3.3.2
    • 3.5.0
    • quorum
    • Windows


      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.




            Unassigned Unassigned
            sandep.amit Sandeep Maheshwari
            0 Vote for this issue
            1 Start watching this issue