You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@oozie.apache.org by "Andras Piros (JIRA)" <ji...@apache.org> on 2017/06/07 08:31:18 UTC

[jira] [Commented] (OOZIE-2928) Unit Tests using LocalOozie fail randomly

    [ https://issues.apache.org/jira/browse/OOZIE-2928?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16040499#comment-16040499 ] 

Andras Piros commented on OOZIE-2928:
-------------------------------------

Hi [~dionusos], thanks for the contribution!

Can you please also add a test to {{TestEmbeddedServletContainer}}? Maybe using also parallel {{EmbeddedServletContainer#start}} calls to different instances.

> Unit Tests using LocalOozie fail randomly
> -----------------------------------------
>
>                 Key: OOZIE-2928
>                 URL: https://issues.apache.org/jira/browse/OOZIE-2928
>             Project: Oozie
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 4.3.0
>            Reporter: Denes Bodo
>              Labels: Servlet
>         Attachments: 0001-Fix-random-LocalOozie-based-test-failure.patch
>
>
> 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 
> {noformat}
> <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>
> {noformat}
> 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:
> {noformat}
>         ServerSocket ss = new ServerSocket(0);
>         port = ss.getLocalPort();
>         ss.close();
>         server.getConnectors()[0].setHost(host);
>         server.getConnectors()[0].setPort(port);
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)