0

The error occurs on this line in a jsp page!

    <table:table name="sessionScope.users" sort="external" pagesize="50" id="user" class="list" 
    requestURI="/admin-users.html" partialList="true" size="sessionScope.fullListSize">

I've tried increasing the perm gen max to 512m, using the methods found in other posts, both for the invocation of eclipse and the instance of Tomcat.

Ok, so a bit more context is required: THis is my dev system, running in eclipse, and pointing to a standalone instance of tomcat that is a server within Eclipse.

According to Recurring "PermGen" in Tomcat 6, I have the following in my eclipse.ini:

--launcher.XXMaxPermSize
512m

// ...

-XX:MaxPermSize=512m
-XX:+UseConcMarkSweepGC
-XX:+CMSPermGenSweepingEnabled
-XX:+CMSClassUnloadingEnabled
-Xms256m


-Xmx512m
Community
  • 1
  • 1
  • Do not put "solved" in titles. Just mark the most helpful answer accepted. – BalusC Nov 24 '11 at 02:31
  • Well, it wasn't actually related to any of the answers... and I think SOLVED in titles is a good practice... is that against the conventions of SOF?? – Artyom 108 Nov 24 '11 at 02:43
  • You can post your own answer if none of the answers helped in solving the problem. This is a Question & Answer site. Not a discussion forum. Questions with answers which are marked accepted appear with different colors in the listing which is sufficiently recognizeable as "solved". Also, the search engine can distinguish solved problems (questions with accepted answers) from unsolved problems. For that you don't need to yell "SOLVED" in the title :) Start at http://stackoverflow.com/faq and continue at http://meta.stackoverflow.com – BalusC Nov 24 '11 at 02:46

2 Answers2

0

You probably redeployed one time too many to Tomcat. Bounce Tomcat and it'll be fine - until you've filled up the perm gen space with too many restarts again.

UPDATE:

I'd be worried about what your page is doing if it's happening every single time you hit that page. A JSP is a template for a servlet, which is subsequently compiled into a .class file. You've got a big problem if that JSP is so big that it's filling up your perm gen space.

All the suggestions about leak detection seem wrong headed to me. Leaks usually manifest themselves over time. You said below that it happens on every access.

I'd recommend the following:

  1. Leave Eclipse out of it. If you deploy a WAR by hand and start up Tomcat, do you observe the same behavior? The Eclipse start up might be wrong.
  2. You can adjust the size of memory and perm gen space. Google for JVM options and see how to do it.
  3. Download Visual VM 1.3.3, install all the plugins, and start it before you run Tomcat. I'll let you see what's happening to your memory in real time. You can see lots of other useful things as well, like threads, etc. You need more data, not guesses.
duffymo
  • 305,152
  • 44
  • 369
  • 561
  • it happens every time I run when I hit that page... even from a fresh start of eclipse. – Artyom 108 Nov 24 '11 at 01:35
  • Ouch. You might need the help of a profiler. Permgen is mainly used by class definitions in classloaders and interned strings. You need an awfully big app to use 512M of permgen for classes, though. – Alastair Maw Nov 24 '11 at 01:41
  • That's what I'm thinking! ... I'm on 64 bit ubuntu 10.04 w lots of mem, so don't mind it, but I shouldn't have to. Also, this does not happen to my windows-based collegue, nor on our production server. For me, it seems to have started randomly... I reverted to old code that worked long before it started, but the problem still happened. I'm wondering if its a corrupt library or some such thing... – Artyom 108 Nov 24 '11 at 01:46
  • So the JreMemoryLeakPreventionListener, what does it actually tell you? – Artyom 108 Nov 24 '11 at 01:46
  • I'm rusty on web-apps, but is the Tomcat being knocked over on Eclipse restarts? Or is it a background Tomcat instance that you're deploying to, in which case it'll suffer from this issue? Try closing Eclipse and seeing if you can still get at :8080 or whatever. Obviously if you can, this isn't going to help - you need to restart your Tomcat instance. See the link I posted for tracking down how to fix it all. – Alastair Maw Nov 24 '11 at 01:47
  • See http://java-monitor.com/forum/showthread.php?t=818 for JreMemoryLeakPreventionListener details. – Alastair Maw Nov 24 '11 at 01:48
  • Ah ok. Thanks. I didn't see that one. To answer your question, it's an instance of tomcat that is managed by Eclipse. It gets bumped every time I start / debug the app within eclipse. – Artyom 108 Nov 24 '11 at 01:55
  • SOLVED (SORT OF): JAVA_OPTS="-server -Xmx383m -Xms96m -Xss512k -XX:MaxPermSize=256m" this apprently needs to be in the actual environment, *not* in the eclipse.ini... THis was the clue: I got the app running in standalone tomcat, and have the same problem. Then out of desperation, I tried to set the params globally and that worked. I'm guessing the settings in the eclipse ini are only for eclipse itself, and that eclipse starts tomcat in a different vm. (that is my current theory...) Anyway, thanks – Artyom 108 Nov 24 '11 at 02:15
  • so to apply the changes in eclipse, which in my case is pointing to a standalone tomcat instance, I have to go to the Run| "run / debug configuations...", select the server configuration on the left, then hit the "Arguments" tab, and put the settings in under "VM arguments". JAVA_OPTS works for standalone tomcat (outside of eclipse), but does not get picked up by eclipse, apparently. – Artyom 108 Nov 24 '11 at 02:46
0

A well-written webapp shouldn't hang onto its classloader when redeployed, but there are numerous reasons why it might.

If you're running on Tomcat, you might like to try this in the server.xml:

<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />

This page has much more info.

Alastair Maw
  • 5,373
  • 1
  • 38
  • 50