Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-68245

systemd migration breaks installations where JAVA_OPTS contains timestamped log path

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • core
    • Jenkins LTS on Amazon Linux (amzn2.aarch64)

      Based on this article from cloudbees, I had the following in /etc/sysconfig/jenkins:

      JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Duser.timezone=America/Los_Angeles -Dorg.apache.commons.jelly.tags.fmt.timeZone=America/Los_Angeles -XX:+AlwaysPreTouch -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/jenkins/ -XX:+UseG1GC -XX:+UseStringDeduplication -XX:+ParallelRefProcEnabled -XX:+DisableExplicitGC -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -Xlog:gc*,gc+heap=trace,gc+age*=trace,gc+ref*=trace,gc+ergo*=trace:file=/var/log/jenkins/gc-%t.log:utctime:filecount=2,filesize=100m -XX:ErrorFile=/var/log/jenkins/hs_err_%p.log -XX:+LogVMOutput -XX:LogFile=/var/log/jenkins/hs_%p.log"
      

      The relevant part there seems to be:

      -Xlog:gc*,gc+heap=trace,gc+age*=trace,gc+ref*=trace,gc+ergo*=trace:file=/var/log/jenkins/gc-%t.log:utctime:filecount=2,filesize=100m

      When I upgraded to 2.332.2, the migration moved these values to /etc/systemd/system/jenkins.service.d/override.conf, but the service failed to start, with the following output from journalctl -xe:

      Apr 08 21:07:49 ip-10-0-0-74.ec2.internal jenkins[7288]: [0.001s][error][logging] Error opening log file '/var/log/jenkins/gc-/run.log': No such file or directory
      Apr 08 21:07:49 ip-10-0-0-74.ec2.internal jenkins[7288]: [0.001s][error][logging] Initialization of output 'file=/var/log/jenkins/gc-/run.log' using options 'filecount=2,filesize=
      Apr 08 21:07:49 ip-10-0-0-74.ec2.internal jenkins[7288]: Invalid -Xlog option '-Xlog:gc*,gc+heap=trace,gc+age*=trace,gc+ref*=trace,gc+ergo*=trace:file=/var/log/jenkins/gc-/run.log
      Apr 08 21:07:49 ip-10-0-0-74.ec2.internal jenkins[7288]: Error: Could not create the Java Virtual Machine.
      Apr 08 21:07:49 ip-10-0-0-74.ec2.internal jenkins[7288]: Error: A fatal exception has occurred. Program will exit.
      

      I think this is because of the %t in the trace:file path, which adds a timestamp to the file name. That substitution doesn't seem to work after the migration to systemd.

      I've submitted feedback to cloudbees as well, and it seems to have been updated on another page that deals with these options.

            Unassigned Unassigned
            codyrank Cody Rank
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: