一、异常说明
通过-XX:HeapDumpPath=/home/app/tomcat/logs/dump 配置JAVA_OPTS参数,tomcat因jvm的OOM堆内存溢出,可以看到/home/app/tomcat/logs下面出现dump内存溢出文件。
二、解决方法
1)jps命令查看pid
[root@iZuf6gyurl0fqb87hirq23Z ~]# jps@b@22415 Jps@b@21113 Bootstrap
2)jmap命令用于获取Java 进程的堆内存信息
[root@iZuf6gyurl0fqb87hirq23Z ~]# jmap -heap 32292@b@Attaching to process ID 32292, please wait...@b@Debugger attached successfully.@b@Server compiler detected.@b@JVM version is 24.80-b11@b@@b@using thread-local object allocation.@b@Mark Sweep Compact GC@b@@b@Heap Configuration:@b@ MinHeapFreeRatio = 40@b@ MaxHeapFreeRatio = 70@b@ MaxHeapSize = 838860800 (800.0MB)@b@ NewSize = 1310720 (1.25MB)@b@ MaxNewSize = 17592186044415 MB@b@ OldSize = 5439488 (5.1875MB)@b@ NewRatio = 2@b@ SurvivorRatio = 8@b@ PermSize = 104857600 (100.0MB)@b@ MaxPermSize = 314572800 (300.0MB)@b@ G1HeapRegionSize = 0 (0.0MB)@b@@b@Heap Usage:@b@New Generation (Eden + 1 Survivor Space):@b@ capacity = 186908672 (178.25MB)@b@ used = 94210808 (89.84642791748047MB)@b@ free = 92697864 (88.40357208251953MB)@b@ 50.404728144449074% used@b@Eden Space:@b@ capacity = 166199296 (158.5MB)@b@ used = 84088888 (80.19341278076172MB)@b@ free = 82110408 (78.30658721923828MB)@b@ 50.595213110890676% used@b@From Space:@b@ capacity = 20709376 (19.75MB)@b@ used = 10121920 (9.65301513671875MB)@b@ free = 10587456 (10.09698486328125MB)@b@ 48.87602600870253% used@b@To Space:@b@ capacity = 20709376 (19.75MB)@b@ used = 0 (0.0MB)@b@ free = 20709376 (19.75MB)@b@ 0.0% used@b@tenured generation:@b@ capacity = 415158272 (395.92578125MB)@b@ used = 264928920 (252.6559066772461MB)@b@ free = 150229352 (143.2698745727539MB)@b@ 63.81395671672899% used@b@Perm Generation:@b@ capacity = 104857600 (100.0MB)@b@ used = 43812504 (41.782859802246094MB)@b@ free = 61045096 (58.217140197753906MB)@b@ 41.782859802246094% used@b@@b@19616 interned Strings occupying 2399336 bytes.
3) jstack pid - 打印指定Java进程、核心文件或远程调试服务器的Java线程堆栈的跟踪信息
[root@iZuf6gyurl0fqb87hirq23Z ~]# jstack 32292@b@"http-bio-9980-exec-1696" daemon prio=10 tid=0x00007fc834345800 nid=0x5f1d waiting on condition [0x00007fc04db84000]@b@ java.lang.Thread.State: WAITING (parking)@b@ at sun.misc.Unsafe.park(Native Method)@b@ - parking to wait for <0x00000000db07d650> (a java.util.concurrent.Semaphore$NonfairSync)@b@ at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)@b@ at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)@b@ at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:994)@b@ at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1303)@b@ at java.util.concurrent.Semaphore.acquire(Semaphore.java:317)@b@ at com.xwood.gw.processor.StreamDirectoryProxyJumpProcessor.serviceProxyJump(StreamDirectoryProxyJumpProcessor.java:336)@b@ at com.xwood.gw.processor.StreamDirectoryProxyJumpProcessor.doProcess(StreamDirectoryProxyJumpProcessor.java:389)@b@ at com.xwood.gw.processor.core.AbstractProcessor.process(AbstractProcessor.java:14)@b@ at com.xwood.gw.processor.core.ProcessorChain.process(ProcessorChain.java:22)@b@ at com.xwood.gw.filter.GateWayProcessorFilter.doFilter(GateWayProcessorFilter.java:59)@b@ at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)@b@ at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)@b@ at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)@b@ at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)@b@ at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)@b@ at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)@b@ at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)@b@ at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)@b@ at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)@b@ at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)@b@ at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)@b@ at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)@b@ at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)@b@ - locked <0x00000000ca2c3020> (a org.apache.tomcat.util.net.SocketWrapper)@b@ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)@b@ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)@b@ at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)@b@ at java.lang.Thread.run(Thread.java:745)
了解更多vm命令,点击更多