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

cloudbees-disk-usage-simple-plugin doesn't work on read-only JENKINS_HOME

    XMLWordPrintable

Details

    Description

      When running Jenkins from a read-only JENKINS_HOME, disk usage collection won't work, since it wants to touch the JENKINS_HOME directory.

      This happens when running Jenkins in a containerized environment with a read-only root filesystem, where all the writable paths (i.e. workspace, cache, tmp etc.) are mounted to writable filesystems.

      Is it maybe a possibility to opt-out of that touch to JENKINS_HOME?

      Attachments

        Issue Links

          Activity

            twz123 Tom Wieczorek added a comment -

            I attached remove-fs-freeze-check.patch, which fixes the problem for me. Note that this is not a proper solution. It bluntly removes the code that tries to set the last modified date of the JENKINS_HOME folder.

            twz123 Tom Wieczorek added a comment - I attached remove-fs-freeze-check.patch , which fixes the problem for me. Note that this is not a proper solution. It bluntly removes the code that tries to set the last modified date of the JENKINS_HOME folder.
            chriscarpenter12 Chris added a comment -

            We're seeing the same when running Jenkins in OpenShift (kubernetes) where JENKINS_HOME (/var/lib/jenkins) is mounted in the pod using a PVC backed persistent storage.

            We get these dumps in the Jenkins log

            2022-08-03 07:24:40 INFO    com.cloudbees.simplediskusage.QuickDiskUsagePlugin$2 run Re-estimating disk usage2022-08-03 07:24:50 INFO    com.cloudbees.simplediskusage.QuickDiskUsagePlugin$2 run Unable to run disk usage checkjava.io.IOException: Failed to set the timestamp of /var/lib/jenkins to 1659525890594  at hudson.FilePath$Touch.invoke(FilePath.java:1745)  at hudson.FilePath$Touch.invoke(FilePath.java:1733)  at hudson.FilePath.act(FilePath.java:1171)  at hudson.FilePath.act(FilePath.java:1154)  at hudson.FilePath.touch(FilePath.java:1731)  at com.cloudbees.simplediskusage.UsageComputation$1.preVisitDirectory(UsageComputation.java:79)  at com.cloudbees.simplediskusage.UsageComputation$1.preVisitDirectory(UsageComputation.java:67)  at java.base/java.nio.file.Files.walkFileTree(Files.java:2732)  at java.base/java.nio.file.Files.walkFileTree(Files.java:2797)  at com.cloudbees.simplediskusage.UsageComputation.computeUsage(UsageComputation.java:67)  at com.cloudbees.simplediskusage.UsageComputation.compute(UsageComputation.java:51)  at com.cloudbees.simplediskusage.QuickDiskUsagePlugin$2.run(QuickDiskUsagePlugin.java:258)  at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)  at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)  at java.base/java.lang.Thread.run(Thread.java:829)
             

            And running in the script console produces the same.

            chriscarpenter12 Chris added a comment - We're seeing the same when running Jenkins in OpenShift (kubernetes) where JENKINS_HOME (/var/lib/jenkins) is mounted in the pod using a PVC backed persistent storage. We get these dumps in the Jenkins log 2022-08-03 07:24:40 INFO com.cloudbees.simplediskusage.QuickDiskUsagePlugin$2 run Re-estimating disk usage2022-08-03 07:24:50 INFO com.cloudbees.simplediskusage.QuickDiskUsagePlugin$2 run Unable to run disk usage checkjava.io.IOException: Failed to set the timestamp of / var /lib/jenkins to 1659525890594 at hudson.FilePath$Touch.invoke(FilePath.java:1745) at hudson.FilePath$Touch.invoke(FilePath.java:1733) at hudson.FilePath.act(FilePath.java:1171) at hudson.FilePath.act(FilePath.java:1154) at hudson.FilePath.touch(FilePath.java:1731) at com.cloudbees.simplediskusage.UsageComputation$1.preVisitDirectory(UsageComputation.java:79) at com.cloudbees.simplediskusage.UsageComputation$1.preVisitDirectory(UsageComputation.java:67) at java.base/java.nio.file.Files.walkFileTree(Files.java:2732) at java.base/java.nio.file.Files.walkFileTree(Files.java:2797) at com.cloudbees.simplediskusage.UsageComputation.computeUsage(UsageComputation.java:67) at com.cloudbees.simplediskusage.UsageComputation.compute(UsageComputation.java:51) at com.cloudbees.simplediskusage.QuickDiskUsagePlugin$2.run(QuickDiskUsagePlugin.java:258) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang. Thread .run( Thread .java:829) And running in the script console produces the same.
            twz123 Tom Wieczorek added a comment - - edited

            The paths below JENKINS_HOME are writable. What doesn't work is the touching of JENKINS_HOME itself. It's a mountpoint inside a container.

            twz123 Tom Wieczorek added a comment - - edited The paths below JENKINS_HOME are writable. What doesn't work is the touching of JENKINS_HOME itself . It's a mountpoint inside a container.
            pierrebtz Pierre Beitz added a comment -

            The result of the computation is indeed serialized and written to disk under the `JENKINS_HOME`.

            I'm not sure about your setup though, how are the rest of the plugins working if they cannot write their configuration under `$JENKINS_HOME/*.xml`?

            pierrebtz Pierre Beitz added a comment - The result of the computation is indeed serialized and written to disk under the `JENKINS_HOME`. I'm not sure about your setup though, how are the rest of the plugins working if they cannot write their configuration under `$JENKINS_HOME/*.xml`?

            Might be related to JENKINS-66250: cloudbees-disk-usage-simple-plugin produces lots of entries in the jobConfigHistory data - looks like actual disk usage data are stored in the plugin configuration space

            saper Marcin Cieślak added a comment - Might be related to JENKINS-66250: cloudbees-disk-usage-simple-plugin produces lots of entries in the jobConfigHistory data - looks like actual disk usage data are stored in the plugin configuration space

            People

              pierrebtz Pierre Beitz
              twz123 Tom Wieczorek
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: