You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Sandeep Maheshwari (JIRA)" <ji...@apache.org> on 2011/02/11 13:05:57 UTC

[jira] Created: (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

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
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: ZOOKEEPER-986
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-986
             Project: ZooKeeper
          Issue Type: Bug
          Components: quorum
    Affects Versions: 3.3.2
         Environment: Windows
            Reporter: Sandeep Maheshwari
            Priority: Minor
             Fix For: 3.3.3


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.
 

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (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

Posted by "Benjamin Reed (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-986?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benjamin Reed updated ZOOKEEPER-986:
------------------------------------

    Fix Version/s:     (was: 3.3.3)
                   3.4.0

> 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
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-986
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-986
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: quorum
>    Affects Versions: 3.3.2
>         Environment: Windows
>            Reporter: Sandeep Maheshwari
>            Priority: Minor
>              Labels: gsoc
>             Fix For: 3.4.0
>
>
> 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.
>  

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (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

Posted by "Mahadev konar (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/ZOOKEEPER-986?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mahadev konar updated ZOOKEEPER-986:
------------------------------------

    Fix Version/s:     (was: 3.4.0)
                   3.5.0

not a blocker. Moving it out of 3.4 release.

> 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
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-986
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-986
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: quorum
>    Affects Versions: 3.3.2
>         Environment: Windows
>            Reporter: Sandeep Maheshwari
>            Priority: Minor
>              Labels: gsoc
>             Fix For: 3.5.0
>
>
> 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.
>  

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (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

Posted by "Flavio Junqueira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/ZOOKEEPER-986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12993556#comment-12993556 ] 

Flavio Junqueira commented on ZOOKEEPER-986:
--------------------------------------------

Hi Sandeep, It doesn't send every message twice because it only records the message inside the while loop. It sends the last message before it gets into the loop. 

> 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
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-986
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-986
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: quorum
>    Affects Versions: 3.3.2
>         Environment: Windows
>            Reporter: Sandeep Maheshwari
>            Priority: Minor
>              Labels: gsoc
>             Fix For: 3.3.3
>
>
> 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.
>  

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira