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

          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: