[ https://issues.apache.org/jira/browse/NUTCH-3066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17881624#comment-17881624 ]
Hudson commented on NUTCH-3066: ------------------------------- SUCCESS: Integrated in Jenkins build Nutch ยป Nutch-trunk #166 (See [https://ci-builds.apache.org/job/Nutch/job/Nutch-trunk/166/]) NUTCH-3066 Protocol plugin unit tests fail randomly (snagel: [https://github.com/apache/nutch/commit/309bc18632d61c592de0fc030b28af9cbaccdd29]) * (edit) src/test/org/apache/nutch/protocol/AbstractHttpProtocolPluginTest.java * (edit) src/plugin/protocol-okhttp/src/test/org/apache/nutch/protocol/okhttp/TestResponse.java * (edit) src/plugin/protocol-http/src/test/org/apache/nutch/protocol/http/TestResponse.java > Protocol plugin unit tests fail randomly > ---------------------------------------- > > Key: NUTCH-3066 > URL: https://issues.apache.org/jira/browse/NUTCH-3066 > Project: Nutch > Issue Type: Bug > Components: plugin, protocol, test > Affects Versions: 1.20 > Reporter: Sebastian Nagel > Assignee: Sebastian Nagel > Priority: Major > Fix For: 1.21 > > > The HTTP protocol plugin unit tests may fail at random. The reasons are: > - the unit tests run the test web server delivering test pages using the same > port (inherited from AbstractHttpProtocolPluginTest) > - the plugin unit tests are executed in parallel (two concurrent threads) > From time to time two tests try to launch a web server listening on the same > port. This consequently causes a failure, e.g. in a [GitHub > workflow|https://github.com/apache/nutch/actions/runs/10728348673/job/29752702091?pr=823#step:4:7667]: > {noformat} > [junit] Tests run: 14, Failures: 1, Errors: 0, Skipped: 4, Time elapsed: > 4.735 sec > [junit] Test org.apache.nutch.protocol.okhttp.TestBadServerResponses FAILED > {noformat} > The error message in > (TEST-org.apache.nutch.protocol.http.TestBadServerResponses.txt, from a local > test run): > {noformat} > 2024-09-06 08:36:32,549 INFO o.a.n.p.AbstractHttpProtocolPluginTest > [Thread-3] Socket on port 47505 closed: Address already in use (Bind failed) > 2024-09-06 08:36:32,550 INFO o.a.n.p.AbstractHttpProtocolPluginTest > [Thread-2] Socket on port 47505 closed: Socket closed > 2024-09-06 08:36:32,599 INFO o.a.n.p.AbstractHttpProtocolPluginTest [main] > Fetching http://127.0.0.1:47505/ > 2024-09-06 08:36:32,600 ERROR o.a.n.p.h.Http [main] Failed to get protocol > output > java.net.ConnectException: Connection refused (Connection refused) > {noformat} > Possible solutions: > 1. do not run plugin unit tests in parallel. > -- Note: the parallelism does not save a lot of time. A test run on my > laptop: 6'19'' (2 threads, failed) vs. 6'55'' (1 thread, success) > 2. override the port in each unit test and > -- ensure that a unique port number is used. Note: manually assigning > unique numbers is difficult to maintain when new tests are added. > -- or choose a random port number (making collisions unlikely) > 3. try another port if one is already in use -- This message was sent by Atlassian Jira (v8.20.10#820010)