Francesco Mari created OAK-4972:
-----------------------------------

             Summary: Unprotected access to TAR readers and writer
                 Key: OAK-4972
                 URL: https://issues.apache.org/jira/browse/OAK-4972
             Project: Jackrabbit Oak
          Issue Type: Bug
          Components: segment-tar
            Reporter: Francesco Mari
            Assignee: Francesco Mari
             Fix For: Segment Tar 0.0.18


The TAR readers and writers are sporadically accessed outside of the r/w lock 
that should protect them.

The TAR readers are accessed outside of the r/w lock in 
FileStore.containsSegment() and FileStore.readSegment(). This might introduce 
visibility issues - some threads might see stale data because of improper 
synchronization.

The TAR writer is accessed outside of the r/w lock in FileStore.flush(). Even 
if the access is protected by another lock (the flush lock), not using the same 
r/w lock to access the TAR writer in this context might introduce visibility 
issues.

Moreover, the r/w lock is sometimes used when accessing data other than the TAR 
readers and writer. This is the case of FileStore.close() accessing the file 
lock and of GarbageCollector.cleanup() accessing the segment cache and the 
segment tracker. This "protected" access might give a false sense of security, 
but is flaky and might introduce deadlocks if other locks are introduce in the 
future.



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

Reply via email to