Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 336449

Summary: jetty-maven-plugin fails with OOME: PermGen Space after multiple context reloads
Product: [RT] Jetty Reporter: Peter Schmidt <gevatter.tod>
Component: serverAssignee: Jan Bartel <janb>
Status: CLOSED DUPLICATE QA Contact:
Severity: enhancement    
Priority: P3 CC: jetty-inbox, mgorovoy
Version: 7.2.2   
Target Milestone: 7.2.x   
Hardware: PC   
OS: All   
Whiteboard:

Description Peter Schmidt CLA 2011-02-06 07:14:52 EST
Using jetty-maven-plugin for rapid development with lots of context reloads and holding classes from the WebAppClassLoader in your HttpSessions, you will end with "java.lang.OutOfMemoryError: PermGen space"

There should be an option to remove all sessions when the plugin reloads a context, to avoid any references to classes in the session storage, so the old WebAppClassLoader can be garbage collected.
Comment 1 Jan Bartel CLA 2011-02-27 23:56:42 EST
Peter,

What kind of SessionManager are you using? HashSessionManager? Are you using persistent sessions?

Jan
Comment 2 Peter Schmidt CLA 2011-02-28 14:17:23 EST
I use the default configuration, only setting reload to manual.
I assume its HashSessionManager with no persistent sessions?
Comment 3 Jan Bartel CLA 2011-07-01 00:03:38 EDT
Peter,

When the webapp is reloaded, it is first stopped. During doStop() the SessionManager invalidates and then removes all HttpSessions. So I don't see how the SessionManager can be causing the WebAppClassLoader to be held.

Do you have a small project that exhibits the problem that you can attach to this issue?

thanks
Jan
Comment 4 Michael Gorovoy CLA 2011-07-22 16:49:31 EDT
Here is a couple of blog posts from one of the former Sun GlassFish engineers that are related to this issue.

http://blogs.oracle.com/fkieviet/entry/classloader_leaks_the_dreaded_java
http://blogs.oracle.com/fkieviet/entry/how_to_fix_the_dreaded
Comment 5 Michael Gorovoy CLA 2011-07-22 17:36:54 EDT
Peter, could you please take a look at the documentation page describing possible Out Of Memory error scenarios in Jetty at http://goo.gl/7yTH9 and see if the issue described in the last section applies to your application.

If that scenario does not apply to your application, you should try following the second blog post I linked above to see if the PermGen leak is caused by your application.

At last, in the event that you are able to confirm that the leak is not caused by your application, please re-open this ticket and provide a sample application that we can use to re-create this issue if possible.

On our end, I'm going to run a few tests with PermGen allocated deliberately very low to see if I could make the latest version of Jetty exhibit similar behavior.

-Michael
Comment 6 Peter Schmidt CLA 2011-07-25 06:48:53 EDT
It works now.
This seems to be a duplicate of 345290.

Peter
Comment 7 Michael Gorovoy CLA 2011-07-25 10:34:41 EDT
I agree that this is most likely a duplicate of bug 345290.

*** This bug has been marked as a duplicate of bug 345290 ***