You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Flavius <fl...@silverlion.com> on 2009/05/27 22:41:37 UTC

OutOfMemory on certain combinations of controls

 
I ran into an issue where I'm getting an OutOfMemory error using
autocomplete textbox functionality.

I haven't nailed down the root culprit, but the symptoms seem to
occur when I have a page with a border that also has controls,
such as a panel or two.

On the page, if I pop a modal dialog box (with ajax auto-complete) 
and type into the auto-complete textbox, after some 15-20 
key presses, I'll get the OutOfMemory error.

If I remove the reference to the window in the modal dialog
box, it doesn't occur.  Also, if I use inheritance and a child
page instead of a page with border, it doesn't seem to occur.

I'm testing this with JDK 1.6_07 and ran it in Tomcat 6.0.14.
I used Jconsole to watch the heap.  After some 15-20 key
presses, each subsequent keypress is increasing the heap
memory usage by several megs.

I looked at the heap dump in MAT and it's showing me 3 huge
byte[].  I just started using this tool.  If I'm reading this right,
it seems to have a lot of threads eating up the heap.

This might be hard to reproduce, so I put together a little
demo app that can be downloaded at 
http://silverlion.com/tmp2/wicket_test.zip. It's an eclipse
project I just zipped up.

I did all this with wicket 1.3.6, but also went back to 1.3.5
to test that.  I get the same results.

I wanted to post the question here before I opened an issue
in jira to see if anybody experienced this.

I tried running this with -Xmx256m -Xms256m and also 512
MB of memory.  I still get the error on my dev box running
tomcat in eclipse and also building the war and deploying
it to tomcat outside a dev env.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: OutOfMemory on certain combinations of controls

Posted by Martijn Dashorst <ma...@gmail.com>.
Please file a jira issue and Attach the quickstart. Saves a lot of hunting.

Use the power of jira!

Martijn

On Friday, May 29, 2009, Flavius <fl...@silverlion.com> wrote:
>
>
> I put a quickstart build up at http://silverlion.com/tmp2/OutOfMemory.zip.
>
> Just unzip it, change to that dir and run mvn jetty:run and go to
> http://localhost:8080/OutOfMemory
>
> It has just one page, one modal window, one border, and one panel.
> The steps to repro this are there on the home page.
>
> Thanks for your help, Igor.
>
>
>
> igor.vaynberg wrote:
>>
>> there is too much going on in the sample you posted. if you want you
>> can create a quickstart with the minimal amount of code necessary to
>> reproduce this and i will take a look.
>>
>> -igor
>>
>> On Thu, May 28, 2009 at 2:12 PM, Flavius <fl...@silverlion.com> wrote:
>>>
>>>
>>> The sample I posted only has the single page with a link to the
>>> ModalWindow.
>>> The modal window keeps a reference to the ModalWindow param passed in
>>> to the constructor.  That's only used to close the window when the
>>> AjaxRequestTarget is passed from the AjaxLink.
>>>
>>> When the OnChangeAjaxBehavior#onUpdate fires, it's rebuilding the
>>> repeating view and adding the WebMarkupContainer wrapper to the
>>> AjaxRequestTarget.
>>>
>>> So it's not keeping any references that I see.
>>>
>>>
>>>
>>> igor.vaynberg wrote:
>>>>
>>>> make sure you dont keep page references across pages. that may be it.
>>>>
>>>> -igor
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/OutOfMemory-on-certain-combinations-of-controls-tp23750424p23770219.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>
> --
> View this message in context: http://www.nabble.com/OutOfMemory-on-certain-combinations-of-controls-tp23750424p23786803.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: OutOfMemory on certain combinations of controls

Posted by Flavius <fl...@silverlion.com>.

Thanks Igor.  I didn't think about the callback keeping a reference to the
calling page.

I appreciate your help.


igor.vaynberg wrote:
> 
> the problem is the page inside the modal window has a reference to the
> outer page - you pass the modal window which has an anonymous close
> callback which keeps a reference to the page. so you keep serializing
> the entire page with every ajax request as part of the current page.
> 
> you dont need the reference to the modalwindow, you can use
> ModalWindow.closeCurrent() to close it.
> 
> -igor
> 
> On Fri, May 29, 2009 at 1:45 PM, Flavius <fl...@silverlion.com> wrote:
>>
>>
>> I put a quickstart build up at
>> http://silverlion.com/tmp2/OutOfMemory.zip.
>>
>> Just unzip it, change to that dir and run mvn jetty:run and go to
>> http://localhost:8080/OutOfMemory
>>
>> It has just one page, one modal window, one border, and one panel.
>> The steps to repro this are there on the home page.
>>
>> Thanks for your help, Igor.
>>
>>
>>
>> igor.vaynberg wrote:
>>>
>>> there is too much going on in the sample you posted. if you want you
>>> can create a quickstart with the minimal amount of code necessary to
>>> reproduce this and i will take a look.
>>>
>>> -igor
>>>
>>> On Thu, May 28, 2009 at 2:12 PM, Flavius <fl...@silverlion.com> wrote:
>>>>
>>>>
>>>> The sample I posted only has the single page with a link to the
>>>> ModalWindow.
>>>> The modal window keeps a reference to the ModalWindow param passed in
>>>> to the constructor.  That's only used to close the window when the
>>>> AjaxRequestTarget is passed from the AjaxLink.
>>>>
>>>> When the OnChangeAjaxBehavior#onUpdate fires, it's rebuilding the
>>>> repeating view and adding the WebMarkupContainer wrapper to the
>>>> AjaxRequestTarget.
>>>>
>>>> So it's not keeping any references that I see.
>>>>
>>>>
>>>>
>>>> igor.vaynberg wrote:
>>>>>
>>>>> make sure you dont keep page references across pages. that may be it.
>>>>>
>>>>> -igor
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/OutOfMemory-on-certain-combinations-of-controls-tp23750424p23770219.html
>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/OutOfMemory-on-certain-combinations-of-controls-tp23750424p23786803.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/OutOfMemory-on-certain-combinations-of-controls-tp23750424p23799634.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: OutOfMemory on certain combinations of controls

Posted by Marcin Palka <ma...@gmail.com>.
Should it be considered a bad design to use callbacks from a modal window? I
use modal windows to edit rows from a grid. On save action I close the modal
window and then call a callback method back in the the calling panel which
makes the grid refresh. Does this approach carry any risk? What approach do
you guys suggest to solve this?

Marcin
-- 
View this message in context: http://www.nabble.com/OutOfMemory-on-certain-combinations-of-controls-tp23750424p23814865.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: OutOfMemory on certain combinations of controls

Posted by Igor Vaynberg <ig...@gmail.com>.
the problem is the page inside the modal window has a reference to the
outer page - you pass the modal window which has an anonymous close
callback which keeps a reference to the page. so you keep serializing
the entire page with every ajax request as part of the current page.

you dont need the reference to the modalwindow, you can use
ModalWindow.closeCurrent() to close it.

-igor

On Fri, May 29, 2009 at 1:45 PM, Flavius <fl...@silverlion.com> wrote:
>
>
> I put a quickstart build up at http://silverlion.com/tmp2/OutOfMemory.zip.
>
> Just unzip it, change to that dir and run mvn jetty:run and go to
> http://localhost:8080/OutOfMemory
>
> It has just one page, one modal window, one border, and one panel.
> The steps to repro this are there on the home page.
>
> Thanks for your help, Igor.
>
>
>
> igor.vaynberg wrote:
>>
>> there is too much going on in the sample you posted. if you want you
>> can create a quickstart with the minimal amount of code necessary to
>> reproduce this and i will take a look.
>>
>> -igor
>>
>> On Thu, May 28, 2009 at 2:12 PM, Flavius <fl...@silverlion.com> wrote:
>>>
>>>
>>> The sample I posted only has the single page with a link to the
>>> ModalWindow.
>>> The modal window keeps a reference to the ModalWindow param passed in
>>> to the constructor.  That's only used to close the window when the
>>> AjaxRequestTarget is passed from the AjaxLink.
>>>
>>> When the OnChangeAjaxBehavior#onUpdate fires, it's rebuilding the
>>> repeating view and adding the WebMarkupContainer wrapper to the
>>> AjaxRequestTarget.
>>>
>>> So it's not keeping any references that I see.
>>>
>>>
>>>
>>> igor.vaynberg wrote:
>>>>
>>>> make sure you dont keep page references across pages. that may be it.
>>>>
>>>> -igor
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/OutOfMemory-on-certain-combinations-of-controls-tp23750424p23770219.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>
> --
> View this message in context: http://www.nabble.com/OutOfMemory-on-certain-combinations-of-controls-tp23750424p23786803.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: OutOfMemory on certain combinations of controls

Posted by Flavius <fl...@silverlion.com>.

I put a quickstart build up at http://silverlion.com/tmp2/OutOfMemory.zip.

Just unzip it, change to that dir and run mvn jetty:run and go to
http://localhost:8080/OutOfMemory

It has just one page, one modal window, one border, and one panel.
The steps to repro this are there on the home page.

Thanks for your help, Igor.



