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

          Kevin Yu created issue -
          Kevin Yu made changes -
          Description Original: 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:

          {code:java}
          Feb 29, 2016 5:06:34 PM hudson.matrix.MatrixProject getRootDirFor
          WARNING: Cannot create directory /var/lib/jenkins/jobs/FortiAP-S/configurations/axis-BUILD_TYPE/release/axis-MODEL_NAME/FAP_S313C for the combination BUILD_TYPE=release,MODEL_NAME=FAP_S313C
          Feb 29, 2016 5:06:34 PM hudson.matrix.MatrixProject getRootDirFor
          WARNING: Cannot create directory /var/lib/jenkins/jobs/FortiAP-S/configurations/axis-BUILD_TYPE/release/axis-MODEL_NAME/FAP_S313C for the combination BUILD_TYPE=release,MODEL_NAME=FAP_S313C
          Feb 29, 2016 5:06:34 PM hudson.matrix.MatrixProject getRootDirFor
          {code}

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


          {code:java}
              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;
              }
          {code}

          I suggest there should be a check whether the folder exist. if !f.exists() && !f.getParentFile().mkdirs(), then output the warning.
          New: 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:

          {code:java}
          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
          {code}

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


          {code:java}
              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;
              }
          {code}

          I suggest there should be a check whether the folder exist. if !f.exists() && !f.getParentFile().mkdirs(), then output the warning.
          Rick Liu made changes -
          Priority Original: Minor [ 4 ] New: Major [ 3 ]

          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.

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

              Created:
              Updated: