History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: CACHE-246
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Lars Torunski
Reporter: Ethan Adams
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
OSCache

java.util.NoSuchElementException during at com.opensymphony.oscache.base.Cache.putInCache()

Created: 09/May/06 05:56 AM   Updated: 21/Jan/07 01:55 PM
Component/s: Tags
Affects Version/s: 2.0.1
Fix Version/s: 2.3.1

Environment: JDK1.4
Issue Links:
Related
This issue relates to:
CACHE-74 java.util.NoSuchElementException duri... Major Closed
This issue is related to:
CACHE-39 LRUCache has multi-threading issues Major Closed
CACHE-44 Multi threading issues with LRU Cache Major Closed


 Description  « Hide
java.util.NoSuchElementException
        at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(LinkedHashMap.java:356)
        at java.util.LinkedHashMap$KeyIterator.next(LinkedHashMap.java:365)
        at com.opensymphony.oscache.base.algorithm.LRUCache.removeFirst(LRUCache.java:219)
        at com.opensymphony.oscache.base.algorithm.LRUCache.removeItem(LRUCache.java:188)
        at com.opensymphony.oscache.base.algorithm.AbstractConcurrentReadCache.put(AbstractConcurrentReadCache.java:1520)
        at com.opensymphony.oscache.base.algorithm.AbstractConcurrentReadCache.put(AbstractConcurrentReadCache.java:841)
        at com.opensymphony.oscache.base.Cache.putInCache(Cache.java:554)
        at com.opensymphony.oscache.base.Cache.putInCache(Cache.java:525)
        at com.opensymphony.oscache.web.tag.CacheTag.doAfterBody(CacheTag.java:360)
        at _xml_0series__jsp._jspService(_xml_0series__jsp.java:108)
        at com.caucho.jsp.JavaPage.service(JavaPage.java:74)
        at com.caucho.jsp.Page.subservice(Page.java:485)
        at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:181)
        at com.caucho.server.http.Invocation.service(Invocation.java:291)
        at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:132)
        at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:217)
        at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:159)
        at com.caucho.server.TcpConnection.run(TcpConnection.java:136)
        at java.lang.Thread.run(Thread.java:536)


 All   Comments   Change History      Sort Order:
Ethan Adams - [09/May/06 05:58 AM ]
I added comments to cache-74, but never got a response, so I created a new issue:

I see this exception in oscache 2.3 on java 1.5

I looked into the LRUCache code and found this method and comments :

protected void itemRetrieved(Object key) {
        // Prevent list operations during remove
        while (removeInProgress) {
            try {
                Thread.sleep(5);
            } catch (InterruptedException ie) {
            }
        }

// We need to synchronize here because AbstractConcurrentReadCache
        // doesn't prevent multiple threads from calling this method simultaneously.
        synchronized (list) {
            list.remove(key);
            list.add(key);
        }
    }

If this method can be called in an unsynchronized way, don't you have to synchronize on "list" whenever it is accessed in LRUCache (ex. itemRemoved() and removeFirst() ), even if the method calling is syncronized?

Can anyone provide some insight into this

Lars Torunski - [10/May/06 12:27 AM ]
Is the stack trace from 2.0.1 or 2.3. Please add a new stack trace for further debugging.

Ethan Adams - [10/May/06 06:16 AM ]
Sorry, the stack trace above is from 2.0.1 here is the stack trace from 2.3 (I've excluded my code before the putInCache call):

java.util.NoSuchElementException
        at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(LinkedHashMap.java:367)
        at java.util.LinkedHashMap$KeyIterator.next(LinkedHashMap.java:376)
        at com.opensymphony.oscache.base.algorithm.LRUCache.removeFirst(LRUCache.java:149)
        at com.opensymphony.oscache.base.algorithm.LRUCache.removeItem(LRUCache.java:125)
        at com.opensymphony.oscache.base.algorithm.AbstractConcurrentReadCache.put(AbstractConcurrentReadCache.java:1563)
        at com.opensymphony.oscache.base.algorithm.AbstractConcurrentReadCache.put(AbstractConcurrentReadCache.java:863)
        at com.opensymphony.oscache.base.Cache.putInCache(Cache.java:615)
        at com.opensymphony.oscache.base.Cache.putInCache(Cache.java:569)

Lars Torunski - [14/May/06 09:36 AM ]
Ethan, this problem should be fixed in the current CVS HEAD. Please give us feedback, if you havn't any problem anymore.

http://wiki.opensymphony.com/display/CACHE/CVS+and+Compiling+OSCache