igor.vaynberg wrote:
> 
> there is too much going on in the sample you posted. if you want you
> can create a quickstart with the minimal amount of code necessary to
> reproduce this and i will take a look.
> 
> -igor
> 
> On Thu, May 28, 2009 at 2:12 PM, Flavius <fl...@silverlion.com> wrote:
>>
>>
>> The sample I posted only has the single page with a link to the
>> ModalWindow.
>> The modal window keeps a reference to the ModalWindow param passed in
>> to the constructor.  That's only used to close the window when the
>> AjaxRequestTarget is passed from the AjaxLink.
>>
>> When the OnChangeAjaxBehavior#onUpdate fires, it's rebuilding the
>> repeating view and adding the WebMarkupContainer wrapper to the
>> AjaxRequestTarget.
>>
>> So it's not keeping any references that I see.
>>
>>
>>
>> igor.vaynberg wrote:
>>>
>>> make sure you dont keep page references across pages. that may be it.
>>>
>>> -igor
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/OutOfMemory-on-certain-combinations-of-controls-tp23750424p23770219.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
> 
> 

-- 
View this message in context: http://www.nabble.com/OutOfMemory-on-certain-combinations-of-controls-tp23750424p23786803.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: OutOfMemory on certain combinations of controls

Posted by Igor Vaynberg <ig...@gmail.com>.
there is too much going on in the sample you posted. if you want you
can create a quickstart with the minimal amount of code necessary to
reproduce this and i will take a look.

-igor

On Thu, May 28, 2009 at 2:12 PM, Flavius <fl...@silverlion.com> wrote:
>
>
> The sample I posted only has the single page with a link to the ModalWindow.
> The modal window keeps a reference to the ModalWindow param passed in
> to the constructor.  That's only used to close the window when the
> AjaxRequestTarget is passed from the AjaxLink.
>
> When the OnChangeAjaxBehavior#onUpdate fires, it's rebuilding the
> repeating view and adding the WebMarkupContainer wrapper to the
> AjaxRequestTarget.
>
> So it's not keeping any references that I see.
>
>
>
> igor.vaynberg wrote:
>>
>> make sure you dont keep page references across pages. that may be it.
>>
>> -igor
>>
>>
>
> --
> View this message in context: http://www.nabble.com/OutOfMemory-on-certain-combinations-of-controls-tp23750424p23770219.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: OutOfMemory on certain combinations of controls

Posted by Flavius <fl...@silverlion.com>.

The sample I posted only has the single page with a link to the ModalWindow.
The modal window keeps a reference to the ModalWindow param passed in
to the constructor.  That's only used to close the window when the
AjaxRequestTarget is passed from the AjaxLink.

When the OnChangeAjaxBehavior#onUpdate fires, it's rebuilding the 
repeating view and adding the WebMarkupContainer wrapper to the
AjaxRequestTarget.

So it's not keeping any references that I see.



igor.vaynberg wrote:
> 
> make sure you dont keep page references across pages. that may be it.
> 
> -igor
> 
> 

-- 
View this message in context: http://www.nabble.com/OutOfMemory-on-certain-combinations-of-controls-tp23750424p23770219.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: OutOfMemory on certain combinations of controls

Posted by Igor Vaynberg <ig...@gmail.com>.
make sure you dont keep page references across pages. that may be it.

-igor

On Wed, May 27, 2009 at 1:41 PM, Flavius <fl...@silverlion.com> wrote:
>
> I ran into an issue where I'm getting an OutOfMemory error using
> autocomplete textbox functionality.
>
> I haven't nailed down the root culprit, but the symptoms seem to
> occur when I have a page with a border that also has controls,
> such as a panel or two.
>
> On the page, if I pop a modal dialog box (with ajax auto-complete)
> and type into the auto-complete textbox, after some 15-20
> key presses, I'll get the OutOfMemory error.
>
> If I remove the reference to the window in the modal dialog
> box, it doesn't occur.  Also, if I use inheritance and a child
> page instead of a page with border, it doesn't seem to occur.
>
> I'm testing this with JDK 1.6_07 and ran it in Tomcat 6.0.14.
> I used Jconsole to watch the heap.  After some 15-20 key
> presses, each subsequent keypress is increasing the heap
> memory usage by several megs.
>
> I looked at the heap dump in MAT and it's showing me 3 huge
> byte[].  I just started using this tool.  If I'm reading this right,
> it seems to have a lot of threads eating up the heap.
>
> This might be hard to reproduce, so I put together a little
> demo app that can be downloaded at
> http://silverlion.com/tmp2/wicket_test.zip. It's an eclipse
> project I just zipped up.
>
> I did all this with wicket 1.3.6, but also went back to 1.3.5
> to test that.  I get the same results.
>
> I wanted to post the question here before I opened an issue
> in jira to see if anybody experienced this.
>
> I tried running this with -Xmx256m -Xms256m and also 512
> MB of memory.  I still get the error on my dev box running
> tomcat in eclipse and also building the war and deploying
> it to tomcat outside a dev env.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org