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

Jenkins creates lots of warning message for creating matrix project root directory

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • matrix-project-plugin
    • None
    • Jenkins 1.6.42.1
      Ubuntu 14.04
      JAVA 7

      Jenkins creates lots of warning message for matrix project. The size of log would just keep growing which makes it very hard to read.

      The log looks something like this:

      Feb 29, 2016 5:06:34 PM hudson.matrix.MatrixProject getRootDirFor
      WARNING: Cannot create directory /var/lib/jenkins/jobs/model/configurations/axis-BUILD_TYPE/release/axis-MODEL_NAME/XXX for the combination BUILD_TYPE=release,MODEL_NAME=XXXX
      Feb 29, 2016 5:06:34 PM hudson.matrix.MatrixProject getRootDirFor
      WARNING: Cannot create directory /var/lib/jenkins/jobs/model/configurations/axis-BUILD_TYPE/release/axis-MODEL_NAME/XXX for the combination BUILD_TYPE=release,MODEL_NAME=XXXX
      Feb 29, 2016 5:06:34 PM hudson.matrix.MatrixProject getRootDirFor
      

      After some debugging, I think the problem is that it's calling File.mkdirs(), which would return false if the folder already exist.

          public File getRootDirFor(@Nonnull Combination combination) {
              File f = getConfigurationsDir();
              for (Entry<String, String> e : combination.entrySet())
                  f = new File(f,"axis-"+e.getKey()+'/'+Util.rawEncode(e.getValue()));
              if (!f.getParentFile().mkdirs()) {
                  LOGGER.log(Level.WARNING, "Cannot create directory {0} for the combination {1}", new Object[]{f, combination});
              }
              return f;
          }
      

      I suggest there should be a check whether the folder exist. if !f.exists() && !f.getParentFile().mkdirs(), then output the warning.

          [JENKINS-33230] Jenkins creates lots of warning message for creating matrix project root directory

          Rick Liu added a comment -

          This tons of warning messages bury out other useful warnings
          and makes debug Jenkins issues difficult.

          Rick Liu added a comment - This tons of warning messages bury out other useful warnings and makes debug Jenkins issues difficult.

          Rick Liu added a comment -

          Rick Liu added a comment - Created a pull-request: https://github.com/jenkinsci/matrix-project-plugin/pull/34

          Rick Liu added a comment -

          Hi kohsuke,

          Do you know when my pull-request (https://github.com/jenkinsci/matrix-project-plugin/pull/34) will be merged to trunk?

          Rick Liu added a comment - Hi kohsuke, Do you know when my pull-request ( https://github.com/jenkinsci/matrix-project-plugin/pull/34 ) will be merged to trunk?

          After I upgraded jenkins to 1.6.651 LTS, I started seeing this issue. I even tried 1.6.658, issue persists.
          My matrix job's child configuration is stuck for hours due to this (which normally takes about 2 mins).
          The log is spammed with this message ever one sec.

          Jun 03, 2016 8:27:58 AM hudson.matrix.MatrixProject getRootDirFor
          WARNING: Cannot create directory /var/lib/jenkins/jobs/lfi-capilano-presub-bld/configurations/axis-DISTRO/el/axis-REL/6/axis-UPDT/5/axis-label/aidel60 for the combination DISTRO=el,REL=6,UPDT=5,label=aidel60
          Jun 03, 2016 8:27:59 AM hudson.matrix.MatrixProject getRootDirFor
          WARNING: Cannot create directory /var/lib/jenkins/jobs/lfi-capilano-presub-bld/configurations/axis-DISTRO/el/axis-REL/6/axis-UPDT/5/axis-label/aidel60 for the combination DISTRO=el,REL=6,UPDT=5,label=aidel60

          In which build is this fix available?

          Maruthi Inukonda added a comment - After I upgraded jenkins to 1.6.651 LTS, I started seeing this issue. I even tried 1.6.658, issue persists. My matrix job's child configuration is stuck for hours due to this (which normally takes about 2 mins). The log is spammed with this message ever one sec. Jun 03, 2016 8:27:58 AM hudson.matrix.MatrixProject getRootDirFor WARNING: Cannot create directory /var/lib/jenkins/jobs/lfi-capilano-presub-bld/configurations/axis-DISTRO/el/axis-REL/6/axis-UPDT/5/axis-label/aidel60 for the combination DISTRO=el,REL=6,UPDT=5,label=aidel60 Jun 03, 2016 8:27:59 AM hudson.matrix.MatrixProject getRootDirFor WARNING: Cannot create directory /var/lib/jenkins/jobs/lfi-capilano-presub-bld/configurations/axis-DISTRO/el/axis-REL/6/axis-UPDT/5/axis-label/aidel60 for the combination DISTRO=el,REL=6,UPDT=5,label=aidel60 In which build is this fix available?

          Rick Liu added a comment -

          The fix is not merged yet.
          I did the github pull-request,
          but nobody approved yet.

          Rick Liu added a comment - The fix is not merged yet. I did the github pull-request, but nobody approved yet.

          Thanks Rick.

          In general, does jenkins downgrade work. I would like to go back to previous release 1.619.

          Maruthi Inukonda added a comment - Thanks Rick. In general, does jenkins downgrade work. I would like to go back to previous release 1.619.

          Rick Liu added a comment -

          i never tried downgrade Jenkins-master before,
          but it should be straightforward
          either using OS's package management
          or just replace Jenkins WAR file.

          Rick Liu added a comment - i never tried downgrade Jenkins-master before, but it should be straightforward either using OS's package management or just replace Jenkins WAR file.

          David Aldrich added a comment -

          I also see these warnings (in the system log at startup) after upgrading the Matrix Project Plugin from 1.6 to 1.7 on Jenkins 1.656. Downgrading the plugin to 1.6 cleared the messages.

          David Aldrich added a comment - I also see these warnings (in the system log at startup) after upgrading the Matrix Project Plugin from 1.6 to 1.7 on Jenkins 1.656. Downgrading the plugin to 1.6 cleared the messages.

          Code changed in jenkins
          User: Rick Liu
          Path:
          src/main/java/hudson/matrix/MatrixProject.java
          http://jenkins-ci.org/commit/matrix-project-plugin/b2f366a071e5229eb6d6070166a4028e88e41d00
          Log:
          JENKINS-33230 Disable WARNING log when folder is already existed

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Rick Liu Path: src/main/java/hudson/matrix/MatrixProject.java http://jenkins-ci.org/commit/matrix-project-plugin/b2f366a071e5229eb6d6070166a4028e88e41d00 Log: JENKINS-33230 Disable WARNING log when folder is already existed

          Code changed in jenkins
          User: Oliver Gondža
          Path:
          src/main/java/hudson/matrix/MatrixProject.java
          http://jenkins-ci.org/commit/matrix-project-plugin/ab499b760666477f2498d3b007230fc38ab515a0
          Log:
          Merge pull request #34 from totoroliu/master

          JENKINS-33230 Disable WARNING log when folder is already existed

          Compare: https://github.com/jenkinsci/matrix-project-plugin/compare/82d49766f868...ab499b760666

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oliver Gondža Path: src/main/java/hudson/matrix/MatrixProject.java http://jenkins-ci.org/commit/matrix-project-plugin/ab499b760666477f2498d3b007230fc38ab515a0 Log: Merge pull request #34 from totoroliu/master JENKINS-33230 Disable WARNING log when folder is already existed Compare: https://github.com/jenkinsci/matrix-project-plugin/compare/82d49766f868...ab499b760666

          Noam Manos added a comment -

          Still relevant on Jenkins 2.7.
          I'm using this script in Matrix Axis:

          def fp = Jenkins.instance.createPath(new File(PATH).getAbsolutePath())
          def result = []
          fp.list("*/.xml").each { it ->
          if (it.getRemote().toLowerCase().contains(DIR_FILTER.toLowerCase()) )

          { result += it.getRemote().replace(fp.getRemote(), "").replaceAll("\\\\", "/").replaceAll("^/", "") }

          }
          return result

          Noam Manos added a comment - Still relevant on Jenkins 2.7. I'm using this script in Matrix Axis: def fp = Jenkins.instance.createPath(new File(PATH).getAbsolutePath()) def result = [] fp.list("* / .xml").each { it -> if (it.getRemote().toLowerCase().contains(DIR_FILTER.toLowerCase()) ) { result += it.getRemote().replace(fp.getRemote(), "").replaceAll("\\\\", "/").replaceAll("^/", "") } } return result

          Still actual for me in jenkins 2.10/Matrix1.7 , though it looks like pull was approved 15 days ago.

          Andrey Regentov added a comment - Still actual for me in jenkins 2.10/Matrix1.7 , though it looks like pull was approved 15 days ago.

          Yury Khrustalev added a comment - - edited

          This issue is reproduced on 1.651.3 (LTS). Matrix Project Plugin 1.7.
          JDK 1.8.
          CentOS 7.2

          Yury Khrustalev added a comment - - edited This issue is reproduced on 1.651.3 (LTS). Matrix Project Plugin 1.7. JDK 1.8. CentOS 7.2

          Tony Wallace added a comment -

          Update 1.7.1 of Matrix Project plugin looks like it contains the fix. I have not tried it yet but will report back, hopefully by tomorrow.
          Jenkins 1.651.3/Matrix Project 1.7/Java 7/Linux VM

          Tony Wallace added a comment - Update 1.7.1 of Matrix Project plugin looks like it contains the fix. I have not tried it yet but will report back, hopefully by tomorrow. Jenkins 1.651.3/Matrix Project 1.7/Java 7/Linux VM

          Installed Matrix 1.7.1. Do not see lots of warning messages anymore.

          Andrey Regentov added a comment - Installed Matrix 1.7.1. Do not see lots of warning messages anymore.

          Tony Wallace added a comment -

          Yes, same here.

          Tony Wallace added a comment - Yes, same here.

          Confirm: update 1.7.1 of Matrix Project Plugin fixes the issue.

          Yury Khrustalev added a comment - Confirm: update 1.7.1 of Matrix Project Plugin fixes the issue.

            kohsuke Kohsuke Kawaguchi
            samsun387 Kevin Yu
            Votes:
            14 Vote for this issue
            Watchers:
            17 Start watching this issue

              Created:
              Updated: