[ 
https://issues.apache.org/jira/browse/RATIS-2017?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tsz-wo Sze updated RATIS-2017:
------------------------------
    Component/s: server

[~duongnguyen], thanks for filing this bug!  You are right that it needs the 
write lock.

> CheckAndEvictCache must be done in writeLock
> --------------------------------------------
>
>                 Key: RATIS-2017
>                 URL: https://issues.apache.org/jira/browse/RATIS-2017
>             Project: Ratis
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.0.0
>            Reporter: Duong
>            Assignee: Duong
>            Priority: Critical
>
> RATIS-1893 moved checkAndEvictCache to a separate thread. 
> This opens a condition race between evictCache and normal log operations like 
> get/put. 
> Before RATIS-1893, checkAndEvictCache was called from appendEntryImpl and 
> safe under a writeLock().
>  
> I noticed this error because there are get/put operations intervene with the 
> EntryCache eviction during testing zero-copy:
> {code:java}
> void clear() {
>   map.values().forEach(ReferenceCountedObject::release);
>   map.clear();
>   size.set(0);
> } {code}



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

Reply via email to