Doing anything as root conceals the errors. Tomcat is no exception and changing it to a real user makes your testing complete.
On Thursday, January 23, 2014 12:36 PM, Daniel Mikusa <dmik...@gopivotal.com> wrote: On Jan 23, 2014, at 11:38 AM, Randeep <randeep...@gmail.com> wrote: > Hi all, > Thanks a lot for valuable points. Here the information you guys asked and > the changes I made. > > OS : CentOS release 5.4 (Final) > httpd-2.2.3-65.el5.centos(front_end) +(mod_jk)+ apache-tomcat-6.0.37 > > I installed httpd using yum. > Downloaded tomcat from Apache as compressed archive(tar.gz) > > I'm using following startup script. > [root@server ~]# cat /etc/init.d/tomcat6 > #!/bin/bash > # description: Tomcat Start Stop Restart > # processname: tomcat > # chkconfig: 234 20 80 > JAVA_HOME=/usr/java/default > export JAVA_HOME > PATH=$JAVA_HOME/bin:$PATH > export PATH > CATALINA_HOME=/usr/share/apache-tomcat-6.0.37 > case $1 in > start) > sh $CATALINA_HOME/bin/startup.sh > ;; > stop) > sh $CATALINA_HOME/bin/shutdown.sh > ;; > restart) > sh $CATALINA_HOME/bin/shutdown.sh > sh $CATALINA_HOME/bin/startup.sh > ;; > esac > exit 0 > > As you said, I removed the JAVA_OPTS declaration from .bash_profile and I > have created setenv.sh and set JAVA_OPTS in it. > [root@server bin]# pwd > /usr/share/apache-tomcat-6.0.37/bin > > [root@server bin]# cat setenv.sh > export JAVA_OPTS='-Xms256m -Xmx512m -Xss512k > > -verbose:gc -Xloggc:heap.log’ Based on the name of the file you’re listing, it makes me think you’re confusing what this option does. It’s a garbage collection log. While that shows some info about the heap, it’s mainly targeted towards knowing what’s happening with GC in your process. I can’t help but think you might be looking for -XX:+HeapDumpOnOutOfMemoryError, which generates a heap dump when you get an OOME. > > Now it shows in grep. > [root@server bin]# ps aux | grep Bootstrap > root 1100 33.7 5.4 707052 95240 pts/0 Sl 11:29 0:06 > /usr/java/default/bin/java > -Djava.util.logging.config.file=/usr/share/apache-tomcat-6.0.37/conf/logging.properties > -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xms256m > -Xmx512m -Xss512k -verbose:gc -Xloggc:heap.log > -Djava.endorsed.dirs=/usr/share/apache-tomcat-6.0.37/endorsed -classpath > /usr/share/apache-tomcat-6.0.37/bin/bootstrap.jar > -Dcatalina.base=/usr/share/apache-tomcat-6.0.37 > -Dcatalina.home=/usr/share/apache-tomcat-6.0.37 > -Djava.io.tmpdir=/usr/share/apache-tomcat-6.0.37/temp > org.apache.catalina.startup.Bootstrap start > root 1158 0.0 0.0 3932 692 pts/0 R+ 11:29 0:00 grep > Bootstrap > [root@server bin]# > > But nothing came in heap.log. Try using this option instead: "-Xloggc:$CATALINA_BASE/logs/heap.log” That should put the file in your “logs” directory. Dan > So I better monitor this and if I get the OOM > again I have to increase Max limit! > > > On Thu, Jan 23, 2014 at 8:50 PM, Christopher Schultz < > ch...@christopherschultz.net> wrote: > >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA256 >> >> Randeep, >> >> On 1/23/14, 7:43 AM, Randeep wrote: >>> I'm getting out of memory exception errors. >> >> :( >> >>> Exception in thread "Timer-1" java.lang.OutOfMemoryError: Java heap >>> space at java.util.Arrays.copyOf(Arrays.java:2882) at >>> >> java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100) >>> >>> >> at >>> java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:572) >>> >>> >> at java.lang.StringBuffer.append(StringBuffer.java:320) >>> at org.json.JSONArray.toString(JSONArray.java:834) at >>> org.json.JSONObject.valueToString(JSONObject.java:1359) at >>> org.json.JSONObject.toString(JSONObject.java:1233) at >>> com.xxx.xxx.servlet.WServlet.writeProgramJson(WServlet.java:503) at >>> com.xxx.xxx.servlet.WServlet$1.run(WServlet.java:414) at >>> java.util.TimerThread.mainLoop(Timer.java:512) at >>> java.util.TimerThread.run(Timer.java:462) >> >> If you are trying to serialize huge JSON objects, this is going to >> happen. I'm not sure if JSON is as smart as the Java Serialization >> engine, but if you have a circular-reference in your object graph, I'd >> be willing to bet that the JSON serializer will run forever and >> exhaust your heap. >> >> It's also possible that you simply have a tiny heap and need more, >> especially if you aren't currently setting any heap parameters. >> >>> Is there anyway to see currently set jvm heap size details? Any >>> linux commands. >> >> You can attach any profiler to your app. Good luck catching this in >> the act, though, in production. >> >> You can also use "jmap -heap" which comes with the JDK. Just point it >> at a process and you'll get a heap summary from a running JVM. Make >> sure your JVM and jmap version match. >> >>> I have tried creating setenv.sh and putting the new parameters in >>> it. but echo $JAVA_OPTS was not giving any value. >> >> setenv.sh is run during Tomcat startup. Running "echo $JAVA_OPTS" from >> the command-line isn't going to reveal anything. What you want to do >> is modify setenv.sh, re-launch Tomcat, and then look at the process >> command line... something like this: >> >> $ ps aux | grep Bootstrap >> >> This should give you the whole command-line for Tomcat, and you can >> verify that your heap options have been set. >> >>> So I have put in .bash_profile and run it. Then restarted tomcat6. >> >> Don't do that: it will only work if you login using bash, and it won't >> work for other users you may have to restart Tomcat. >> >>> this is the line I added in .bash_profile. JAVA_OPTS="-Xms256m >>> -Xmx512m -Xss512k -verbose:gc -Xloggc:heap.log" >> >> You'll need to "export" JAVA_OPTS, otherwise it won't do anything for you. >> >> - -chris >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v1 >> Comment: GPGTools - http://gpgtools.org >> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ >> >> iQIcBAEBCAAGBQJS4TM+AAoJEBzwKT+lPKRYfB4QAMP4/MORiK92nK4kJ+KD9alc >> 2QYcriasb8QkPPgvYHGhGaxeLIprb1TE6tZdMSp08bHadDr+HpSbxi5xq9C6A1RJ >> fabHj9ShrXqdtTFiewPH3P/ulvaaJNPD1LeIFBwoG7/4vAIGKW48gLhaRUYcbe+z >> lV2NsZ18u38EZ9KRR8An66jX4PkwMXxl4QdQx5HDmuS/Sx8G7AfDVkuSB5PMNXbg >> TVlSEz5VeJnEGtBwnjgIa6ZSTv+iIv+nsw4WVuMe+4h1R07e1axxNismkgpUsU46 >> Ra4P7TssgdrqXFXmX4+kPNzd3xbbhPYIOOrQ0PYt6wGF0Wd9N1r/gvvViDbgghca >> wp39c3VJM8eE2vy9n0XCGYBkdq2DnRNVFV2y2xnfwecWKtDPEWfklTk8ZvbcAyxe >> hi3hxQnChCk74nxd/hvI1uNfgHcd/NwtmifwXPNM0BQCZ+AJarCbGca+a/BTTBaX >> txVIuIEf3jt/gpFu28UI8kt7Hx/PgWJ32QFyIPCbH5EYaSiKSz/Q6wCTvJTbUG4s >> GCK8AB/rGf1Z8efKlUZw2ESr1yX/VBCu9uOEK/60v+AAthiubq+O2ke1TzWKvy/I >> MxDhNiMo710w98h5hqIl5SthwXCgv3vEaaiUgDUV8zP3CoOtHL61NNZmLrMBTD2X >> 18aTMDKJ9BTvoYoZcmyV >> =IL2E >> -----END PGP SIGNATURE----- >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >> For additional commands, e-mail: users-h...@tomcat.apache.org >> >> > > > -- > Randeep > Mob: +919447831699[kerala] > Mob: +919880050349[B'lore] > I blog here: > http://www.randeeppr.me/ > Follow me Here: > http://twitter.com/Randeeppr > Poke me here! > http://www.facebook.com/Randeeppr > A little Linux Help > http://www.linuxhelp.in/ > Work profile: > http://in.linkedin.com/in/randeeppr --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org