Recently, I had 2 memory related crashes of my Wicket app. Thanks to the
priceless -XX:+HeapDumpOnOutOfMemoryError option, I had a heap dump to look
at (one crash was due to a GC overhead exception, so no dump there). One
thing that immediately attracted my attention was that there were 116.917
instances of
org.apache.wicket.protocol.http.pagestore.DiskPageStore$SessionEntry. As
objects of this class "represent a session" (javadoc), it seems that I had
116.917 sessions mapped in DiskPageStore.sessionIdToEntryMap.

In my app, i spotted two reasons for this;
1. search engine bots (e.g. googlebot) receive a new session for each page
they access, as we cut of the ;jsessionid= from the URL in our app in order
not to have those ugly IDs on the search engine result pages. As a result,
when google tried to index 100.000+ pages 100.000+ sessions had been
created. I am certainly going to work on this issue, however, it helped me
to spot reason number 2:

2. No entries are removed from DiskPageStore.sessionIdToEntryMap. I guess,
this should be added to the DiskPageStore.unbind(String sessionId) method:

        public void unbind(String sessionId)
        {
                // FIX: replace get() with remove()
                SessionEntry entry = 
(SessionEntry)sessionIdToEntryMap.get(sessionId);
                if (entry != null)
                {
                        if (isSynchronous())
                        {
                                entry.unbind();
                        }
                        else
                        {
                                List pages = getPagesToSaveList(sessionId);
                                synchronized (pages)
                                {
                                        flushPagesToSaveList(sessionId, pages);
                                        entry.unbind();
                                }
                                pagesToSaveAll.remove(sessionId);
                        }
                }
        }

-----
-------
Stefan Fußenegger
http://talk-on-tech.blogspot.com // looking for a nicer domain ;)
-- 
View this message in context: 
http://www.nabble.com/Memory-leak-in-DiskPageStore-tp17597466p17597466.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to