java.lang.OutOfMemoryError: PermGen space

95 views
Skip to first unread message

Sandra Tecelao

unread,
Feb 16, 2016, 6:50:23 AM2/16/16
to xnat_discussion
Dear all,

Today while I was uploading images into our XNAT database I got an window error message saying PermGen space.
After creating the setenv file as you suggest in the page https://wiki.xnat.org/display/XNAT16/Configuring+Tomcat, I got the errors when I shutdown and startup the tomcat:

command not found -Xms512m
command not found -XX:MaxPermSize=256m

At this moment I am not even able to see the tomcat page, or the login page for XNAT.

Do you have any idea what can be the problem?

Please find in attachement the catalina log file.

Regards,

Sandra

catalina.2016-02-16.log

Herrick, Rick

unread,
Feb 16, 2016, 8:44:58 AM2/16/16
to xnat_di...@googlegroups.com
Hi Sandra,

I’m not quite sure what you’ve got in your setenv file, but for some reason the –X options are being interpreted as separate commands, not as part of setting a variable value. I think you may have gotten the text that needs to be set in the Windows service configuration, where each value is on a separate line. In your setenv.sh, it should all be on a single line:

CATALINA_OPTS=$CATALINA_OPTS -Xms512m -Xmx1024m -XX:MaxPermSize=256m

If you change this and still have trouble, please send the setenv.sh file along with your response so I can have a look at that as well.

Regardless, my preference for setting this is to modify the Tomcat configuration file. Where this file is located depends on the operating system, but basically for Debian flavors of Linux (Debian and Ubuntu mostly, but there are others), the file you’re interested in is /etc/default/tomcatX (where X is 6 or 7). In that file, I have the following settings for my development server:

JAVA_OPTS="-Djava.awt.headless=true -Xms542m -Xmx1g -XX:+UseConcMarkSweepGC -XX:-OmitStackTraceInFastThrow"
JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=512m -XX:+CMSIncrementalMode -XX:+CMSClassUnloadingEnabled"

On Fedora/RHEL-based distributions (Fedora, RHEL, CentOS, Scientific Linux, the file you’re interested in is /usr/share/tomcatX/conf/tomcatX.conf or /etc/tomcatX/tomcatX.conf (these are the same file: /usr/share/tomcatX/conf is actually a symlink to /etc/tomcatX). Our development servers here in the lab have the following settings:

JAVA_OPTS="-Xms436m -Xmx1310m -Xmn262m -XX:-OmitStackTraceInFastThrow -XX:MaxPermSize=256m -Dsun.net.inetaddr.ttl=30"

You want to be careful about setting the MaxPermSize too high: it’s a complex topic but basically if it’s too low you can’t allocate enough objects, but if it’s too high garbage collection doesn’t happen often enough and performance can suffer.

One other thing I see is that your error messages show the –Xms and –XX:MaxPermSize options, but the –Xmx option is probably the more important one, since that sets the maximum allowable heap size, which is the available RAM to the JVM for processing. But your error is specifically about PermGen, so the MaxPermSize option is the relevant one here.

-- 

Rick Herrick

Sr. Programmer/Analyst

Neuroinformatics Research Group

Washington University School of Medicine

(314) 740-5961


--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To post to this group, send email to xnat_di...@googlegroups.com.
Visit this group at https://groups.google.com/group/xnat_discussion.
For more options, visit https://groups.google.com/d/optout.

 


The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.

Reply all
Reply to author
Forward
0 new messages