【原創】大叔經驗分享(88)jenkins假死


jenkins安裝啟動后,使用systemctl來進行進程監控

# systemctl enable jenkins

但是還是經常發生jenkins進程掛了,不會自動重啟,通過systemctl查看狀態為:

# systemctl status jenkins

● jenkins.service - LSB: Jenkins Automation Server

   Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)

   Active: active (exited) since Tue 2019-09-24 18:52:26 CST; 1 months 1 days ago

     Docs: man:systemd-sysv-generator(8)

    Tasks: 0

   Memory: 0B

查看日志沒有任何異常,可能的原因如下:

Possibly the Linux kernel's oom-killer ("out-of memory killer") killed your JVM. It sends a SIGKILL signal to selected processes if the physical memory is no longer sufficient to accomodate all processes. Check that output of journalctl for lines containing the string oom-killer to confirm.

It is normal that the oom-killer strikes only after a certain period. Normally, Linux does not impose restrictions on the amount of virtual memory that a process requests (so your JVM can easily allocate 2 GiB of RAM on a 512 MiB system). However, if the process starts actually using the allocated memory (in your case: amount of used heap grows), then the kernel may find that the amount of physical memory is no longer sufficient. This is the point where the oom-killer will select a promising candiate process to be killed. Jenkins, as a non-system process that consumes a lot of memory, has very good chances to be the one that will be killed.

You can solve the situation by

  • adding more physical memory to your system
  • reducing JVM memory settings (e.g., smaller heap)

修改jenkins占用內存

# vi /etc/sysconfig/jenkins

JENKINS_JAVA_OPTIONS="-Xmx512m"

 

參考:https://stackoverflow.com/questions/42607771/jenkins-active-exited

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM