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

Marcel Reutegger commented on OAK-9879:
---------------------------------------

It looks like sometimes loadSuccessCount in a CacheLIRS Segment is incorrect. 
One failure I was able to debug showed both entries in the same Segment with a 
loadSuccessCount of 1.

I can see three locations where Segment.loadSuccessCount is incremented.
- 
[Segment.load()|https://github.com/apache/jackrabbit-oak/blob/34f6b27228539a5f7f9e305fa44d67d193dbe419/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/cache/CacheLIRS.java#L1028]
- 
[Segment.get()|https://github.com/apache/jackrabbit-oak/blob/34f6b27228539a5f7f9e305fa44d67d193dbe419/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/cache/CacheLIRS.java#L1057]
- 
[Segment.refresh()|https://github.com/apache/jackrabbit-oak/blob/34f6b27228539a5f7f9e305fa44d67d193dbe419/oak-core-spi/src/main/java/org/apache/jackrabbit/oak/cache/CacheLIRS.java#L1126]

The latter two are in a synchronized block, while the first one is not.

Segment.load() is called in Segment.get() at two locations. Neither of them 
serializes access to loadSuccessCount.

> FileCacheTest.getDifferentConcurrent() fails occasionally
> ---------------------------------------------------------
>
>                 Key: OAK-9879
>                 URL: https://issues.apache.org/jira/browse/OAK-9879
>             Project: Jackrabbit Oak
>          Issue Type: Task
>          Components: blob-plugins
>            Reporter: Marcel Reutegger
>            Priority: Minor
>
> The test sometimes fails with
> {noformat}
> java.lang.AssertionError: expected:<2> but was:<1>
>       at org.junit.Assert.fail(Assert.java:89)
>       at org.junit.Assert.failNotEquals(Assert.java:835)
>       at org.junit.Assert.assertEquals(Assert.java:647)
>       at org.junit.Assert.assertEquals(Assert.java:633)
>       at 
> org.apache.jackrabbit.oak.plugins.blob.FileCacheTest.assertCacheStats(FileCacheTest.java:566)
>       at 
> org.apache.jackrabbit.oak.plugins.blob.FileCacheTest.getDifferentConcurrent(FileCacheTest.java:267)
> {noformat}
> I can reproduce locally when running the test repeatedly. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to