[RFC][icedtea-web] PR833 - icedtea-web is failing when cache is corupted.

Jiri Vanek jvanek at redhat.com
Tue Dec 13 08:36:17 PST 2011

2011-12-13 Jiri Vanek <jvanek at redhat.com>

	Fix for PR844
	* netx/net/sourceforge/jnlp/cache/CacheLRUWrapper.java:	(getLRUSortedEntries)
	instead of error throwing own LRU exception. Also catches more then NumberFormatException
	(clearLRUSortedEntries) new method - making soft clearing of cache public
	(clearCache) now return true if cache was cleared, false otherwise (or exception)
	* netx/net/sourceforge/jnlp/cache/CacheUtil.java: (getCacheFileIfExist) does three tires to load cache.
	If ifrst fails, then recently_used file is emptied both in memory and on disc.
	When second attemmpt fails, then LRU cache is forcibly cleared. if clearing fails, then error is thrown.
	If it pass, then one more try to load entries is allowed. When third attempt fails, then error is  thrown.
	* /netx/net/sourceforge/jnlp/cache/LruCacheException.java:
	new file, for purpose of catching this particular exception
	* netx/net/sourceforge/jnlp/util/PropertiesFile.java: (store) tries to mkdirs to its path.
	It is better then to fail when no cache directory exists.
	* tests/jnlp_tests/signed/CacheReproducer: new  reproducr trying severals way of corupted cache
	 on several types of jnlp files. Is signed because of reflection used.
	* tests/jnlp_tests/signed/SimpletestSigned1: signed hello world to be used in  CacheReproducer tests.
	* tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ServerAccess.java: timeout for processes doubled,
	as clear cache methods sometimes took more then original allowed.

When badly formated recently_used file is saved (or better not-save-correctly eg because of kill -9 signal) then netx is not starting, but is throwing out error.
Solution to this is caal netx with -Xclearcache. From my point of view, it should at least warn user and suggest this option, but better can be to clear cache and (recommend) restart iself/toUser.
I also beive, that it can simply just continue running.
*warn user and terminate, can be done in any time
*forcibly clear cache during runtime can be dangerous, as some jars already correctly loaded from cache can depend on this local copy (and what about another instances of netx!)and though netx will much more mysteriously fail later
        - I was unable to reproduce this behaviour (see testAlreadyLoadedCached1,2,11 and 21 - I was trying to do this, but not sure if successfully)
        - to try to clear cache (will not be successful in if another netx instance is running), recommend run javaws -Xclearcache and restart and terminate can be the best fix
*to fake cache  -  is what I do now. It clear cache metadata in  memory and on disc (recently-used). Then continue loading.
        -if this will not help, clear cache is tried, but I was unable to reproduce this possibility - "soft" clearing of cache solved all problems.
        -it is not affecting already running javawss, but can cause problems when two javaws are trying to start simultaneously-but I was unable to reproduce this behaviour too (see startParalelInstancesUponBrokenCache test)\

Any hints welcomed!
Best Regards
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: LRUcachePatch.diff2
Url: http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20111213/29e85ce6/LRUcachePatch.diff2 

More information about the distro-pkg-dev mailing list