[ 
https://issues.apache.org/jira/browse/HAMA-789?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13893271#comment-13893271
 ] 

Edward J. Yoon commented on HAMA-789:
-------------------------------------

Reopen. Using random port makes hard to manage firewall rules of cluster.  I 
didn't know that random port was used to avoid "Address already in use" 
exception. :/

{code}
  private final void startRPCServer(Configuration conf,
      InetSocketAddress peerAddress) {
    try {
      String bindAddress = conf.get(Constants.PEER_HOST,
          Constants.DEFAULT_PEER_HOST);
      InetSocketAddress selfAddress = new InetSocketAddress(bindAddress, 0);

      // TODO Make number of RPC Server threads configurable
      this.server = RPC.getServer(this, selfAddress.getHostName(),
          selfAddress.getPort(), 
conf.getInt("hama.default.messenger.handler.threads.num", 5), false, conf);
      server.start();
      
      LOG.info(" BSPPeer address:" + server.getListenerAddress().getHostName()
          + " port:" + server.getListenerAddress().getPort());
    } catch (IOException e) {
      LOG.error("Fail to start RPC server!", e);
      throw new RuntimeException("RPC Server could not be launched!");
    }
  }
{code}

> BspPeer launched fail because port is bound by others
> -----------------------------------------------------
>
>                 Key: HAMA-789
>                 URL: https://issues.apache.org/jira/browse/HAMA-789
>             Project: Hama
>          Issue Type: Bug
>          Components: bsp core
>    Affects Versions: 0.6.2
>            Reporter: MaoYuan Xian
>            Assignee: Suraj Menon
>             Fix For: 0.6.3
>
>         Attachments: HAMA-789.patch, HAMA-789.patch
>
>
> In GroomServer, we call BSPNetUtils.getNextAvailable to assigning the bsppeer 
> listening port. After figures out an available port, the GroomServer release 
> the port and launches the BspPeer(Child), then the child listens to this port.
> However, during the GroomServer release the port and peer listens the port, 
> if other process in the operation system binds to the same port occasionally, 
> the bsppeer will fail to start up because of "Address already in use" 
> exception.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to