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

maven submodule build fails doing mkdir on master

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Component/s: maven-plugin
    • Labels:
      None
    • Environment:
      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.

      Description

      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.

        Activity

        Hide
        scm_issue_link 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.

        Show
        scm_issue_link 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.
        Hide
        scm_issue_link 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

        Show
        scm_issue_link 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
        Hide
        oldelvet 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.

        Show
        oldelvet 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.
        Hide
        oldelvet 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.

        Show
        oldelvet 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.
        Hide
        scm_issue_link 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.

        Show
        scm_issue_link 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.
        Hide
        scm_issue_link 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

        Show
        scm_issue_link 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
        Hide
        scm_issue_link 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.

        Show
        scm_issue_link 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.
        Hide
        scm_issue_link 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

        Show
        scm_issue_link 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
        Hide
        scm_issue_link 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.

        Show
        scm_issue_link 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.
        Hide
        scm_issue_link 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

        Show
        scm_issue_link 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
        Hide
        oldelvet Richard Mortimer added a comment - - edited

        Seems to have been left in the re-opened state. I just checked against the 1.441 and the can confirm that the issue is resolved.

        Show
        oldelvet Richard Mortimer added a comment - - edited Seems to have been left in the re-opened state. I just checked against the 1.441 and the can confirm that the issue is resolved.
        Hide
        scm_issue_link 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/bafad70c0becf3376aed0751ef34f345a21a84c0
        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.
        (cherry picked from commit 67262e455f818bf693d1bd7a5987c9268b29c52e)

        Show
        scm_issue_link 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/bafad70c0becf3376aed0751ef34f345a21a84c0 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. (cherry picked from commit 67262e455f818bf693d1bd7a5987c9268b29c52e)
        Hide
        scm_issue_link 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/d630404282c993756497d2adf884413d87b89cc4
        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.
        (cherry picked from commit 2fa40188b91bd0f55c611fbd0cb2878c8d55da55)

        Show
        scm_issue_link 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/d630404282c993756497d2adf884413d87b89cc4 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. (cherry picked from commit 2fa40188b91bd0f55c611fbd0cb2878c8d55da55)
        Hide
        scm_issue_link SCM/JIRA link daemon added a comment -

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

        Conflicts:

        changelog.html

        Show
        scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Richard Mortimer Path: changelog.html http://jenkins-ci.org/commit/jenkins/bac1f8a013a5e716641dc66ad877021bcc9f5996 Log: Add changelog entry for JENKINS-10831 (cherry picked from commit f8e92df4d54b6bb405a11503e3cc3763049d4c0d) Conflicts: changelog.html
        Hide
        scm_issue_link SCM/JIRA link daemon added a comment -

        Code changed in jenkins
        User: Richard Mortimer
        Path:
        src/main/java/hudson/maven/MavenBuild.java
        http://jenkins-ci.org/commit/maven-plugin/b7bdae110772e8972f561db154958a6bf7df8350
        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.

        Originally-Committed-As: 2fa40188b91bd0f55c611fbd0cb2878c8d55da55

        Show
        scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Richard Mortimer Path: src/main/java/hudson/maven/MavenBuild.java http://jenkins-ci.org/commit/maven-plugin/b7bdae110772e8972f561db154958a6bf7df8350 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. Originally-Committed-As: 2fa40188b91bd0f55c611fbd0cb2878c8d55da55
        Hide
        scm_issue_link SCM/JIRA link daemon added a comment -

        Code changed in jenkins
        User: Richard Mortimer
        Path:
        src/main/java/hudson/maven/MavenBuild.java
        http://jenkins-ci.org/commit/maven-plugin/61cac17925d494606476920c9fa31cd26d1a835e
        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.

        Originally-Committed-As: 67262e455f818bf693d1bd7a5987c9268b29c52e

        Show
        scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Richard Mortimer Path: src/main/java/hudson/maven/MavenBuild.java http://jenkins-ci.org/commit/maven-plugin/61cac17925d494606476920c9fa31cd26d1a835e 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. Originally-Committed-As: 67262e455f818bf693d1bd7a5987c9268b29c52e

          People

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

            Dates

            • Created:
              Updated:
              Resolved: