Jenkins active (exited)

Setting permissions for files and folders under /var/lib/jenkins worked for me:

vim /etc/sysconfig/jenkins  
# make sure that $JENKINS_USER="jenkins"

chown -R jenkins:jenkins /var/lib/jenkins
chown -R jenkins:jenkins /var/cache/jenkins
chown -R jenkins:jenkins /var/log/jenkins
systemctl restart jenkins 

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)