Tomcat 6 thread issue

2019-08-27 20:01发布

问题:

hello frnds we have migrated our java web application on java 1.6 , tomcat 6, oracle 11g but now we are facing issues after some time site is going down : we are getting java heap out of memory error and many threads are in waiting state. tomcat is getting hanged and our site is getting down

INFO: Maximum number of threads (200) created for connector with address null and port 80 Feb 21, 2013 9:56:04 PM here is thread log:

logs
"main" prio=10 tid=0x09f67c00 nid=0x2d51 runnable [0xf7622000]
       java.lang.Thread.State: RUNNABLE
        at java.net.PlainSocketImpl.socketAccept(Native Method)
        at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:390)
        - locked <0xc5078c60> (a java.net.SocksSocketImpl)          
    "VM Thread" prio=10 tid=0x09f8ac00 nid=0x2d52 runnable     
    "VM Periodic Task Thread" prio=10 tid=0x09f9cc00 nid=0x2d58 waiting on condition     
    JNI global references: 1074    
    Heap
     def new generation   total 78656K, used 78533K [0xbf760000, 0xc4cb0000, 0xc4cb0000)
      eden space 69952K, 100% used [0xbf760000, 0xc3bb0000, 0xc3bb0000)
      from space 8704K,  98% used [0xc4430000, 0xc4c91428, 0xc4cb0000)
      to   space 8704K,   0% used [0xc3bb0000, 0xc3bb0000, 0xc4430000)
     tenured generation   total 174784K, used 174783K [0xc4cb0000, 0xcf760000, 0xcf760000)
       the space 174784K,  99% used [0xc4cb0000, 0xcf75fff8, 0xcf760000, 0xcf760000)
     compacting perm gen  total 33792K, used 33647K [0xcf760000, 0xd1860000, 0xd3760000)
       the space 33792K,  99% used [0xcf760000, 0xd183be68, 0xd183c000, 0xd1860000)
        ro space 10240K,  61% used [0xd3760000, 0xd3d86298, 0xd3d86400, 0xd4160000)
        rw space 12288K,  60% used [0xd4160000, 0xd4896cb8, 0xd4896e00, 0xd4d60000)
end

Please guide.

Thanks, Aru

回答1:

According to the log you posted, your jvm settings (defined in JAVA_OPTIONS) mentioned in the comment above are not respected/used at all.
(e.g. 32m for permgen is used instead of the specified 512m).

My guess is that you just used the wrong name for the environment variable:
The correct environment variable for specifying JVM settings in tomcat is named JAVA_OPTS.



回答2:

Looks like the perm gen space is all used. Have you tried increasing it with -XX:MaxPermSize=128M ?