Uploaded image for project: 'Hama'
  1. Hama
  2. HAMA-352

Can't send one more messages on to same server in bsp() method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 0.2.0
    • None
    • None

    Description

      Oh, thanks for nice report!

      At this time, it looks like impossible to send one more messages on to
      same server in bsp() method. It's a bug. I'll fix it now.

      Pls, update your TRUNK.


      To developers,

      See the BSPPeer.send() method. The peerName should be a
      InetSocketAddress, not String. Otherwise, queue will be always null.
      And after add msg to queue, we have to put it to "outgoingQueues"
      again as below:

      — src/java/org/apache/hama/bsp/BSPPeer.java (revision 1069189)
      +++ src/java/org/apache/hama/bsp/BSPPeer.java (working copy)
      @@ -140,12 +140,12 @@
      @Override
      public void send(String peerName, BSPMessage msg) throws IOException {
      LOG.debug("Send bytes (" + msg.getData().toString() + ") to " + peerName);

      • ConcurrentLinkedQueue<BSPMessage> queue = outgoingQueues.get(peerName);
        + ConcurrentLinkedQueue<BSPMessage> queue =
        outgoingQueues.get(getAddress(peerName));
        if (queue == null) { queue = new ConcurrentLinkedQueue<BSPMessage>(); - outgoingQueues.put(getAddress(peerName), queue); }

        queue.add(msg);
        + outgoingQueues.put(getAddress(peerName), queue);

      • Hide quoted text -
        }

      On Mon, Feb 14, 2011 at 7:02 PM, Paweł Brach <braszek@gmail.com> wrote:
      > Hello,
      >
      > I'm attaching PiEstimator with some changes. I'm sending exactly two
      > messages to "master" from each node.
      >
      > bspPeer.send(masterTask, estimate);
      > LOG.info("Send message:" + System.currentTimeMillis());
      > bspPeer.send(masterTask, estimate2);
      > LOG.info("Send message:" + System.currentTimeMillis());
      >
      > After that I'm trying to receive all messages:
      > LOG.info("Num msg = " + bspPeer.getNumCurrentMessages());
      > while ((received = bspPeer.getCurrentMessage()) != null)

      { > LOG.info("Receives messages:" + Bytes.toDouble(received.getData())); > .... > }

      >
      > In the log file I see:
      > 2011-02-14 09:46:07,124 INFO org.apache.hama.bsp.TaskRunner:
      > attempt_201102140938_0003_m_000000_0 11/02/14 09:46:07 INFO
      > algorithms.PiEstimator$MyEstimator: Send message:1297673167123
      > 2011-02-14 09:46:07,125 INFO org.apache.hama.bsp.TaskRunner:
      > attempt_201102140938_0003_m_000000_0 11/02/14 09:46:07 INFO
      > algorithms.PiEstimator$MyEstimator: Send message:1297673167125
      > 2011-02-14 09:46:07,270 INFO org.apache.hama.bsp.TaskRunner:
      > attempt_201102140938_0003_m_000000_0 11/02/14 09:46:07 INFO
      > algorithms.PiEstimator$MyEstimator: Receives messages:3.1536
      > 2011-02-14 09:46:07,270 INFO org.apache.hama.bsp.TaskRunner:
      > attempt_201102140938_0003_m_000000_0 11/02/14 09:46:07 INFO
      > algorithms.PiEstimator$MyEstimator: Receives messages:3.148
      > 2011-02-14 09:46:07,271 INFO org.apache.hama.bsp.TaskRunner:
      > attempt_201102140938_0003_m_000000_0 11/02/14 09:46:07 INFO
      > algorithms.PiEstimator$MyEstimator: Receives messages:3.1392
      > 2011-02-14 09:46:07,272 INFO org.apache.hama.bsp.TaskRunner:
      > attempt_201102140938_0003_m_000000_0 11/02/14 09:46:07 INFO
      > algorithms.PiEstimator$MyEstimator:
      > 2011-02-14 09:46:07,272 INFO org.apache.hama.bsp.TaskRunner:
      > attempt_201102140938_0003_m_000000_0 Estimated value of PI is
      > 3.1450000000000005
      >
      >
      > On each node I see that two messages are sent (so master should receive 6
      > messages - I have 3 nodes). In the log file I see only 3 records
      > "Receives...", so only 3 messages were processed by master task. I don'
      > understand why is that.
      >
      > What's more, I have tried to change line:
      > while ((received = bspPeer.getCurrentMessage()) != null) {
      >
      > to
      > if ((received = bspPeer.getCurrentMessage()) != null) {
      >
      > So there should be messages in the queue which are not processed. In my
      > opinion bsp() should be called again and again... and in consequence falls
      > in loop of calls. But it doesn't happen - bsp() method is run exactly once
      > and framework is probably hanging after last line of the bsp() code. Could
      > you explain this for me?
      >
      > Best regards,
      > Pawel
      >

      Attachments

        1. patch.txt
          2 kB
          Edward J. Yoon

        Activity

          People

            udanax Edward J. Yoon
            udanax Edward J. Yoon
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: