Bind exception with multiple Akka cluster nodes on same machine

2,967 views
Skip to first unread message

Muthukumaran Kothandaraman

unread,
Oct 4, 2014, 3:53:12 PM10/4/14
to akka...@googlegroups.com
Hi,

I am starting a 3 node cluster on same machine with following conf (one copy each for 3 nodes with changed netty.tcp.port values. Though I see the exception pasted below during startup, Cluster actually comes up and I am able to see all nodes via JMX and all other cluster-listener messages work as expected. I googled similar queries but could not correlate with what I observe.

I use version 2.10-2.3.4 for cluster, remote and actor artifacts.

How can I avoid this bind exception ?

    akka {
        actor {
        provider = "akka.cluster.ClusterActorRefProvider"
    }
    remote {
        log-remote-lifecycle-events = on
        netty.tcp {
            hostname = "127.0.0.1"
            port = 1551 ### changing this to 1552 and 1553 for other nodes of cluster ###
        }
    }

    cluster {
            seed-nodes = [
            "akka.tcp://Cluste...@127.0.0.1:1551",
            "akka.tcp://Cluste...@127.0.0.1:1552"]

            auto-down-unreachable-after = 10s
        }
    }

[10/05/2014 01:06:20.707] [main] [Remoting] Starting remoting
[10/05/2014 01:06:20.720] [ClusterSystem-akka.remote.default-remote-dispatcher-6] [NettyTransport(akka://ClusterSystem)] failed to bind to /127.0.0.1:1551, shutting down Netty transport
Exception in thread "main" org.jboss.netty.channel.ChannelException: Failed to bind to: /127.0.0.1:1551 (Same exception observed for 1552 and 1553 nodes during startup)
    at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:272)
    at akka.remote.transport.netty.NettyTransport$$anonfun$listen$1.apply(NettyTransport.scala:393)
    at akka.remote.transport.netty.NettyTransport$$anonfun$listen$1.apply(NettyTransport.scala:389)
    at scala.util.Success$$anonfun$map$1.apply(Try.scala:206)
    at scala.util.Try$.apply(Try.scala:161)
    at scala.util.Success.map(Try.scala:206)
    at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235)
    at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235)
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.processBatch$1(BatchingExecutor.scala:67)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:82)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59)
    at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72)
    at akka.dispatch.BatchingExecutor$Batch.run(BatchingExecutor.scala:58)
    at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.net.BindException: Address already in use: bind
    at sun.nio.ch.Net.bind0(Native Method)
    at sun.nio.ch.Net.bind(Net.java:444)
    at sun.nio.ch.Net.bind(Net.java:436)
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
    at org.jboss.netty.channel.socket.nio.NioServerBoss$RegisterTask.run(NioServerBoss.java:193)
    at org.jboss.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:372)
    at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:296)
    at org.jboss.netty.channel.socket.nio.NioServerBoss.run(NioServerBoss.java:42)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
