[Opensymphony-oscache] Deadlock with disk overflow cache
Oliver Weise <[email protected]> Mon, 27 Jun 2005 10:14:47 CDT
| Newsgroups | gmane.comp.java.open-symphony.os-cache |
|---|---|
| Message-ID | <32205966.1119885317769.JavaMail.os-j2ee@opensymphony01.contegix.com> |
Hi everyone,
I think we have a deadlock issue when we use oscache with disk overflow functionality. The program - a web application - runs ok (and uses the cache) for some time. Then the following exception is thrown:
java.lang.IllegalStateException: Cannot cancel cache update - current state (2) is not UPDATE_IN_PROGRESS
...although we only call this method immediately after catching a NeedsRefreshException.
try {
return (Map) _cache.getFromCache(cacheKey);
}
catch (NeedsRefreshException nre) {
_cache.cancelUpdate(cacheKey);
return null;
}
After that some kind of deadlock situation seems to occur. In a java core file we can see that all worker threads wait for the monitor of a LinkedHashSet instance which we think is used by the LRUCache (since we don't use that class anywhere else):
3LKMONOBJECT java.util.LinkedHashSet@1FB531F8/1FB53200: owner "WGPDispatcher.doGet" (0x8FBD4B8), entry count 1
3LKWAITERQ Waiting to enter:
3LKWAITER "WGPDispatcher.doGet" (0x8EF1028)
3LKWAITER "WGPDispatcher.doGet" (0x8FAF8B8)
3LKWAITER "WGPDispatcher.doGet" (0x8FED578)
3LKWAITER "WGPDispatcher.doGet" (0x8F33418)
3LKWAITER "WGPDispatcher.doGet" (0x8F26710)
3LKWAITER "WGPDispatcher.doGet" (0x8F25F10)
3LKWAITER "WGPDispatcher.doGet" (0x7E7A1D0)
3LKWAITER "WGPDispatcher.doGet" (0x8F56E90)
3LKWAITER "WGPDispatcher.doGet" (0x8F4A5B8)
3LKWAITER "WGPDispatcher.doGet" (0x8F36488)
3LKWAITER "WGPDispatcher.doGet" (0x8F5CD90)
3LKWAITER "WGPDispatcher.doGet" (0x8F59E10)
3LKWAITER "WGPDispatcher.doGet" (0x8F29250)
3LKWAITER "WGPDispatcher.doGet" (0x8F28E50)
3LKWAITER "WGPDispatcher.doGet" (0x8F4A1B8)
3LKWAITER "WGPDispatcher.doGet" (0x8E31F48)
3LKWAITER "WGPDispatcher.doGet" (0x8E83038)
3LKWAITER "WGPDispatcher.doGet" (0xC9295F8)
3LKWAITER "WGPDispatcher.doGet" (0xC9291F8)
3LKWAITER "WGPDispatcher.doGet" (0x8FA95F8)
3LKWAITER "WGPDispatcher.doGet" (0x8E695B0)
3LKWAITER "WGPDispatcher.doGet" (0x8EE68F8)
3LKWAITER "WGPDispatcher.doGet" (0x8AA0380)
3LKWAITER "WGPDispatcher.doGet" (0x8E32748)
3LKWAITER "WGPDispatcher.doGet" (0x7F43608)
It looks as if the cache somehow "mismanages" the state of this cache entry. Documentation says that a failure to cancel an update may invoke a deadlock situation. Might it be that somehow the exception is thrown "before" the state is changed? The system that has this problem is a multi processor machine with hyperthreading activated. Maybe some weird multithreading issues?
However when we disable the disk overflow functionality everything is ok.
Here are the configuration properties we use:
cache.memory := true
cache.capacity := 500
cache.algorithm := com.opensymphony.oscache.base.algorithm.LRUCache
cache.blocking := false
cache.persistence.class := com.opensymphony.oscache.plugins.diskpersistence.HashDiskPersistenceListener
cache.path := <some directory>
cache.persistence.overflow.only := true
cache.unlimited.disk := true
Please tell me if I can gather any more info for you to track down this problem.
And of course many thanks for any help!
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=3715&messageID=9347#9347