Uploaded image for project: 'Oozie'
  1. Oozie
  2. OOZIE-2928

Unit Tests using LocalOozie fail randomly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.3.0
    • 5.0.0b1
    • core

    Description

      Sometimes There is an erro message running unit tests: "LocalOozie is already initialized" then fails all the tests using LocalOozie.

      There is already a BindException that

      <error message="Address already in use" type="java.net.BindException">java.net.BindException: Address already in use
              at java.net.PlainSocketImpl.socketBind(Native Method)
              at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
              at java.net.ServerSocket.bind(ServerSocket.java:376)
              at java.net.ServerSocket.&lt;init&gt;(ServerSocket.java:237)
              at org.mortbay.jetty.bio.SocketConnector.newServerSocket(SocketConnector.java:80)
              at org.mortbay.jetty.bio.SocketConnector.open(SocketConnector.java:73)
              at org.mortbay.jetty.AbstractConnector.doStart(AbstractConnector.java:283)
              at org.mortbay.jetty.bio.SocketConnector.doStart(SocketConnector.java:147)
              at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
              at org.mortbay.jetty.Server.doStart(Server.java:233)
              at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
              at org.apache.oozie.test.EmbeddedServletContainer.start(EmbeddedServletContainer.java:105)
              at org.apache.oozie.local.LocalOozie.start(LocalOozie.java:81)
              at org.apache.oozie.command.coord.TestCoordRerunXCommand.setUp(TestCoordRerunXCommand.java:79)
              at junit.framework.TestCase.runBare(TestCase.java:132)
              at junit.framework.TestResult$1.protect(TestResult.java:110)
              at junit.framework.TestResult.runProtected(TestResult.java:128)
              at junit.framework.TestResult.run(TestResult.java:113)
              at junit.framework.TestCase.run(TestCase.java:124)
              at junit.framework.TestSuite.runTest(TestSuite.java:243)
              at junit.framework.TestSuite.run(TestSuite.java:238)
              at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
              at org.junit.runners.Suite.runChild(Suite.java:128)
              at org.junit.runners.Suite.runChild(Suite.java:24)
              at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
              at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
              at java.util.concurrent.FutureTask.run(FutureTask.java:166)
              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:722)
      </error>
      

      The source of problem seems to be in EmbeddedServletContainer.java. First we create a socket, get its port number, release the socket and use this port to create server:

              ServerSocket ss = new ServerSocket(0);
              port = ss.getLocalPort();
              ss.close();
              server.getConnectors()[0].setHost(host);
              server.getConnectors()[0].setPort(port);
      

      Attachments

        Activity

          People

            dionusos Dénes Bodó
            dionusos Dénes Bodó
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: