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

maven submodule build fails doing mkdir on master

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • maven-plugin
    • None
    • Jenkins 1.427 (also tested git 9dca500e2 private build).
      Master ubuntu 10.04 and slave ubuntu 11.04
      Build is configured to use maven 2.2.1.

      I have a multi-module maven project that builds correctly on a slave node but when I invoke a "build now" on one of the sub-modules of the build it fails with mkdir failed.

      The mkdir path is correct for the slave but I instrumented the code and did a local build based off current git and it seems to me that the mkdir is being performed on the master node (this would explain the failure because directory permissions will forbid the mkdir on the master).

      I see the following in the build log.

      Started by user richm
      Building remotely on bishop
      java.io.IOException: Failed to mkdirs: /opt/jenkins/slave/workspace/tcserv/tcserv/tcweb
      at hudson.FilePath.mkdirs(FilePath.java:817)
      at hudson.model.AbstractProject.checkout(AbstractProject.java:1191)
      at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:555)
      at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:443)
      at hudson.model.Run.run(Run.java:1376)
      at hudson.maven.MavenBuild.run(MavenBuild.java:257)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:230)
      FATAL: null
      java.lang.NullPointerException
      at hudson.maven.MavenBuild$RunnerImpl.post2(MavenBuild.java:753)
      at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:604)
      at hudson.model.Run.run(Run.java:1401)
      at hudson.maven.MavenBuild.run(MavenBuild.java:257)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:230)

      But after having added a few LOGGER.warn() calls into FilePath#mkdir() I see the following output on the master log (but nothing in the slave log)

      26-Aug-2011 22:40:39 hudson.FilePath$8 invoke
      WARNING: Mkdirs for file /opt/jenkins/slave/workspace/tcserv/tcserv/tcweb with channel hudson.remoting.LocalChannel@45cb0cdc
      26-Aug-2011 22:40:39 hudson.FilePath$8 invoke
      WARNING: 2nd Mkdirs for file /opt/jenkins/slave/workspace/tcserv/tcserv/tcweb
      26-Aug-2011 22:40:39 hudson.FilePath$8 invoke
      WARNING: mkdirs said false

      If I temporarily create a writable parent folder on the master then the mkdirs succeeds.

      Note the NPE that occurs after the mkdirs/checkout has failed is unrelated to the primary failure. I've got a patch that stops the NPE and will issue a pull request for that particular bit in due course.

          [JENKINS-10831] maven submodule build fails doing mkdir on master

          Richard Mortimer created issue -

          Code changed in jenkins
          User: Richard Mortimer
          Path:
          maven-plugin/src/main/java/hudson/maven/MavenBuild.java
          http://jenkins-ci.org/commit/jenkins/2fa40188b91bd0f55c611fbd0cb2878c8d55da55
          Log:
          Ignore null reporters field and avoid a NPE.
          The NPE can occur if a build fails during checkout and hence the run phase
          never gets called. See JENKINS-10831 for an example of this happening.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Richard Mortimer Path: maven-plugin/src/main/java/hudson/maven/MavenBuild.java http://jenkins-ci.org/commit/jenkins/2fa40188b91bd0f55c611fbd0cb2878c8d55da55 Log: Ignore null reporters field and avoid a NPE. The NPE can occur if a build fails during checkout and hence the run phase never gets called. See JENKINS-10831 for an example of this happening.
          Olivier Lamy made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]

          Code changed in jenkins
          User: Olivier Lamy
          Path:
          changelog.html
          http://jenkins-ci.org/commit/jenkins/76791e0f8df1f6ac436368831b13f1bbe922bead
          Log:
          changelog entry for JENKINS-10831

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Olivier Lamy Path: changelog.html http://jenkins-ci.org/commit/jenkins/76791e0f8df1f6ac436368831b13f1bbe922bead Log: changelog entry for JENKINS-10831

          Re-opening. Sorry I wasn't clear in the patch that I provided. That is just a symptom of the problem and not the problem itself.

          Even with that NPE patch applied the mkdirs is tried on the wrong node.

          Richard Mortimer added a comment - Re-opening. Sorry I wasn't clear in the patch that I provided. That is just a symptom of the problem and not the problem itself. Even with that NPE patch applied the mkdirs is tried on the wrong node.
          Richard Mortimer made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]

          I have now found the underlying problem. The fix for JENKINS-8418 introduced a setter for builtOn into MavenBuild.java. This does not change the underlying value for buildOn in AbstractBuild.java
          and it gets left at null (i.e. build on master) there. This causes then causes the FilePath for the workspace to be constructed using the master node rather than the correct build node.

          The sub-module build works if the builtOn setter is moved to AbstractBuild.java and the shadow copy of builtOn is removed from MavenBuild.java totally.

          Pull request on its way.

          Richard Mortimer added a comment - I have now found the underlying problem. The fix for JENKINS-8418 introduced a setter for builtOn into MavenBuild.java. This does not change the underlying value for buildOn in AbstractBuild.java and it gets left at null (i.e. build on master) there. This causes then causes the FilePath for the workspace to be constructed using the master node rather than the correct build node. The sub-module build works if the builtOn setter is moved to AbstractBuild.java and the shadow copy of builtOn is removed from MavenBuild.java totally. Pull request on its way.

          Code changed in jenkins
          User: Richard Mortimer
          Path:
          core/src/main/java/hudson/model/AbstractBuild.java
          maven-plugin/src/main/java/hudson/maven/MavenBuild.java
          http://jenkins-ci.org/commit/jenkins/67262e455f818bf693d1bd7a5987c9268b29c52e
          Log:
          JENKINS-10831 maven submodule build fails doing mkdir on master.

          Remove the shadow copy of buildOn from MavenBuild.java and move the setter to
          AbstractBuild to allow MavenModuleSetBuild.java to continue to set the
          build node.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Richard Mortimer Path: core/src/main/java/hudson/model/AbstractBuild.java maven-plugin/src/main/java/hudson/maven/MavenBuild.java http://jenkins-ci.org/commit/jenkins/67262e455f818bf693d1bd7a5987c9268b29c52e Log: JENKINS-10831 maven submodule build fails doing mkdir on master. Remove the shadow copy of buildOn from MavenBuild.java and move the setter to AbstractBuild to allow MavenModuleSetBuild.java to continue to set the build node.

          Code changed in jenkins
          User: Richard Mortimer
          Path:
          changelog.html
          http://jenkins-ci.org/commit/jenkins/f8e92df4d54b6bb405a11503e3cc3763049d4c0d
          Log:
          Add changelog entry for JENKINS-10831

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Richard Mortimer Path: changelog.html http://jenkins-ci.org/commit/jenkins/f8e92df4d54b6bb405a11503e3cc3763049d4c0d Log: Add changelog entry for JENKINS-10831

          Code changed in jenkins
          User: Richard Mortimer
          Path:
          maven-plugin/src/main/java/hudson/maven/MavenBuild.java
          http://jenkins-ci.org/commit/jenkins/2fa40188b91bd0f55c611fbd0cb2878c8d55da55
          Log:
          Ignore null reporters field and avoid a NPE.
          The NPE can occur if a build fails during checkout and hence the run phase
          never gets called. See JENKINS-10831 for an example of this happening.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Richard Mortimer Path: maven-plugin/src/main/java/hudson/maven/MavenBuild.java http://jenkins-ci.org/commit/jenkins/2fa40188b91bd0f55c611fbd0cb2878c8d55da55 Log: Ignore null reporters field and avoid a NPE. The NPE can occur if a build fails during checkout and hence the run phase never gets called. See JENKINS-10831 for an example of this happening.

            oldelvet Richard Mortimer
            oldelvet Richard Mortimer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: