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

Uma Maheswara Rao G commented on BOOKKEEPER-324:
------------------------------------------------

I think we should synchronize on  fileInfoCache in  LedgerCacheImpl#close 
method.

Because, if some threads are putting the element in fileInfoCache and at the 
same time of shutdown called, close is iterating them. SO, at this time this 
exception can come. I just reproduce it with LedgerCacheImpl.

Added two threads to test with debug mode, one for getFileInfo and other for 
close. then I blocked fileInfo before putting the lelement and allowed close to 
do one iteration. After the I released getFileInfo thread.


{noformat}
2012-07-03 17:32:06,984 - INFO  - [main:LedgerCacheImpl@71] - openFileLimit is 
900, pageSize is 8192, pageLimit is 2712
Exception in thread "Thread-1" java.util.ConcurrentModificationException
        at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
        at java.util.HashMap$EntryIterator.next(HashMap.java:834)
        at java.util.HashMap$EntryIterator.next(HashMap.java:832)
        at 
org.apache.bookkeeper.bookie.LedgerCacheImpl.close(LedgerCacheImpl.java:840)
        at 
org.apache.bookkeeper.bookie.LedgerCacheImpl$5.run(LedgerCacheImpl.java:953)
{noformat}
                
> Flakeyness in LedgerCreateDeleteTest
> ------------------------------------
>
>                 Key: BOOKKEEPER-324
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-324
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Ivan Kelly
>             Fix For: 4.2.0, 4.1.1
>
>         Attachments: 
> TEST-org.apache.bookkeeper.test.LedgerCreateDeleteTest.xml
>
>
> Fails when running in a loop for about 40 minutes. Failure is a 
> ConcurrentModificationException
> {code}
>   <testcase time="3.018" 
> classname="org.apache.bookkeeper.test.LedgerCreateDeleteTest" 
> name="testCreateDeleteLedgers">
>     <error 
> type="java.util.ConcurrentModificationException">java.util.ConcurrentModificationException
>       at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
>       at java.util.HashMap$EntryIterator.next(HashMap.java:834)
>       at java.util.HashMap$EntryIterator.next(HashMap.java:832)
>       at 
> org.apache.bookkeeper.bookie.LedgerCacheImpl.close(LedgerCacheImpl.java:781)
>       at 
> org.apache.bookkeeper.bookie.InterleavedLedgerStorage.shutdown(InterleavedLedgerStorage.java:73)
>       at org.apache.bookkeeper.bookie.Bookie.shutdown(Bookie.java:644)
>       at org.apache.bookkeeper.bookie.Bookie.shutdown(Bookie.java:630)
>       at 
> org.apache.bookkeeper.proto.BookieServer.shutdown(BookieServer.java:110)
>       at 
> org.apache.bookkeeper.test.BookKeeperClusterTestCase.stopBKCluster(BookKeeperClusterTestCase.java:146)
>       at 
> org.apache.bookkeeper.test.BookKeeperClusterTestCase.tearDown(BookKeeperClusterTestCase.java:94)
>       at junit.framework.TestCase.runBare(TestCase.java:140)
>       at junit.framework.TestResult$1.protect(TestResult.java:110)
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to