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

ASF GitHub Bot commented on HADOOP-20048:
-----------------------------------------

joseluisll commented on PR #8951:
URL: https://github.com/apache/hadoop/pull/8951#issuecomment-7275293698

   Friendly ping for review. This test-only fix unblocks a lane beyond this PR: 
the same `testHttpServer2Metrics` race just failed the fork Build on #8894's 
latest run (run 46357876564, `<104> to be greater than <104>` on a 
bit-identical tree to an earlier green run) — rerunning that job now, but #8951 
landing would stop it recurring. All checks green, MERGEABLE/CLEAN.
   




> Fix race in TestHttpServer#testHttpServer2Metrics
> -------------------------------------------------
>
>                 Key: HADOOP-20048
>                 URL: https://issues.apache.org/jira/browse/HADOOP-20048
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: test
>            Reporter: Jose Luis López
>            Priority: Minor
>              Labels: pull-request-available
>
> {{TestHttpServer#testHttpServer2Metrics}} is intermittently flaky. It was 
> observed failing once and passing on retry (surefire {{flakyFailure}}) with:
> {noformat}
> java.lang.AssertionError:
> Expecting:
>  <104>
> to be greater than:
>  <104>
> {noformat}
> The test reads {{HttpServer2Metrics#responses2xx()}} immediately after 
> {{conn.getResponseCode()}} returns 200. That counter comes from Jetty's 
> {{StatisticsHandler}}, which records a response when the request completes on 
> the server side. This can happen after the client has already read the status 
> line, so the second read can still return the old value.
> Proposed fix (test-only):
> * read and close the response body, then {{disconnect()}}, so the exchange 
> completes;
> * wait for the counter with {{GenericTestUtils.waitFor(() -> 
> metrics.responses2xx() > before, 10, 10000, ...)}} instead of reading it once.
> The test still checks the same thing: the 2xx counter increases after a 
> successful request. With the fix, the test passed 50/50 runs in separate JVMs 
> with {{-Dsurefire.rerunFailingTestsCount=0}}, and checkstyle reports no new 
> warnings.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to