Tibor Digana created MNG-6731:
---------------------------------
Summary: Jetty getLocalPort() returns -1 resulting build failures
Key: MNG-6731
URL: https://issues.apache.org/jira/browse/MNG-6731
Project: Maven
Issue Type: Bug
Components: Integration Tests
Reporter: Tibor Digana
Assignee: Tibor Digana
Fix For: 3.6.2, 3.6.x-candidate
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
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]:
{code:java}
while ( !server.isRunning() || !server.isStarted() )
{
if ( server.isFailed() )
{
fail( "Couldn't bind the server socket to a free port!" );
}
Thread.sleep( 100L );
}
{code}
[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
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)