Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-6731

Jetty getLocalPort() returns -1 resulting in build failures

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • Integration Tests
    • None

    Description

      We observed sporadic errors [1] fir the project core-its on Jenkins.
      So I started haveing a look and I say the JavaDoc of the method getlocalPort saying that -1 is returned if the connector is not open. So I decided to use [2] and wait until the server is up. This was of course wrong because the status of the server is set to STARTED immediatelly after the method Server.start(). So therefore I was googling a little bit and I found that Hadoop [3] had this problem too in 2010. Whole problem was with a bug in Jetty server which is race condition. The article has a link to Jetty's Jira with reported bug JETTY-748. According to the annoucements [4] from Eclipse/Jetty, the bug "JETTY-748 Prevent race close of socket by old acceptor threads" was fixed in the version jetty-7.2.1.v20101111. So I decided to use that version but I found that the class HashUserRealm was deleted and there is no support and no further development of org.mortbay. Eclipse continues with the development of Jerry 9.
      All I did in this issue was to rewrite 38 integration tests to Jetty 9 API and the fix for JETTY-748 is right there.

      [1]:
      Error message in logs: [WARNING] Could not transfer metadata org.apache.maven.its.mng4554/maven-metadata.xml from/to central (http://localhost:-1/repo-1): Connect to localhost:80 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect

      [2]:

              while ( !server.isRunning() || !server.isStarted() )
              {
                  if ( server.isFailed() )
                  {
                      fail( "Couldn't bind the server socket to a free port!" );
                  }
                  Thread.sleep( 100L );
              }
      

      [3]:
      https://www.bountysource.com/issues/987313-jetty-returns-1-resulting-in-hadoop-masters-slaves-to-fail-during-startup

      [4]:
      https://www.eclipse.org/lists/jetty-dev/msg00537.html

      Attachments

        Issue Links

          Activity

            People

              tibordigana Tibor Digana
              tibordigana Tibor Digana
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m