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

Chris Nauroth commented on HADOOP-11145:
----------------------------------------

Hi, [~ajisakaa].  Thanks for taking this.  I have a VM that repros this failure 
fairly often, and I can confirm that it has stopped happening after applying 
your patch.

However, this looks like a problem that would benefit from using a 
{{CountDownLatch}} to count the number of completed puts.  This would eliminate 
any chance of a race condition causing a test failure in any environment.  
{{assertCanPut}} could instantiate a {{CountDownLatch}} with its count 
initialized to {{numberOfPuts}} and pass it into the {{Putter}} constructor.  
Then, {{assertCanPut}} would call {{CountDownLatch#await}}, while the 
background {{Putter}} thread calls {{CountDownLatch#countDown}}.

There is a similar problem with {{assertCanTake}} too, and again it looks like 
a {{CountDownLatch}} would solve it.

> TestFairCallQueue fails
> -----------------------
>
>                 Key: HADOOP-11145
>                 URL: https://issues.apache.org/jira/browse/HADOOP-11145
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: test
>            Reporter: Akira AJISAKA
>            Assignee: Akira AJISAKA
>         Attachments: HADOOP-11145.patch, HADOOP-11145.patch, 
> org.apache.hadoop.ipc.TestFairCallQueue-output.txt
>
>
> TestFairCallQueue#testPutBlocksWhenAllFull fails on trunk and branch-2.
> {code}
> Running org.apache.hadoop.ipc.TestFairCallQueue
> Tests run: 22, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.174 sec 
> <<< FAILURE! - in org.apache.hadoop.ipc.TestFairCallQueue
> testPutBlocksWhenAllFull(org.apache.hadoop.ipc.TestFairCallQueue)  Time 
> elapsed: 0.239 sec  <<< FAILURE!
> junit.framework.AssertionFailedError: expected:<10> but was:<0>
>       at junit.framework.Assert.fail(Assert.java:57)
>       at junit.framework.Assert.failNotEquals(Assert.java:329)
>       at junit.framework.Assert.assertEquals(Assert.java:78)
>       at junit.framework.Assert.assertEquals(Assert.java:234)
>       at junit.framework.Assert.assertEquals(Assert.java:241)
>       at junit.framework.TestCase.assertEquals(TestCase.java:409)
>       at 
> org.apache.hadoop.ipc.TestFairCallQueue.assertCanPut(TestFairCallQueue.java:337)
>       at 
> org.apache.hadoop.ipc.TestFairCallQueue.testPutBlocksWhenAllFull(TestFairCallQueue.java:353)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to