GitHub user sarutak opened a pull request:

    https://github.com/apache/spark/pull/4337

    [SPARK-5559] [Streaming] [Test] Remove oppotunity we met flakiness when 
running FlumeStreamSuite

    When we run FlumeStreamSuite on Jenkins, sometimes we get error like as 
follows.
    
    
        sbt.ForkMain$ForkError: The code passed to eventually never returned 
normally. Attempted 52 times over 10.094849836 seconds. Last failure message: 
Error connecting to localhost/127.0.0.1:23456.
            at 
org.scalatest.concurrent.Eventually$class.tryTryAgain$1(Eventually.scala:420)
            at 
org.scalatest.concurrent.Eventually$class.eventually(Eventually.scala:438)
            at 
org.scalatest.concurrent.Eventually$.eventually(Eventually.scala:478)
            at 
org.scalatest.concurrent.Eventually$class.eventually(Eventually.scala:307)
           at 
org.scalatest.concurrent.Eventually$.eventually(Eventually.scala:478)
           at 
org.apache.spark.streaming.flume.FlumeStreamSuite.writeAndVerify(FlumeStreamSuite.scala:116)
               at 
org.apache.spark.streaming.flume.FlumeStreamSuite.org$apache$spark$streaming$flume$FlumeStreamSuite$$testFlumeStream(FlumeStreamSuite.scala:74)
           at 
org.apache.spark.streaming.flume.FlumeStreamSuite$$anonfun$3.apply$mcV$sp(FlumeStreamSuite.scala:66)
            at 
org.apache.spark.streaming.flume.FlumeStreamSuite$$anonfun$3.apply(FlumeStreamSuite.scala:66)
            at 
org.apache.spark.streaming.flume.FlumeStreamSuite$$anonfun$3.apply(FlumeStreamSuite.scala:66)
            at 
org.scalatest.Transformer$$anonfun$apply$1.apply$mcV$sp(Transformer.scala:22)
            at org.scalatest.OutcomeOf$class.outcomeOf(OutcomeOf.scala:85)
            at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
            at org.scalatest.Transformer.apply(Transformer.scala:22)
            at org.scalatest.Transformer.apply(Transformer.scala:20)
                    at 
org.scalatest.FunSuiteLike$$anon$1.apply(FunSuiteLike.scala:166)
            at org.scalatest.Suite$class.withFixture(Suite.scala:1122)
            at org.scalatest.FunSuite.withFixture(FunSuite.scala:1555)
            at 
org.scalatest.FunSuiteLike$class.invokeWithFixture$1(FunSuiteLike.scala:163)
           at 
org.scalatest.FunSuiteLike$$anonfun$runTest$1.apply(FunSuiteLike.scala:175)
            at 
org.scalatest.FunSuiteLike$$anonfun$runTest$1.apply(FunSuiteLike.scala:175)
            at org.scalatest.SuperEngine.runTestImpl(Engine.scala:306)
            at org.scalatest.FunSuiteLike$class.runTest(FunSuiteLike.scala:175)
    
    
    This error is caused by check-then-act logic  when it find free-port .
    
    
          /** Find a free port */
          private def findFreePort(): Int = {
            Utils.startServiceOnPort(23456, (trialPort: Int) => {
              val socket = new ServerSocket(trialPort)
              socket.close()
              (null, trialPort)
            }, conf)._2
          }
    
    
    Removing the check-then-act is not easy but we can reduce the chance of 
having the error by choosing random value for initial port instead of 23456.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/sarutak/spark SPARK-5559

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/4337.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #4337
    
----
commit 8212e42cfd79b5b92c7c664a9ecff7da68e062a5
Author: Kousuke Saruta <saru...@oss.nttdata.co.jp>
Date:   2015-02-03T14:08:05Z

    Modified default port used in FlumeStreamSuite from 23456 to random value

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to