commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Mason <cma...@cmason.com>
Subject VFS: bug in zip file system?
Date Wed, 14 Oct 2009 06:44:54 GMT

Hi.

It seems like there may be a bug in VFS's ZipFileSystem.  This seems to 
still exist on trunk.

ZipFileSystem.init() recurses through the zip file and stuffs 
ZipFileObjects in the cache.  The cache is by default using soft 
references to hold onto the files.  The ZipFileSystem makes sure that 
all of the ZipFileObjects hold strong references onto all of the other 
ZipFileObjects.  However, the FileSystem itself doesn't hold a strong 
reference to any of the ZipFileObjects.

So if the soft reference to the file objects gets cleared, but the 
filesystem is strongly held, it's possible that it appears as though 
there are no files in the zip file, since ZipFileSystem only works for 
files that are in the cache.  (It's createFile() implementation only 
returns files that appear not to exist.)

We see this happening intermittently in production environments, where 
zip/jar files that clearly exist and clearly contain the file in 
question occasionally throw exceptions stating that the file or 
directory does not exist.  This seems to happen more often very early in 
the process when there are no other hard references to these files.

Once possible fix maybe to simply hold strongly onto the array of 
ZipFileObjects in the ZipFileSystem; I have a two line patch that does 
this.  This has obvious memory consequences.  However the filesystem 
itself seems to be softly held in the cache and could be collected, and 
furthermore I don't see that the system is correct otherwise.

Thanks,

-c

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


Mime
View raw message