Search code examples
javalinuxartifactory

artifactory.service: Failed with result 'exit-code'


Environment description:

artifactory version: jfrog-artifactory-oss-7.55.2-linux java version: openjdk version "17.0.5" 2022-10-18 system version: NAME="Ubuntu" VERSION="18.04.3 LTS (Bionic Beaver)"

problem description

artifactory.service restarted every several hours and sometimes artifactory.service will not be functionable. journalctl -u artifactory.service shows below log

2月 22 15:17:25 Artifactory systemd[1]: artifactory.service: Main process exited, code=exited, status=143/n/a
2月 22 15:17:25 Artifactory systemd[1]: artifactory.service: Failed with result 'exit-code'.
2月 22 15:17:25 Artifactory systemd[1]: Stopped Artifactory service.
2月 22 15:18:14 Artifactory systemd[1]: Starting Artifactory service...

Things I tried:

  1. By checking the console log of /opt/jfrog/artifactory/var/log/console.log, i haven't found anything useful.

Solution

  • Analysis

    Further checking by:

    # ps -ef --forest | less | grep artifactory
    ...
    -server -XX:+UseG1GC -XX:OnOutOfMemoryError=kill -9 %p -Xms512m -Xmx2g
    ...
    

    By search OnOutOfMemoryError got This option can be used to specify a command or script to execute when an OutOfMemoryError exception is thrown. in https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/clopts001.html And by executing below found

    # grep 'OutOfMemoryError' -rn /opt/jfrog/artifactory/var/log
    Binary file /opt/jfrog/artifactory/var/log/artifactory-service.log matches
    Binary file /opt/jfrog/artifactory/var/log/archived/artifactory-service.2023-06-08T12-25-37.903.log matches
    Binary file /opt/jfrog/artifactory/var/log/archived/console-2023-06-08-1686189301.log matches
    Binary file /opt/jfrog/artifactory/var/log/console.log matches
    

    And by checking the log found below:

    [65027.377s][warning][gc,alloc] http-nio-127.0.0.1-8091-Acceptor: Retried waiting for GCLocker too often allocating 1026 words
    #
    # java.lang.OutOfMemoryError: Java heap space
    # -XX:OnOutOfMemoryError="kill -9 %p"
    #   Executing /bin/sh -c "kill -9 10131"...
    

    Solution:

    refer to https://jfrog.com/help/r/jfrog-installation-setup-documentation/artifactory-system-yaml I changed

      #extraJavaOpts: "-Xms512m -Xmx2g"
    

    to

      extraJavaOpts: "-Xms50g -Xmx100g"
    

    then

    systemctl restart artifactory.service