spring-boot-demo-oom: five real memory-leak demos with captured OOM + MAT evidence
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
$ java -Xmx160m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=docs/output/heap.hprof -jar target/unbounded-queue-leak.jar
|
||||
|
||||
unbounded-queue-leak: driving an unbounded queue to OOM, consumer sleeps 50ms/item
|
||||
java.lang.OutOfMemoryError: Java heap space
|
||||
Dumping heap to docs/output/heap.hprof ...
|
||||
Heap dump file created [175828534 bytes in 0.250 secs]
|
||||
|
||||
Caused by: java.lang.OutOfMemoryError: Java heap space
|
||||
at java.base/java.util.concurrent.LinkedBlockingQueue.put(LinkedBlockingQueue.java:329)
|
||||
at com.ankurm.oomdemo.UnboundedQueueLeakApplication.lambda$driveLeak$0(UnboundedQueueLeakApplication.java:53)
|
||||
at com.ankurm.oomdemo.UnboundedQueueLeakApplication$$Lambda/0x000000000b247688.run(Unknown Source)
|
||||
at org.springframework.boot.SpringApplication.lambda$callRunner$0(SpringApplication.java:788)
|
||||
at org.springframework.boot.SpringApplication$$Lambda/0x000000000b25ccd0.acceptWithException(Unknown Source)
|
||||
at org.springframework.util.function.ThrowingConsumer$1.acceptWithException(ThrowingConsumer.java:82)
|
||||
at org.springframework.util.function.ThrowingConsumer.accept(ThrowingConsumer.java:60)
|
||||
@@ -0,0 +1,23 @@
|
||||
Eclipse MAT 1.17.0 batch report (org.eclipse.mat.api:suspects) on heap.hprof -- Problem Suspect 1
|
||||
================================================================================================
|
||||
|
||||
Problem Suspect 1 One instance of java.util.concurrent.LinkedBlockingQueue loaded by <system
|
||||
class loader> occupies 79,698,088 (92.41%) bytes. The top consumers of its minimum retained heap
|
||||
are byte[] (152 instances totaling 79,694,208), java.util.concurrent.LinkedBlockingQueue$Node
|
||||
(153 instances totaling 3,672), and java.util.concurrent.locks.ReentrantLock$NonfairSync (2
|
||||
instances totaling 64). The instance is referenced by
|
||||
com.ankurm.oomdemo.UnboundedQueueLeakApplication$$Lambda+0x000000000b25d428 @ 0xf63bb570 ,
|
||||
loaded by org.springframework.boot.loader.launch.LaunchedClassLoader @ 0xf631bab8 . The memory
|
||||
is accumulated in one instance of java.util.concurrent.LinkedBlockingQueue$Node , loaded by
|
||||
<system class loader> , which occupies 1,572,984 (1.82%) bytes. Thread java.lang.Thread @
|
||||
0xfcc19e38 main has a local variable or reference to java.util.concurrent.LinkedBlockingQueue @
|
||||
0xff7386e8 which is on the shortest path to java.util.concurrent.LinkedBlockingQueue$Node @
|
||||
0xfccce5c0 . The thread java.lang.Thread @ 0xfcc19e38 main keeps local variables with total size
|
||||
632,832 (0.73%) bytes. The top consumers of its minimum retained heap are byte[] (152 instances
|
||||
totaling 79,694,208), java.util.concurrent.LinkedBlockingQueue$Node (153 instances totaling
|
||||
3,672), and java.util.concurrent.locks.ReentrantLock$NonfairSync (2 instances totaling 64).
|
||||
Significant stack frames and local variables com.ankurm.oomdemo.UnboundedQueueLeakApplication.la
|
||||
mbda$driveLeak$0(Lorg/springframework/boot/ApplicationArguments;)V
|
||||
(UnboundedQueueLeakApplication.java:53) java.util.concurrent.LinkedBlockingQueue @ 0xff7386e8
|
||||
retains 79,698,088 (92.41%) bytes The stacktrace of this Thread is available. See stacktrace .
|
||||
See stacktrace with involved local variables .
|
||||
Reference in New Issue
Block a user