spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lisonbee, Todd" <>
Subject RE: Unit test failure: Address already in use
Date Wed, 18 Jun 2014 18:59:25 GMT

Disabling parallelExecution has worked for me.

Other alternatives I’ve tried that also work include:

1. Using a lock – this will let tests execute in parallel except for those using a SparkContext.
 If you have a large number of tests that could execute in parallel, this can shave off some

object TestingSparkContext {
  val lock = new Lock()

// before you instantiate your local SparkContext

// after you call sc.stop()

2. Sharing a local SparkContext between tests.

- This is nice because your tests will run faster.  Start-up and shutdown is time consuming
(can add a few seconds per test).

- The downside is that your tests are using the same SparkContext so they are less independent
of each other.  I haven’t seen issues with this yet but there are likely some things that
might crop up.



From: Anselme Vignon []
Sent: Wednesday, June 18, 2014 12:33 AM
Subject: Re: Unit test failure: Address already in use


Could your problem come from the fact that you run your tests in parallel ?

If you are spark in local mode, you cannot have concurrent spark instances running. this means
that your tests instantiating sparkContext cannot be run in parallel. The easiest fix is to
tell sbt to not run parallel tests.
This can be done by adding the following line in your build.sbt:

parallelExecution in Test := false



2014-06-17 23:01 GMT+02:00 SK <<>>:

I have 3 unit tests (independent of each other) in the /src/test/scala
folder. When I run each of them individually using: sbt "test-only <test>",
all the 3 pass the test. But when I run them all using "sbt test", then they
fail with the warning below. I am wondering if the binding exception results
in failure to run the job, thereby causing the failure. If so, what can I do
to address this binding exception? I am running these tests locally on a
standalone machine (i.e. SparkContext("local", "test")).

14/06/17 13:42:48 WARN component.AbstractLifeCycle: FAILED
org.eclipse.jetty.server.Server@3487b78d<mailto:org.eclipse.jetty.server.Server@3487b78d>: Address
already in use Address already in use
        at Method)


View this message in context:
Sent from the Apache Spark User List mailing list archive at

View raw message