[10/05/2014 01:06:20.728] [main] [Remoting] Remoting error: [Startup failed] [
akka.remote.RemoteTransportException: Startup failed
    at akka.remote.Remoting.akka$remote$Remoting$$notifyError(Remoting.scala:136)
    at akka.remote.Remoting.start(Remoting.scala:201)
    at akka.remote.RemoteActorRefProvider.init(RemoteActorRefProvider.scala:184)
    at akka.cluster.ClusterActorRefProvider.init(ClusterActorRefProvider.scala:58)
    at akka.actor.ActorSystemImpl.liftedTree2$1(ActorSystem.scala:618)
    at akka.actor.ActorSystemImpl._start$lzycompute(ActorSystem.scala:615)
    at akka.actor.ActorSystemImpl._start(ActorSystem.scala:615)
    at akka.actor.ActorSystemImpl.start(ActorSystem.scala:632)
    at akka.actor.ActorSystem$.apply(ActorSystem.scala:141)
    at akka.actor.ActorSystem$.apply(ActorSystem.scala:118)
    at akka.actor.ActorSystem$.create(ActorSystem.scala:66)
    at akka.actor.ActorSystem.create(ActorSystem.scala)
    at org.ambitious.actorexps.clusterexps.ClusterBootStrap1.startup(ClusterBootStrap1.java:43)
    at org.ambitious.actorexps.clusterexps.ClusterBootStrap1.main(ClusterBootStrap1.java:25)
Caused by: org.jboss.netty.channel.ChannelException: Failed to bind to: /127.0.0.1:1551 (Same exception observed for 1552 and 1553 nodes during startup)
    at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:272)
    at akka.remote.transport.netty.NettyTransport$$anonfun$listen$1.apply(NettyTransport.scala:393)
    at akka.remote.transport.netty.NettyTransport$$anonfun$listen$1.apply(NettyTransport.scala:389)
    at scala.util.Success$$anonfun$map$1.apply(Try.scala:206)
    at scala.util.Try$.apply(Try.scala:161)
    at scala.util.Success.map(Try.scala:206)
    at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235)
    at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235)
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.processBatch$1(BatchingExecutor.scala:67)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:82)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59)
    at akka.dispatch.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:59)
    at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72)
    at akka.dispatch.BatchingExecutor$Batch.run(BatchingExecutor.scala:58)
    at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.net.BindException: Address already in use: bind
    at sun.nio.ch.Net.bind0(Native Method)
    at sun.nio.ch.Net.bind(Net.java:444)
    at sun.nio.ch.Net.bind(Net.java:436)
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
    at org.jboss.netty.channel.socket.nio.NioServerBoss$RegisterTask.run(NioServerBoss.java:193)
    at org.jboss.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:372)
    at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:296)
    at org.jboss.netty.channel.socket.nio.NioServerBoss.run(NioServerBoss.java:42)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

Regards
Muthu

Martynas Mickevičius

unread,
Oct 7, 2014, 4:12:18 AM10/7/14
to akka...@googlegroups.com
Hi Muthu,

since cluster starts and is working it seems that you start multiple nodes on port 1551 next to the nodes with changed port.

Do you change 
remote.netty.tcp.port in code? Check if you do not start ActorSystem before the change.

--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.



--
Martynas Mickevičius
TypesafeReactive Apps on the JVM

Muthukumaran Kothandaraman

unread,
Oct 7, 2014, 5:10:43 AM10/7/14
to akka...@googlegroups.com
Thanks for the reply Martynas.

You were spot-on !!! I was actually starting actorsystems with overlapping ports - my bad !

Thanks

Muthu



On Tuesday, 7 October 2014 13:42:18 UTC+5:30, Martynas Mickevičius wrote:
Hi Muthu,

since cluster starts and is working it seems that you start multiple nodes on port 1551 next to the nodes with changed port.

Do you change 
remote.netty.tcp.port in code? Check if you do not start ActorSystem before the change.
On Sat, Oct 4, 2014 at 10:53 PM, Muthukumaran Kothandaraman <muthu....@gmail.com> wrote:
Hi,

I am starting a 3 node cluster on same machine with following conf (one copy each for 3 nodes with changed netty.tcp.port values. Though I see the exception pasted below during startup, Cluster actually comes up and I am able to see all nodes via JMX and all other cluster-listener messages work as expected. I googled similar queries but could not correlate with what I observe.

I use version 2.10-2.3.4 for cluster, remote and actor artifacts.

How can I avoid this bind exception ?

    akka {
        actor {
        provider = "akka.cluster.ClusterActorRefProvider"
    }
    remote {
        log-remote-lifecycle-events = on
        netty.tcp {
            hostname = "127.0.0.1"
            port = 1551 ### changing this to 1552 and 1553 for other nodes of cluster ###
        }
    }

    cluster {
            seed-nodes = [
            "akka.tcp://ClusterSystem@127.0.0.1:1551",
            "akka.tcp://ClusterSystem@127.0.0.1:1552"]
Reply all
Reply to author
Forward
0 new messages