commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raman Gupta <rocketra...@fastmail.fm>
Subject Synchronization bug in SoftRefFilesCache.java
Date Tue, 13 Mar 2007 17:09:46 GMT
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.

I am new to the commons-vfs community so before I file a JIRA bug
report I wanted to report this on the mailing list, and determine if
there is an appropriate process to follow before posting the bug report.

Cheers,
Raman Gupta

[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)
[...]

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


Mime
View raw message