Maven 在生成 Sure-fire 报告时抛出 "java.lang.OutOfMemoryError"
Maven Throws "java.lang.OutOfMemoryError" when generating Sure-fire reports
我知道这个问题出现很久了,
但是none的解决方案对我来说很成功
Maven throws "java.lang.OutOfMemoryError"
How to deal with "java.lang.OutOfMemoryError: Java heap space" error?
尽管我尝试了以上两种解决方案,也尝试了建议的其他选项
其他答案我仍然在下面的错误中结束
17-Dec-2018 11:36:54 Exception in thread "ForkJoinPool.commonPool-worker-5" java.lang.OutOfMemoryError: unable to create new native thread
17-Dec-2018 11:36:54 at java.lang.Thread.start0(Native Method)
17-Dec-2018 11:36:54 at java.lang.Thread.start(Thread.java:717)
17-Dec-2018 11:36:54 at java.util.concurrent.ForkJoinPool.createWorker(ForkJoinPool.java:1486)
17-Dec-2018 11:36:54 at java.util.concurrent.ForkJoinPool.tryAddWorker(ForkJoinPool.java:1517)
17-Dec-2018 11:36:54 at java.util.concurrent.ForkJoinPool.deregisterWorker(ForkJoinPool.java:1609)
17-Dec-2018 11:36:54 at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:167)
17-Dec-2018 11:36:54 Exception in thread "ForkJoinPool.commonPool-worker-0" java.lang.OutOfMemoryError: unable to create new native thread
17-Dec-2018 11:36:54 at java.lang.Thread.start0(Native Method)
17-Dec-2018 11:36:54 at java.lang.Thread.start(Thread.java:717)
17-Dec-2018 11:36:54 at java.util.concurrent.ForkJoinPool.createWorker(ForkJoinPool.java:1486)
17-Dec-2018 11:36:54 at java.util.concurrent.ForkJoinPool.tryAddWorker(ForkJoinPool.java:1517)
17-Dec-2018 11:36:54 at java.util.concurrent.ForkJoinPool.deregisterWorker(ForkJoinPool.java:1609)
17-Dec-2018 11:36:54 at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:167)
说清楚,
我已经使用 sure-fire 运行 testng 测试并相应地生成报告...所以我首先应用添加 argline 的方法,它没有帮助。然后我尝试添加 MAVEN_OPTS 并增加了从 256 到 1024 的值,这些值都不起作用,最终添加了 JAVA_TOOL_OPTIONS,即使我尝试了多个值来指定
,它仍然不起作用
是否还有其他选择可以尝试解决问题
不要将此标记为重复...我需要比现有解决方案更好的解决方案。
已编辑
使用命令的硬件详细信息lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 2
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 61
Model name: Intel Core Processor (Broadwell)
Stepping: 2
CPU MHz: 2197.454
BogoMIPS: 4394.90
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 4096K
NUMA node0 CPU(s): 0-7
OS 使用 uname -a
的详细信息
Linux pt-00-00 3.10.0-327.4.5.el7.x86_64 #1 SMP Thu Jan 21 04:10:29 EST 2016 x86_64 x86_64 x86_64 GNU/Linux
cat /proc/meminfo
的详细信息
MemTotal: 24517356 kB
MemFree: 24048256 kB
MemAvailable: 24054212 kB
Buffers: 35556 kB
Cached: 142932 kB
SwapCached: 0 kB
Active: 81092 kB
Inactive: 144820 kB
Active(anon): 47652 kB
Inactive(anon): 24724 kB
Active(file): 33440 kB
Inactive(file): 120096 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 4193276 kB
SwapFree: 4193276 kB
Dirty: 8 kB
Writeback: 0 kB
AnonPages: 47688 kB
Mapped: 40864 kB
Shmem: 24896 kB
Slab: 55872 kB
SReclaimable: 27304 kB
SUnreclaim: 28568 kB
KernelStack: 5520 kB
PageTables: 4180 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 16451952 kB
Committed_AS: 238360 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 169716 kB
VmallocChunk: 34359564288 kB
HardwareCorrupted: 0 kB
AnonHugePages: 12288 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 63344 kB
DirectMap2M: 25102336 kB
vmstat -s
的详细信息
24517356 K total memory
234276 K used memory
81704 K active memory
145092 K inactive memory
24048760 K free memory
35656 K buffer memory
198664 K swap cache
4193276 K total swap
0 K used swap
4193276 K free swap
3630 non-nice user cpu ticks
24 nice user cpu ticks
6329 system cpu ticks
21548595 idle cpu ticks
1549 IO-wait cpu ticks
0 IRQ cpu ticks
16 softirq cpu ticks
25 stolen cpu ticks
142239 pages paged in
101165 pages paged out
0 pages swapped in
0 pages swapped out
1169647 interrupts
1713506 CPU context switches
1546461109 boot time
50951 forks
您可以这样配置 maven-surefire-plugin
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>x.x.x</version>
<configuration>
<argLine>-Xmx2048m -XX:MaxPermSize=1024m</argLine>
</configuration>
</plugin>
设置 JVM 参数。
我知道这个问题出现很久了, 但是none的解决方案对我来说很成功
Maven throws "java.lang.OutOfMemoryError"
How to deal with "java.lang.OutOfMemoryError: Java heap space" error?
尽管我尝试了以上两种解决方案,也尝试了建议的其他选项 其他答案我仍然在下面的错误中结束
17-Dec-2018 11:36:54 Exception in thread "ForkJoinPool.commonPool-worker-5" java.lang.OutOfMemoryError: unable to create new native thread
17-Dec-2018 11:36:54 at java.lang.Thread.start0(Native Method)
17-Dec-2018 11:36:54 at java.lang.Thread.start(Thread.java:717)
17-Dec-2018 11:36:54 at java.util.concurrent.ForkJoinPool.createWorker(ForkJoinPool.java:1486)
17-Dec-2018 11:36:54 at java.util.concurrent.ForkJoinPool.tryAddWorker(ForkJoinPool.java:1517)
17-Dec-2018 11:36:54 at java.util.concurrent.ForkJoinPool.deregisterWorker(ForkJoinPool.java:1609)
17-Dec-2018 11:36:54 at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:167)
17-Dec-2018 11:36:54 Exception in thread "ForkJoinPool.commonPool-worker-0" java.lang.OutOfMemoryError: unable to create new native thread
17-Dec-2018 11:36:54 at java.lang.Thread.start0(Native Method)
17-Dec-2018 11:36:54 at java.lang.Thread.start(Thread.java:717)
17-Dec-2018 11:36:54 at java.util.concurrent.ForkJoinPool.createWorker(ForkJoinPool.java:1486)
17-Dec-2018 11:36:54 at java.util.concurrent.ForkJoinPool.tryAddWorker(ForkJoinPool.java:1517)
17-Dec-2018 11:36:54 at java.util.concurrent.ForkJoinPool.deregisterWorker(ForkJoinPool.java:1609)
17-Dec-2018 11:36:54 at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:167)
说清楚,
我已经使用 sure-fire 运行 testng 测试并相应地生成报告...所以我首先应用添加 argline 的方法,它没有帮助。然后我尝试添加 MAVEN_OPTS 并增加了从 256 到 1024 的值,这些值都不起作用,最终添加了 JAVA_TOOL_OPTIONS,即使我尝试了多个值来指定
,它仍然不起作用是否还有其他选择可以尝试解决问题
不要将此标记为重复...我需要比现有解决方案更好的解决方案。
已编辑
使用命令的硬件详细信息lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 2
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 61
Model name: Intel Core Processor (Broadwell)
Stepping: 2
CPU MHz: 2197.454
BogoMIPS: 4394.90
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 4096K
NUMA node0 CPU(s): 0-7
OS 使用 uname -a
Linux pt-00-00 3.10.0-327.4.5.el7.x86_64 #1 SMP Thu Jan 21 04:10:29 EST 2016 x86_64 x86_64 x86_64 GNU/Linux
cat /proc/meminfo
MemTotal: 24517356 kB
MemFree: 24048256 kB
MemAvailable: 24054212 kB
Buffers: 35556 kB
Cached: 142932 kB
SwapCached: 0 kB
Active: 81092 kB
Inactive: 144820 kB
Active(anon): 47652 kB
Inactive(anon): 24724 kB
Active(file): 33440 kB
Inactive(file): 120096 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 4193276 kB
SwapFree: 4193276 kB
Dirty: 8 kB
Writeback: 0 kB
AnonPages: 47688 kB
Mapped: 40864 kB
Shmem: 24896 kB
Slab: 55872 kB
SReclaimable: 27304 kB
SUnreclaim: 28568 kB
KernelStack: 5520 kB
PageTables: 4180 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 16451952 kB
Committed_AS: 238360 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 169716 kB
VmallocChunk: 34359564288 kB
HardwareCorrupted: 0 kB
AnonHugePages: 12288 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 63344 kB
DirectMap2M: 25102336 kB
vmstat -s
24517356 K total memory
234276 K used memory
81704 K active memory
145092 K inactive memory
24048760 K free memory
35656 K buffer memory
198664 K swap cache
4193276 K total swap
0 K used swap
4193276 K free swap
3630 non-nice user cpu ticks
24 nice user cpu ticks
6329 system cpu ticks
21548595 idle cpu ticks
1549 IO-wait cpu ticks
0 IRQ cpu ticks
16 softirq cpu ticks
25 stolen cpu ticks
142239 pages paged in
101165 pages paged out
0 pages swapped in
0 pages swapped out
1169647 interrupts
1713506 CPU context switches
1546461109 boot time
50951 forks
您可以这样配置 maven-surefire-plugin
:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>x.x.x</version>
<configuration>
<argLine>-Xmx2048m -XX:MaxPermSize=1024m</argLine>
</configuration>
</plugin>
设置 JVM 参数。