Error - Failed to bind to: /127.0.1.1:2552

1,738 views
Skip to first unread message

Suresh Kumar

unread,
Nov 3, 2014, 5:31:22 AM11/3/14
to akka...@googlegroups.com
 
Hi,
 
I have a bunch of unit tests for my actor system (akka 2.3) which is in a clustor. The below error comes randomly in some of the tests during build.(which works fine in eclipse if we run one by one). I have put parallelExecution in Test := false in build.scala, but still the error persists.
 
My conf looks like
 
akka {       
  loggers = ["akka.testkit.TestEventListener"]
  loglevel = "DEBUG"       
  stdout-loglevel = "DEBUG"
       
  actor {
    debug {
      receive = on
#      lifecycle = on
      autoreceive = on
    }
      remote {
  netty.tcp {
  hostname = "127.0.0.1"
  port = 0 
  }
 }
  }   
 
sbt.ForkMain$ForkError: Failed to bind to: /127.0.1.1:2552
 at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:272)
 at akka.remote.transport.netty.NettyTransport$$anonfun$listen$1.apply(NettyTransport.scala:392)
 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: sbt.ForkMain$ForkError: Address already in use
 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)
 
 
Thanks in advance,
Suresh

Björn Antonsson

unread,
Nov 4, 2014, 7:42:44 AM11/4/14
to akka...@googlegroups.com
Hi Suresh,

Have you gotten any further with this issue?

From looking at your configuration, the actor systems shouldn't even bind to 127.0.1.1:2552. Are you sure that you get the right configuration loaded?

Another thing that you can try is to wait for ActorSystem shutdown in the test using this:
actorSystem.awaitTermination(duration)

The actor system termination is not blocking anf your next test case might just start before the previous system has shut down completely.

B/
--
>>>>>>>>>> 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.

-- 
Björn Antonsson
Typesafe – Reactive Apps on the JVM
twitter: @bantonsson

Suresh Kumar

unread,
Nov 7, 2014, 3:06:46 AM11/7/14
to akka...@googlegroups.com
 
Thanks Björn...unfortunately still I am facing the same issue. I have confirmed that the config is getting loaded correctly. Also I have tried with awaitTermination, still no luck.
I have noticed that awaitTermination() hangs for ever but awaitTermination(duration) has no effect. So it looks likes to me the system is not shutting down. Also with clustor, I have no issues with these test cases. Here problems are with FeatureSpec, funspecs are working fine
 
Thanks in advance,
Suresh

Andrey Kouznetsov

unread,
Nov 7, 2014, 5:24:09 AM11/7/14
to akka...@googlegroups.com
Recently I had the same issue.
akka.remote.netty.tcp.port was set to 0 but actor system was trying to bind on 2552.
The problem was that actor system was lazy val in my specs but config it was using wasnt, like following:

trait CommonSpec extends TestKitBase {
  val config: Config = mkConfig

  implicit lazy val system: ActorSystem = ActorSystem("api", config)
}

This mistake made system initialize twice: with the default config values (config val at the system initialization moment was null)  and again with right config value.
Reply all
Reply to author
Forward
0 new messages