You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Michael Dürig (JIRA)" <ji...@apache.org> on 2016/10/24 10:14:58 UTC

[jira] [Commented] (OAK-4972) Unprotected access to TAR readers and writer

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

Michael Dürig commented on OAK-4972:
------------------------------------

bq. 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.

How so? {{FileStore.readers}} is declared volatile and all {{TarReader}} fields are either final or volatile. 

> 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)