You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Meetesh Karia <me...@gmail.com> on 2008/02/22 13:26:14 UTC

OutOfMemoryError (not PermGen) in PageSavingThread

Hi all,

We're getting an OutOfMemoryError (Wicket 1.3.1 on Tomcat 5.5.17 with 
Sun JVM 1.5.0_06-b05) in the PageSavingThread occasionally and I was 
just wondering if anyone had seen this before.  Is it likely just a 
side-effect of some other problem in our application?  Or is this an 
issue with how the pages are written out in wicket.

Exception in thread "PageSavingThread-wicketFilter" 
java.lang.OutOfMemoryError
    at sun.misc.Unsafe.allocateMemory(Native Method)
    at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:99)
    at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
    at sun.nio.ch.Util.getTemporaryDirectBuffer(Util.java:56)
    at sun.nio.ch.IOUtil.write(IOUtil.java:69)
    at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:651)
    at 
org.apache.wicket.protocol.http.pagestore.DiskPageStore$SessionEntry.savePage(DiskPageStore.java:246)
    at 
org.apache.wicket.protocol.http.pagestore.DiskPageStore.flushPagesToSaveList(DiskPageStore.java:885)
    at 
org.apache.wicket.protocol.http.pagestore.DiskPageStore$PageSavingThread.run(DiskPageStore.java:948)

Thanks in advance,
Meetesh

Re: OutOfMemoryError (not PermGen) in PageSavingThread

Posted by Meetesh Karia <me...@gmail.com>.
Thanks Henrik,

We don't store Page references (we use getPage()) except in one case but 
that's a reference to the current page.  I did come across this 
information about a JVM bug:

http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=414ae2ad0e65bfffffffffabc12f25012527?bug_id=4879883

It looks like there's a property we can try but that it's not 
necessarily and ideal (or even acceptable?) solution?  Sun devs say this 
was fixed in 1.4 but people have been complaining about it in 1.5 and 1.6.

Some more information on this:

http://osdir.com/ml/java.bdbje.general/2005-05/msg00027.html

So, we'll give it a shot and report back to the list (in case others 
come across this problem).  Though ... it does concern me some that we 
would have used up 64mb of direct memory writing out pages.  It appears 
as though the memory is deallocated using a separate thread (in 
java.nio.DirectByteBuffer) so it's possible that wicket is writing out 
pages and using up the direct memory before it can be cleaned up.

Meetesh

Henrik Lundahl wrote:
> Hi
>
> One thing you can check is if you have any references (instance 
> variables, possibly implicit) to pages from your component hierarchy. 
> That seems to cause memory leaks in the serialization. I reported a 
> Jira issue about this yesterday 
> (https://issues.apache.org/jira/browse/WICKET-1365).
>
> Another thing could of course be that there isn't enough memory to 
> store all the concurrent sessions. If you still run out of memory 
> after increasing the limit with the same load, this shouldn't be it, 
> though.
>
>
> BR,
> Henrik
>
>
>
> 2008/2/22, Meetesh Karia <meetesh.karia@gmail.com 
> <ma...@gmail.com>>:
>
>     Hi all,
>
>     We're getting an OutOfMemoryError (Wicket 1.3.1 on Tomcat 5.5.17 with
>     Sun JVM 1.5.0_06-b05) in the PageSavingThread occasionally and I was
>     just wondering if anyone had seen this before.  Is it likely just a
>     side-effect of some other problem in our application?  Or is this an
>     issue with how the pages are written out in wicket.
>
>     Exception in thread "PageSavingThread-wicketFilter"
>     java.lang.OutOfMemoryError
>         at sun.misc.Unsafe.allocateMemory(Native Method)
>         at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:99)
>         at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
>         at sun.nio.ch.Util.getTemporaryDirectBuffer(Util.java:56)
>         at sun.nio.ch.IOUtil.write(IOUtil.java:69)
>         at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:651)
>         at
>     org.apache.wicket.protocol.http.pagestore.DiskPageStore$SessionEntry.savePage(DiskPageStore.java:246)
>         at
>     org.apache.wicket.protocol.http.pagestore.DiskPageStore.flushPagesToSaveList(DiskPageStore.java:885)
>         at
>     org.apache.wicket.protocol.http.pagestore.DiskPageStore$PageSavingThread.run(DiskPageStore.java:948)
>
>     Thanks in advance,
>
>     Meetesh
>
>

Re: OutOfMemoryError (not PermGen) in PageSavingThread

Posted by Henrik Lundahl <he...@gmail.com>.
Hi

One thing you can check is if you have any references (instance variables,
possibly implicit) to pages from your component hierarchy. That seems to
cause memory leaks in the serialization. I reported a Jira issue about this
yesterday (https://issues.apache.org/jira/browse/WICKET-1365).

Another thing could of course be that there isn't enough memory to store all
the concurrent sessions. If you still run out of memory after increasing the
limit with the same load, this shouldn't be it, though.


BR,
Henrik



2008/2/22, Meetesh Karia <me...@gmail.com>:
>
> Hi all,
>
> We're getting an OutOfMemoryError (Wicket 1.3.1 on Tomcat 5.5.17 with
> Sun JVM 1.5.0_06-b05) in the PageSavingThread occasionally and I was
> just wondering if anyone had seen this before.  Is it likely just a
> side-effect of some other problem in our application?  Or is this an
> issue with how the pages are written out in wicket.
>
> Exception in thread "PageSavingThread-wicketFilter"
> java.lang.OutOfMemoryError
>     at sun.misc.Unsafe.allocateMemory(Native Method)
>     at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:99)
>     at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
>     at sun.nio.ch.Util.getTemporaryDirectBuffer(Util.java:56)
>     at sun.nio.ch.IOUtil.write(IOUtil.java:69)
>     at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:651)
>     at
>
> org.apache.wicket.protocol.http.pagestore.DiskPageStore$SessionEntry.savePage
> (DiskPageStore.java:246)
>     at
>
> org.apache.wicket.protocol.http.pagestore.DiskPageStore.flushPagesToSaveList
> (DiskPageStore.java:885)
>     at
>
> org.apache.wicket.protocol.http.pagestore.DiskPageStore$PageSavingThread.run
> (DiskPageStore.java:948)
>
> Thanks in advance,
>
> Meetesh
>