Bug 39612 - Sudden Nullpointerexception in LRUCache
Summary: Sudden Nullpointerexception in LRUCache
Status: RESOLVED LATER
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Cache Taglib (show other bugs)
Version: 1.2.0
Hardware: Other Linux
: P2 critical (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-18 17:12 UTC by Ulrik Bo Larsen
Modified: 2009-11-29 19:38 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ulrik Bo Larsen 2006-05-18 17:12:56 UTC
After running the Cache Taglib successfully in a JBoss 4.x.x environment for
many months, I have suddenly experienced a very nasty NullpointerException on
the frontpage of our high volume site, where the tag is used to cache dynamic
list contents in session scope. 

I have not configured the tag using a CacheUtil class but using the default
parameters.

This happened for all users/sessions requesting the front page.

An immediate restart of JBoss solved the issue - but obviously this is highly
worrying. 

I have scoured bugzilla and tried to Google for something similar from CacheTag
users to no avail.

Looking into the LRUCache class and comparing to my stack trace it seems that in
same strange scenario the key can be null, but still return valid entries from
the cache. A NullPointerException then occurs when trying to update the LRU list
in the noteUsed method afterwords.

18:12:53,755 ERROR [Engine] StandardWrapperValve[jsp]: Servlet.service() for ser
                                                                            vlet
jsp threw exception
java.lang.NullPointerException
        at java.util.LinkedList.remove(LinkedList.java:220)
        at org.apache.taglibs.cache.LRUCache.noteUsed(LRUCache.java:199)
        at org.apache.taglibs.cache.LRUCache.get(LRUCache.java:115)
        at org.apache.taglibs.cache.CacheTag.doStartTag(CacheTag.java:49)
        at org.apache.jsp.index_jsp._jspService(index_jsp.java:528)

Could this be a threading issue or what?
Comment 1 Kris Schneider 2006-05-19 14:50:53 UTC
It certainly could be a threading/concurrency issue. I've never used the taglib
before, but I took a quick look through the code. It's a bit disturbing that
there's literally no synchronization anywhere in the taglib when it's likely
that caches are stored in shared scopes (session and application).
Comment 2 Henri Yandell 2009-11-29 19:38:06 UTC
Resolving. Taglib has been retired.