依赖JVM内存和物理内存?

时间:2016-04-29 09:42:48

标签: java maven memory-management jenkins out-of-memory

我遇到了Jenkins作业和Java Runtime Environment内存不足的问题。

当前Jenkins配置:

  • 版本:1.610
  • CPU:8vCPU
  • RAM:62 GB
  • 操作系统:RHEL 6.6
  • Java版本:1.7.0.75(openjdk)

这是内存消耗:

free -g
         total       used       free     shared    buffers     cached
Mem:            62         50         12          0          4         27
-/+ buffers/cache:         18         44
Swap:           17          1         16

通常,大约40GB是免费的。

Jenkins内存参数:

-Djava.awt.headless=true -Xms512m -Xmx8096m -XX:MaxPermSize=512m

Maven内存参数:

-Xms2048M -Xmx2048M -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=512M

以下是log:

中的错误
19:08:20 # There is insufficient memory for the Java Runtime Environment to continue.
19:08:20 # Cannot create GC thread. Out of system resources.
19:08:20 # An error report file with more information is saved as:
19:08:20 # /tmp/jvm-12047/hs_error.log
19:08:20 [ERROR] unable to create new native thread -> [Help 1]
19:08:20 [ERROR] 
19:08:20 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
19:08:20 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
19:08:20 [ERROR] 
19:08:20 [ERROR] For more information about the errors and possible solutions, please read the following articles:
19:08:20 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/OutOfMemoryError

我尝试将Maven内存配置增加到-Xms4096M -Xmx4096M,但没有找到任何更改。此外,我增加了nproc和nofile限制。

问题是,如果我有足够的物理内存,为什么我有关于内存不足的错误?如何配置我的系统以避免此错误?

其他信息:

java -d64 -version
java version "1.7.0_75"
OpenJDK Runtime Environment (rhel-2.5.4.0.el6_6-x86_64 u75-b13)
OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)

