You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Emanuele Maiarelli <em...@mengozzi.com> on 2009/10/17 21:49:02 UTC

cayenne tomcat memory management

I'm using cayenne 3 with tomcat, and im getting context by this way
..
DataContext dc= ServletUtil.getSessionContext(sess)
...
using httpsessioncontext.

To ensure session to be closed i implemented logout from session  by 
calling

...
   <%session.invalidate();%>
...


But after many sessions opened, i step into memory lacks even if 
application retrive few data from database.

Any hint?

PS: i tried to use  getThreadObjectContext but was unable to do it. Any 
example about using ThreadObjectContext?





Re: cayenne tomcat memory management

Posted by Emanuele Maiarelli <em...@mengozzi.com>.
Thanks for the advice
Andrus Adamchik ha scritto:
>
> On Oct 22, 2009, at 3:09 PM, Emanuele Maiarelli wrote:
>
>> leaks are produced by frequent context reload, issued by netbeans 
>> redeploying webapplication in tomcat,
>> but im looking more closely
>
> Ok you didn't mention that in the original message. Most likely this 
> has nothing to do with Cayenne or your webapp (or Tomcat for that 
> matter). Hot redeployment always leads to an eventual JVM death as it 
> runs out of PermGen memory space that stores class definitions. While 
> some blame developers for creating such a leak [1], I personally gave 
> up on trying to make hot redeploy work, and would just restart the 
> container every time.
>
> Andrus
>
> [1] 
> http://blogs.sun.com/fkieviet/entry/classloader_leaks_the_dreaded_java
>


Re: cayenne tomcat memory management

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Oct 22, 2009, at 3:09 PM, Emanuele Maiarelli wrote:

> leaks are produced by frequent context reload, issued by netbeans  
> redeploying webapplication in tomcat,
> but im looking more closely

Ok you didn't mention that in the original message. Most likely this  
has nothing to do with Cayenne or your webapp (or Tomcat for that  
matter). Hot redeployment always leads to an eventual JVM death as it  
runs out of PermGen memory space that stores class definitions. While  
some blame developers for creating such a leak [1], I personally gave  
up on trying to make hot redeploy work, and would just restart the  
container every time.

Andrus

[1] http://blogs.sun.com/fkieviet/entry/classloader_leaks_the_dreaded_java


Re: cayenne tomcat memory management

Posted by Emanuele Maiarelli <em...@mengozzi.com>.
As far as i can see the leaks are produced by frequent context reload, 
issued by netbeans redeploying webapplication in tomcat,
but im looking more closely, first i'll try with ThreadObjectContext
Andrey Razumovsky ha scritto:
> Hi,
>
> What can produce memory leaks in Cayenne3 is shared query cache. Are you
> using it? Anyways, the best option will be to try profiling your application
> to see what produces leaks.
> Here's an example of getThreadObjectContext():
> http://cayenne.apache.org/doc/web-applications.html
>
> Hope that helps,
>
> 2009/10/17 Emanuele Maiarelli <em...@mengozzi.com>
>
>   
>> I'm using cayenne 3 with tomcat, and im getting context by this way
>> ..
>> DataContext dc= ServletUtil.getSessionContext(sess)
>> ...
>> using httpsessioncontext.
>>
>> To ensure session to be closed i implemented logout from session  by
>> calling
>>
>> ...
>>  <%session.invalidate();%>
>> ...
>>
>>
>> But after many sessions opened, i step into memory lacks even if
>> application retrive few data from database.
>>
>> Any hint?
>>
>> PS: i tried to use  getThreadObjectContext but was unable to do it. Any
>> example about using ThreadObjectContext?
>>
>>
>>
>>
>>
>>     
>
>
>   


Re: cayenne tomcat memory management

Posted by Andrey Razumovsky <ra...@gmail.com>.
Hi,

What can produce memory leaks in Cayenne3 is shared query cache. Are you
using it? Anyways, the best option will be to try profiling your application
to see what produces leaks.
Here's an example of getThreadObjectContext():
http://cayenne.apache.org/doc/web-applications.html

Hope that helps,

2009/10/17 Emanuele Maiarelli <em...@mengozzi.com>

> I'm using cayenne 3 with tomcat, and im getting context by this way
> ..
> DataContext dc= ServletUtil.getSessionContext(sess)
> ...
> using httpsessioncontext.
>
> To ensure session to be closed i implemented logout from session  by
> calling
>
> ...
>  <%session.invalidate();%>
> ...
>
>
> But after many sessions opened, i step into memory lacks even if
> application retrive few data from database.
>
> Any hint?
>
> PS: i tried to use  getThreadObjectContext but was unable to do it. Any
> example about using ThreadObjectContext?
>
>
>
>
>


-- 
Andrey