[ 
https://issues.apache.org/jira/browse/VFS-253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12706956#action_12706956
 ] 

Marek Zawirski commented on VFS-253:
------------------------------------

I tried to patch it, but I gave up, at least for now, as semantic of this class 
in context {{AbstractFileObject#close()}} is unclear for me.

After further close-up at {{DefaultFileContent}}  it appears it may have more 
synchronization issues that may lead to race conditions:
- unsynchronized single-read or single-write of non-volatile fields (like 
{{resetAttributes}})
- lack of double-checked locks (like in {{getAttributes()}}) or other issues 
causing unnecessary performing some operations twice
- concurrent access to attrs map
- possibly others...

> AbstractFileObject: wrong synchronization of content-related code
> -----------------------------------------------------------------
>
>                 Key: VFS-253
>                 URL: https://issues.apache.org/jira/browse/VFS-253
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Marek Zawirski
>
> Creating content through {{AbstractFileObject#getContent()}} and 
> {{DefaultFileContent}} itself seem to be synchronized, but closing the 
> content by {{AbstractFileObject#close()}} and checking whether it is open, by 
> {{AbstractFileObject#isContentOpen()}} are NOT synchronized.
> Both these methods miss some lock-object. For {{close()}} it may result in 
> severe race condition in case of {{FileObject}} shared across more than one 
> thread.
> BTW, thead-safeness of important VFS classes/interfaces like {{FileObject}} 
> is not documented in javadoc.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to