这是hs_error.log的一部分:

 #
 # There is insufficient memory for the Java Runtime Environment to continue.
 # Cannot create GC thread. Out of system resources.
 # Possible reasons:
 #   The system is out of physical RAM or swap space
 #   In 32 bit mode, the process size limit was hit
 # Possible solutions:
 #   Reduce memory load on the system
 #   Increase physical memory or swap space
 #   Check if swap backing store is full
 #   Use 64 bit Java on a 64 bit OS
 #   Decrease Java heap size (-Xmx/-Xms)
 #   Decrease number of Java threads
 #   Decrease Java thread stack sizes (-Xss)
 #   Set larger code cache with -XX:ReservedCodeCacheSize=
 # This output file may be truncated or incomplete.
 #
 #  Out of Memory Error (gcTaskThread.cpp:46), pid=12047, tid=140391498614528
 #
 # JRE version:  (7.0_75-b13) (build )
 # Java VM: OpenJDK 64-Bit Server VM (24.75-b04 mixed mode linux-amd64 compressed oops)
 # Derivative: IcedTea 2.5.4
 # Distribution: Built on Red Hat Enterprise Linux Server release 6.6 (Santiago) (Thu Jan  8 20:32:29 EST 2015)
 # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
 #

 ---------------  T H R E A D  ---------------

 Current thread (0x0000000001013000):  JavaThread "Unknown thread" [_thread_in_vm, id=12047, stack(0x00007fff6acdf000,0x00007fff6addf000)]

 Stack: [0x00007fff6acdf000,0x00007fff6addf000],  sp=0x00007fff6add6a60,  free space=990k
 Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
 V  [libjvm.so+0x95738d]
 V  [libjvm.so+0x49c5e0]
 V  [libjvm.so+0x55539a]
 V  [libjvm.so+0x554fb7]
 V  [libjvm.so+0x8007c9]
 V  [libjvm.so+0x92bed0]
 V  [libjvm.so+0x92d008]
 V  [libjvm.so+0x5acb25]
 V  [libjvm.so+0x916449]
 V  [libjvm.so+0x608ecf]  JNI_CreateJavaVM+0x6f
 C  [libjli.so+0x2f77]
 C  [libjli.so+0x8a83]
 C  [libjli.so+0x2574]
 C  [libjli.so+0x50a8]  JLI_Launch+0x478
 C  [java+0x766]


 ---------------  P R O C E S S  ---------------

 Java Threads: ( => current thread )

 Other Threads:

 =>0x0000000001013000 (exited) JavaThread "Unknown thread" [_thread_in_vm, id=12047, stack(0x00007fff6acdf000,0x00007fff6addf000)]

 VM state:not at safepoint (not fully initialized)

 VM Mutex/Monitor currently owned by a thread: None

 GC Heap History (0 events):
 No events

 Deoptimization events (0 events):
 No events

 Internal exceptions (0 events):
 No events

 Events (0 events):
 No events
 Dynamic libraries:
 00400000-00401000 r-xp 00000000 fd:00 145733                             /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64/jre/bin/java
 00600000-00602000 rw-p 00000000 fd:00 145733                             /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64/jre/bin/java
 01007000-01049000 rw-p 00000000 00:00 0                                  [heap]
 408a00000-409f00000 rw-p 00000000 00:00 0
 409f00000-413000000 rw-p 00000000 00:00 0
 413000000-43ce00000 rw-p 00000000 00:00 0
 43ce00000-6b1000000 rw-p 00000000 00:00 0
 6b1000000-6c5f00000 rw-p 00000000 00:00 0
 6c5f00000-800000000 rw-p 00000000 00:00 0
 38b2000000-38b2016000 r-xp 00000000 fd:00 38786                          /lib64/libgcc_s-4.4.7-20120601.so.1
 38b2016000-38b2215000 ---p 00016000 fd:00 38786                          /lib64/libgcc_s-4.4.7-20120601.so.1
 38b2215000-38b2216000 rw-p 00015000 fd:00 38786                          /lib64/libgcc_s-4.4.7-20120601.so.1
 38b2400000-38b24e8000 r-xp 00000000 fd:00 5110                           /usr/lib64/libstdc++.so.6.0.13
 38b24e8000-38b26e8000 ---p 000e8000 fd:00 5110                           /usr/lib64/libstdc++.so.6.0.13
 38b26e8000-38b26ef000 r--p 000e8000 fd:00 5110                           /usr/lib64/libstdc++.so.6.0.13
 38b26ef000-38b26f1000 rw-p 000ef000 fd:00 5110                           /usr/lib64/libstdc++.so.6.0.13
 38b26f1000-38b2706000 rw-p 00000000 00:00 0
 3c04000000-3c04020000 r-xp 00000000 fd:00 33430                          /lib64/ld-2.12.so
 3c0421f000-3c04220000 r--p 0001f000 fd:00 33430                          /lib64/ld-2.12.so
 3c04220000-3c04221000 rw-p 00020000 fd:00 33430                          /lib64/ld-2.12.so
 3c04221000-3c04222000 rw-p 00000000 00:00 0
 3c04400000-3c04402000 r-xp 00000000 fd:00 36701                          /lib64/libdl-2.12.so
 3c04402000-3c04602000 ---p 00002000 fd:00 36701                          /lib64/libdl-2.12.so
 3c04602000-3c04603000 r--p 00002000 fd:00 36701                          /lib64/libdl-2.12.so
 3c04603000-3c04604000 rw-p 00003000 fd:00 36701                          /lib64/libdl-2.12.so
 3c04800000-3c0498a000 r-xp 00000000 fd:00 34904                          /lib64/libc-2.12.so
 3c0498a000-3c04b8a000 ---p 0018a000 fd:00 34904                          /lib64/libc-2.12.so
 3c04b8a000-3c04b8e000 r--p 0018a000 fd:00 34904                          /lib64/libc-2.12.so
 3c04b8e000-3c04b8f000 rw-p 0018e000 fd:00 34904                          /lib64/libc-2.12.so
 3c04b8f000-3c04b94000 rw-p 00000000 00:00 0
 3c04c00000-3c04c17000 r-xp 00000000 fd:00 13694                          /lib64/libpthread-2.12.so
 3c04c17000-3c04e17000 ---p 00017000 fd:00 13694                          /lib64/libpthread-2.12.so
 3c04e17000-3c04e18000 r--p 00017000 fd:00 13694                          /lib64/libpthread-2.12.so
 3c04e18000-3c04e19000 rw-p 00018000 fd:00 13694                          /lib64/libpthread-2.12.so
 3c04e19000-3c04e1d000 rw-p 00000000 00:00 0
 3c05000000-3c0500d000 r-xp 00000000 fd:00 148767                         /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64/jre/lib/amd64/jli/libjli.so
 3c0500d000-3c0520c000 ---p 0000d000 fd:00 148767                         /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64/jre/lib/amd64/jli/libjli.so
 3c0520c000-3c0520d000 rw-p 0000c000 fd:00 148767                         /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64/jre/lib/amd64/jli/libjli.so
 3c05400000-3c05483000 r-xp 00000000 fd:00 36694                          /lib64/libm-2.12.so
 3c05483000-3c05682000 ---p 00083000 fd:00 36694                          /lib64/libm-2.12.so
 3c05682000-3c05683000 r--p 00082000 fd:00 36694                          /lib64/libm-2.12.so
 3c05683000-3c05684000 rw-p 00083000 fd:00 36694                          /lib64/libm-2.12.so
 3c05800000-3c05815000 r-xp 00000000 fd:00 3699                           /lib64/libz.so.1.2.3
 3c05815000-3c05a14000 ---p 00015000 fd:00 3699                           /lib64/libz.so.1.2.3
 3c05a14000-3c05a15000 r--p 00014000 fd:00 3699                           /lib64/libz.so.1.2.3
 3c05a15000-3c05a16000 rw-p 00015000 fd:00 3699                           /lib64/libz.so.1.2.3
 7faf69740000-7faf6974b000 rw-p 00000000 00:00 0
 7faf6974b000-7faf69793000 rw-p 00000000 00:00 0
 7faf69793000-7faf698e2000 rw-p 00000000 00:00 0
 7faf698e2000-7faf6ac83000 rw-p 00000000 00:00 0
 7faf6ac83000-7faf6ac8e000 rw-p 00000000 00:00 0
 7faf6ac8e000-7faf6acd6000 rw-p 00000000 00:00 0
 7faf6acd6000-7faf6ae25000 rw-p 00000000 00:00 0
 7faf6ae25000-7faf6c1c6000 rw-p 00000000 00:00 0
 7faf6c1c6000-7faf6c26e000 rw-p 00000000 00:00 0
 7faf6c26e000-7faf6cc3e000 rw-p 00000000 00:00 0
 7faf6cc3e000-7faf6cc49000 rw-p 00000000 00:00 0
 7faf6cc49000-7faf6ccff000 rw-p 00000000 00:00 0
 7faf6ccff000-7faf6cf6f000 rwxp 00000000 00:00 0
 7faf6cf6f000-7faf6fcff000 rw-p 00000000 00:00 0
 7faf6fcff000-7faf6fd07000 r-xp 00000000 fd:00 145778                     /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64/jre/lib/amd64/libzip.so
 7faf6fd07000-7faf6ff06000 ---p 00008000 fd:00 145778                     /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64/jre/lib/amd64/libzip.so
 7faf6ff06000-7faf6ff07000 rw-p 00007000 fd:00 145778                     /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64/jre/lib/amd64/libzip.so
 7faf6ff07000-7faf6ff13000 r-xp 00000000 fd:00 3013                       /lib64/libnss_files-2.12.so
 7faf6ff13000-7faf70113000 ---p 0000c000 fd:00 3013                       /lib64/libnss_files-2.12.so
 7faf70113000-7faf70114000 r--p 0000c000 fd:00 3013                       /lib64/libnss_files-2.12.so
 7faf70114000-7faf70115000 rw-p 0000d000 fd:00 3013                       /lib64/libnss_files-2.12.so
 7faf70124000-7faf7014d000 r-xp 00000000 fd:00 145756                     /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64/jre/lib/amd64/libjava.so
 7faf7014d000-7faf7034d000 ---p 00029000 fd:00 145756                     /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64/jre/lib/amd64/libjava.so
 7faf7034d000-7faf7034f000 rw-p 00029000 fd:00 145756                     /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64/jre/lib/amd64/libjava.so
 7faf7034f000-7faf7035c000 r-xp 00000000 fd:00 145777                     /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64/jre/lib/amd64/libverify.so
 7faf7035c000-7faf7055c000 ---p 0000d000 fd:00 145777                     /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64/jre/lib/amd64/libverify.so
 7faf7055c000-7faf7055e000 rw-p 0000d000 fd:00 145777                     /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64/jre/lib/amd64/libverify.so
 7faf7055e000-7faf70565000 r-xp 00000000 fd:00 6176                       /lib64/librt-2.12.so
 7faf70565000-7faf70764000 ---p 00007000 fd:00 6176                       /lib64/librt-2.12.so
 7faf70764000-7faf70765000 r--p 00006000 fd:00 6176                       /lib64/librt-2.12.so
 7faf70765000-7faf70766000 rw-p 00007000 fd:00 6176                       /lib64/librt-2.12.so
 7faf70766000-7faf70767000 ---p 00000000 00:00 0
 7faf70767000-7faf70867000 rw-p 00000000 00:00 0
 7faf70867000-7faf71388000 r-xp 00000000 fd:00 145782                     /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64/jre/lib/amd64/server/libjvm.so
 7faf71388000-7faf71588000 ---p 00b21000 fd:00 145782                     /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64/jre/lib/amd64/server/libjvm.so
 7faf71588000-7faf7164b000 rw-p 00b21000 fd:00 145782                     /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64/jre/lib/amd64/server/libjvm.so
 7faf7164b000-7faf7167c000 rw-p 00000000 00:00 0
 7faf7167e000-7faf71681000 rw-p 00000000 00:00 0
 7faf71681000-7faf71689000 rw-s 00000000 fd:04 141680                     /tmp/hsperfdata_jenkins/12047
 7faf71689000-7faf7168a000 rw-p 00000000 00:00 0
 7faf7168a000-7faf7168b000 r--p 00000000 00:00 0
 7faf7168b000-7faf7168c000 rw-p 00000000 00:00 0
 7fff6acdf000-7fff6ace2000 ---p 00000000 00:00 0
 7fff6ace3000-7fff6addf000 rw-p 00000000 00:00 0                          [stack]
 7fff6adff000-7fff6ae00000 r-xp 00000000 00:00 0                          [vdso]
 ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

 VM Arguments:
 java_command: /opt/jenkins/jobs/selenium-nyhetsrummet-ie9win7-browserstack/workspace/projects/selenium-parent/selenium-core/target/surefire/surefirebooter1626706123709656328.jar /opt/jenkins/jobs/selenium-nyhetsrummet-ie9win7-brows$
 Launcher Type: SUN_STANDARD

 Environment Variables:
 JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64
 PATH=/sbin:/usr/sbin:/bin:/usr/bin:/opt/opt/maven/bin:/opt/opt/node/bin:/opt/opt/accurev/bin:/usr/local/bin
 USERNAME=root
 SHELL=/bin/bash

 Signal Handlers:
 SIGSEGV: [libjvm.so+0x957e80], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
 SIGBUS: [libjvm.so+0x957e80], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
 SIGFPE: [libjvm.so+0x7df570], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
 SIGPIPE: [libjvm.so+0x7df570], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
 SIGXFSZ: [libjvm.so+0x7df570], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
 SIGILL: [libjvm.so+0x7df570], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
 SIGUSR1: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000
 SIGUSR2: [libjvm.so+0x7e0bd0], sa_mask[0]=0x00000004, sa_flags=0x10000004
 SIGHUP: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000
 SIGINT: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000
 SIGTERM: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000
 SIGQUIT: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000
 SIGTRAP: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000
 ---------------  S Y S T E M  ---------------

 OS:Red Hat Enterprise Linux Server release 6.6 (Santiago)

 uname:Linux 2.6.32-504.8.1.el6.x86_64 #1 SMP Fri Dec 19 12:09:25 EST 2014 x86_64
 libc:glibc 2.12 NPTL 2.12
 rlimit: STACK 10240k, CORE 0k, NPROC 1024, NOFILE 4096, AS infinity
 load average:3.81 1.52 0.89

 /proc/meminfo:
 MemTotal:       65856112 kB
 MemFree:        10647256 kB
 Buffers:         4782868 kB
 Cached:         31010120 kB
 SwapCached:        50408 kB
 Active:         36513900 kB
 Inactive:       12253920 kB
 Active(anon):   11187496 kB
 Inactive(anon):  1787524 kB
 Active(file):   25326404 kB
 Inactive(file): 10466396 kB
 Unevictable:           0 kB
 Mlocked:               0 kB
 SwapTotal:      18874360 kB
 SwapFree:       17605608 kB
 Dirty:             32464 kB
 Writeback:             0 kB
 AnonPages:      12872540 kB
 Mapped:            69044 kB
 Shmem:               116 kB
 Slab:            5778952 kB
 SReclaimable:    5371576 kB
 SUnreclaim:       407376 kB
 KernelStack:       20080 kB
 PageTables:        66108 kB
 NFS_Unstable:          0 kB
 Bounce:                0 kB
 WritebackTmp:          0 kB
 CommitLimit:    51802416 kB
 Committed_AS:   37729776 kB
 VmallocTotal:   34359738367 kB
 VmallocUsed:      399604 kB
 VmallocChunk:   34308564108 kB
 HardwareCorrupted:     0 kB
 AnonHugePages:  10213376 kB
 HugePages_Total:       0
 HugePages_Free:        0
 HugePages_Rsvd:        0
 HugePages_Surp:        0
 Hugepagesize:       2048 kB
 DirectMap4k:        4928 kB
 DirectMap2M:     2045952 kB
 DirectMap1G:    65011712 kB

 Memory: 4k page, physical 65856112k(10661592k free), swap 18874360k(17605608k free)

 vm_info: OpenJDK 64-Bit Server VM (24.75-b04) for linux-amd64 JRE (1.7.0_75-b13), built on Jan  8 2015 20:36:24 by "mockbuild" with gcc 4.4.7 20120313 (Red Hat 4.4.7-9)

 time: Thu Apr 28 19:08:20 2016
 elapsed time: 0 seconds

0 个答案:

没有答案