LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-11-2011, 04:04 AM   #1
austinium
Member
 
Registered: Nov 2007
Location: India
Distribution: Debian Stable, Debian Testing
Posts: 219

Rep: Reputation: 27
java.lang.OutOfMemoryError: PermGen space


I am running Tomcat(6.0.18)/jdk1.6.0_02, ~ after every couple of hours tomcat crashes with the following exception logged:

Code:
SEVERE: An exception or error occurred in the container during the request processing
java.lang.OutOfMemoryError: PermGen space
Google comes up with quite a lot of info on this, i haven't managed to find a conclusive solution to this though.

I have increased the PermGen size from it's default 64MB, and tomcat seems to be working "fine" now, however, theres quite a lot of info on the Internet pointing a possibility of tomcat crashing again as PermGen gets filled up gradually with the applications being deployed/undeployed/redeployed.

Is GC enabled on the PermGen memory area by default?
Would enabling GC on PermGen memory area using
Code:
-XX:+CMSPermGenSweepingEnabled
in JAVA_OPTS prevent PermGen from running out of memory with time? Also, would there be performance hit as a result of using this option?

Hoping to hear from your experience on this.

thanks
 
Old 05-12-2011, 11:49 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Believe it or not, Java applications *can* have resource leaks ... and it sounds like you've got one of those apps.

STRONG SUGGESTION:
1. Identify the apps you have running on your Tomcat server

2. Try to identify which of the apps might be causing the problem
<= Key question: "What changed?" before the problem first manifested itself?

3. Debug that app

You absolutely need to get a copy of JConsole (Java 1.5 or lower) or VisualVM (Java 1.6 or higher):

http://java.sun.com/developer/techni...SE/monitoring/

http://download.oracle.com/javase/1..../jconsole.html

4. Here's another link that might help:
http://stufftohelpyouout.blogspot.co...ot-deploy.html
Quote:
Generally speaking, when you have a permgen "leak" across webapp redeployments, this is the situation:

1. Webapp invokes some code that stores a reference to the webapp's WebappClassLoader

2. That reference is not cleared during undeploy [this is the leak]

The big problem is that the WebappClassLoader keeps a reference to all java.lang.Class objects it loads, so it can be quite bulky when it leaks, depending on exactly how many classes your webapp has locally.

markt has a great presentation which lays out the anatomy of these types of memory leaks, how to diagnose them, and often how to fix them. These are slides from a presentation at last year's ApacheCon NA. It's /very/ readable.

http://people.apache.org/~markt/pres...aks-60mins.pdf
PS:
1. Run - don't walk. Get JConsole. Try it out.

2. Absolutely try to identify the app that might be responsible.

3. Do NOT try debugging further before you've completed steps 1) and 2)
 
1 members found this post helpful.
Old 05-13-2011, 10:48 PM   #3
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
austinium -

Any headway on the Java PermGen issue?

Did you get a chance to try JConsole (or VisualVM)?

Thanx in advance .. PSM

PS:
I had a similar problem about a year and a half ago. It turned out to be a resource leak in a 3rd party .jar. The solution was to install a patch from the vendor.
 
Old 05-14-2011, 06:55 AM   #4
austinium
Member
 
Registered: Nov 2007
Location: India
Distribution: Debian Stable, Debian Testing
Posts: 219

Original Poster
Rep: Reputation: 27
Tomcat hasn't crashed after having increased PermGen. The PermGen memory usage has also more of less stable. There is just this one application running on tomcat.

I tried deploying the war file on Tomcat 6.0.32, this version has a listener which logs possible memory leak conditions, will be going through the log in depth once the weekends over. Most of the warnings seem to be related to our use of tomcat along with terracotta, we have a setup similar to the one mentioned here. So there are warnings about timers and processing buckets not being unloaded, i don't suppose these could be causing any trouble. Heres a pastebin to the part of the log with the warnings.

I must admit this is the first time i am doing this, your post has been very helpful. Would love to hear your thoughts on the log.

Thanks again
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] weblogic note that java.lang.OutOfMemoryError: Java heap space dyceac Linux - Software 2 10-24-2010 06:50 AM
If you get the error message: java.lang.OutOfMemoryError venkat1034 Linux - Server 1 04-25-2009 11:26 AM
"Exception in thread "ConfigurableThreadImpl::" java.lang.OutOfMemoryError: unable to chidambaram Linux - Newbie 2 10-27-2006 10:06 PM
Azureus: java.lang.OutOfMemoryError wearetheborg Linux - Software 3 12-01-2004 02:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration