You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Raman Gupta (JIRA)" <ji...@apache.org> on 2007/04/04 08:19:32 UTC

[jira] Created: (VFS-122) [vfs] Synchronization issue in SoftRefFilesCache

[vfs] Synchronization issue in SoftRefFilesCache
------------------------------------------------

                 Key: VFS-122
                 URL: https://issues.apache.org/jira/browse/VFS-122
             Project: Commons VFS
          Issue Type: Bug
    Affects Versions: 1.0
         Environment: Sun Solaris, JDK 1.5.0_08
            Reporter: Raman Gupta


I am using Commons VFS 1.0 RC8, and I believe I have found a
synchronization problem in SoftRefFilesCache.java. My system
occasionally exhibits high CPU usage in a thread with the stack shown
below [1]. The problem method is a HashMap.put at line 155 -- though I
think the line number is actually 156, since 155 is a TreeMap.put.

Access to the refReverseMap is not synchronized (nor is the map itself
synchronized) which I believe is the problem. On multi-cpu machines,
this can cause race conditions in HashMap.

[1] Thread stack:

"Thread-28" prio=10 tid=0x00f56090 nid=0x34 runnable
[0xa787d000..0xa787f8f0]
        at java.util.HashMap.put(HashMap.java:420)
        at org.apache.commons.vfs.cache.SoftRefFilesCache.putFile(SoftRefFilesCache.java:155)
        - locked <0xb7a09558> (a java.util.TreeMap)
        at org.apache.commons.vfs.provider.AbstractFileSystem.putFileToCache(AbstractFileSystem.java:163)
        at org.apache.commons.vfs.provider.AbstractFileSystem.resolveFile(AbstractFileSystem.java:306)
        - locked <0xb791bfe8> (a org.apache.commons.vfs.provider.local.LocalFileSystem)
        at org.apache.commons.vfs.provider.AbstractFileSystem.resolveFile(AbstractFileSystem.java:264)
        - locked <0xb791bfe8> (a org.apache.commons.vfs.provider.local.LocalFileSystem)
        at org.apache.commons.vfs.provider.AbstractFileSystem.getRoot(AbstractFileSystem.java:239)
        at org.apache.commons.vfs.provider.AbstractFileObject.getParent(AbstractFileObject.java:485)
        at org.apache.commons.vfs.provider.AbstractFileObject.isWriteable(AbstractFileObject.java:466)
        at org.apache.commons.vfs.provider.AbstractFileObject.getOutputStream(AbstractFileObject.java:1148)
        at org.apache.commons.vfs.provider.DefaultFileContent.getOutputStream(DefaultFileContent.java:367)
        at org.apache.commons.vfs.provider.DefaultFileContent.getOutputStream(DefaultFileContent.java:350)
        [...]


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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org