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

When a job hits 'Max # of builds to keep' Nunit Publisher starts to throw NPE

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Component/s: junit-plugin, nunit-plugin
    • Labels:
    • Environment:
      Ubuntu Wheezy x86_64. Jenkins 1.499 (and on previous 1.496,497,498 possibly earlier)
    • Similar Issues:

      Description

      It seems as though jenkins somehow gets in a situation where at the end of running a job, at the point of trying to publish nunit results it throws an NPE, of the form:

      ERROR: Publisher hudson.plugins.nunit.NUnitPublisher aborted due to exception
      java.lang.NullPointerException
      at hudson.model.Run.getRootDir(Run.java:927)
      at hudson.tasks.junit.TestResultAction.getDataFile(TestResultAction.java:91)
      at hudson.tasks.junit.TestResultAction.load(TestResultAction.java:147)
      at hudson.tasks.junit.TestResultAction.getResult(TestResultAction.java:97)
      at hudson.tasks.junit.TestResultAction.getResult(TestResultAction.java:55)
      at hudson.tasks.test.AbstractTestResultAction.findCorrespondingResult(AbstractTestResultAction.java:183)
      at hudson.tasks.test.TestResult.getPreviousResult(TestResult.java:145)
      at hudson.tasks.junit.SuiteResult.getPreviousResult(SuiteResult.java:296)
      at hudson.tasks.junit.CaseResult.getPreviousResult(CaseResult.java:375)
      at hudson.tasks.junit.CaseResult.freeze(CaseResult.java:486)
      at hudson.tasks.junit.SuiteResult.freeze(SuiteResult.java:338)
      at hudson.tasks.junit.TestResult.freeze(TestResult.java:564)
      at hudson.tasks.junit.TestResultAction.setResult(TestResultAction.java:74)
      at hudson.tasks.junit.TestResultAction.<init>(TestResultAction.java:67)
      at hudson.plugins.nunit.NUnitPublisher.recordTestResult(NUnitPublisher.java:150)
      at hudson.plugins.nunit.NUnitPublisher.perform(NUnitPublisher.java:109)
      at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:810)
      at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:785)
      at hudson.model.Build$BuildExecution.post2(Build.java:183)
      at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:732)
      at hudson.model.Run.execute(Run.java:1568)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:236)

      Once this starts happening it continues to happen for every build for that particular job. A restart does not stop this behaviour from happening. We noted a while back that deleting the build history from the filesystem for this job does allow it carry on successfully, until such time as the error appears again.

      Very recently a team member noted that the number of builds in the history for that job was equal to (or thereabouts [most recent #405 oldest #306) to the value stored in the configuration setting 'Max # of builds to keep' (in our case 100). This could be a co-incidence, and I've upped the setting to 200 to see if builds start working again (but this takes ~6 hours to reach the failing job), but it does look like a smoking gun

      I had hoped that it would be related to https://issues.jenkins-ci.org/browse/JENKINS-16194 but having upgraded to the latest version we still see this issue.

      I'm mostly logging this in case others are seeing it

        Attachments

          Issue Links

            Activity

            Hide
            gitt Slawa Giterman added a comment - - edited

            We are getting the same exception in case of publishing JUnit results. But in our case "Max # of builds to keep" is not set. Builds which throw this exception are run on Windows slaves.

            As soon as we switched for these jobs from xUnit plug-in to standard "Publish JUnit test result report" the problem disappeared.

            Jenkins ver. 1.501
            xUnit plug-in ver. 1.52

            Show
            gitt Slawa Giterman added a comment - - edited We are getting the same exception in case of publishing JUnit results. But in our case "Max # of builds to keep" is not set. Builds which throw this exception are run on Windows slaves. As soon as we switched for these jobs from xUnit plug-in to standard "Publish JUnit test result report" the problem disappeared. Jenkins ver. 1.501 xUnit plug-in ver. 1.52
            Hide
            darrengibs Darren Gibson added a comment -

            I have the same NPE running on Windows 2008R2 64bit, Jenkins 1.504 and NUnit plugin 0.14. This issue only arose when I upgraded from 1.501 to 1.504 (the next day), but it didn't start immediately and I have other NUnit publications that are working without issue. I do not have the job currently configured to "Discard Old Builds" and I have a around 170 builds in my build history.

            Recording NUnit tests results
            ERROR: Publisher hudson.plugins.nunit.NUnitPublisher aborted due to exception
            java.lang.NullPointerException
            at hudson.model.Run.getRootDir(Run.java:935)
            at hudson.tasks.junit.TestResultAction.getDataFile(TestResultAction.java:91)
            at hudson.tasks.junit.TestResultAction.load(TestResultAction.java:147)
            at hudson.tasks.junit.TestResultAction.getResult(TestResultAction.java:97)
            at hudson.tasks.junit.TestResultAction.getResult(TestResultAction.java:55)
            at hudson.tasks.test.AbstractTestResultAction.findCorrespondingResult(AbstractTestResultAction.java:183)
            at hudson.tasks.test.TestResult.getPreviousResult(TestResult.java:145)
            at hudson.tasks.junit.SuiteResult.getPreviousResult(SuiteResult.java:296)
            at hudson.tasks.junit.CaseResult.getPreviousResult(CaseResult.java:375)
            at hudson.tasks.junit.CaseResult.freeze(CaseResult.java:486)
            at hudson.tasks.junit.SuiteResult.freeze(SuiteResult.java:338)
            at hudson.tasks.junit.TestResult.freeze(TestResult.java:604)
            at hudson.tasks.junit.TestResultAction.setResult(TestResultAction.java:74)
            at hudson.tasks.junit.TestResultAction.<init>(TestResultAction.java:67)
            at hudson.plugins.nunit.NUnitPublisher.recordTestResult(NUnitPublisher.java:150)
            at hudson.plugins.nunit.NUnitPublisher.perform(NUnitPublisher.java:109)
            at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
            at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:814)
            at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:786)
            at hudson.model.Build$BuildExecution.post2(Build.java:183)
            at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:733)
            at hudson.model.Run.execute(Run.java:1592)
            at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
            at hudson.model.ResourceController.execute(ResourceController.java:88)
            at hudson.model.Executor.run(Executor.java:237)

            Show
            darrengibs Darren Gibson added a comment - I have the same NPE running on Windows 2008R2 64bit, Jenkins 1.504 and NUnit plugin 0.14. This issue only arose when I upgraded from 1.501 to 1.504 (the next day), but it didn't start immediately and I have other NUnit publications that are working without issue. I do not have the job currently configured to "Discard Old Builds" and I have a around 170 builds in my build history. Recording NUnit tests results ERROR: Publisher hudson.plugins.nunit.NUnitPublisher aborted due to exception java.lang.NullPointerException at hudson.model.Run.getRootDir(Run.java:935) at hudson.tasks.junit.TestResultAction.getDataFile(TestResultAction.java:91) at hudson.tasks.junit.TestResultAction.load(TestResultAction.java:147) at hudson.tasks.junit.TestResultAction.getResult(TestResultAction.java:97) at hudson.tasks.junit.TestResultAction.getResult(TestResultAction.java:55) at hudson.tasks.test.AbstractTestResultAction.findCorrespondingResult(AbstractTestResultAction.java:183) at hudson.tasks.test.TestResult.getPreviousResult(TestResult.java:145) at hudson.tasks.junit.SuiteResult.getPreviousResult(SuiteResult.java:296) at hudson.tasks.junit.CaseResult.getPreviousResult(CaseResult.java:375) at hudson.tasks.junit.CaseResult.freeze(CaseResult.java:486) at hudson.tasks.junit.SuiteResult.freeze(SuiteResult.java:338) at hudson.tasks.junit.TestResult.freeze(TestResult.java:604) at hudson.tasks.junit.TestResultAction.setResult(TestResultAction.java:74) at hudson.tasks.junit.TestResultAction.<init>(TestResultAction.java:67) at hudson.plugins.nunit.NUnitPublisher.recordTestResult(NUnitPublisher.java:150) at hudson.plugins.nunit.NUnitPublisher.perform(NUnitPublisher.java:109) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:814) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:786) at hudson.model.Build$BuildExecution.post2(Build.java:183) at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:733) at hudson.model.Run.execute(Run.java:1592) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:237)
            Hide
            darrengibs Darren Gibson added a comment -

            It appears that I have managed to work around the issue by deleting the build where the issue first arose. While doing this I noticed something strange:

            • the build that first failed had a time stamp of 20:39
            • the successful build before that was time stamped 19:30 (failed-1)
            • the successful build before that was time stamped 15:50 (failed-2)
            • the 15:50 folder contained a junitResult.xml time stamped at 19:30 ???
            • the build at 19:30 did not contain a junitResult.xml
            • the build at 19:30 stated that "Notifying upstream projects of job completion" was a "SUCCESS"

            It appears that the build at 19:30 physically wrote its results to the previous builds folder, looking at the Test history it shows that build at 15:50 had twice as may tests run as normal.

            Deleting the 19:30 folder resolved the issue for me.

            Show
            darrengibs Darren Gibson added a comment - It appears that I have managed to work around the issue by deleting the build where the issue first arose. While doing this I noticed something strange: the build that first failed had a time stamp of 20:39 the successful build before that was time stamped 19:30 (failed-1) the successful build before that was time stamped 15:50 (failed-2) the 15:50 folder contained a junitResult.xml time stamped at 19:30 ??? the build at 19:30 did not contain a junitResult.xml the build at 19:30 stated that "Notifying upstream projects of job completion" was a "SUCCESS" It appears that the build at 19:30 physically wrote its results to the previous builds folder, looking at the Test history it shows that build at 15:50 had twice as may tests run as normal. Deleting the 19:30 folder resolved the issue for me.
            Hide
            kinow Bruno P. Kinoshita added a comment -

            Tried reproducing the issue by the max # of builds to keep but that didn't work.

            From reading the other comments here, looks like it is not trivial to reproduce this. Maybe by having used xunit and/or junit plug-in in older builds?

            Could someone with this issue provide some example test data, or a scenario that can be reproduced? If so I can debug it and confirm what's happening.

            Thanks

            Show
            kinow Bruno P. Kinoshita added a comment - Tried reproducing the issue by the max # of builds to keep but that didn't work. From reading the other comments here, looks like it is not trivial to reproduce this. Maybe by having used xunit and/or junit plug-in in older builds? Could someone with this issue provide some example test data, or a scenario that can be reproduced? If so I can debug it and confirm what's happening. Thanks

              People

              • Assignee:
                slide_o_mix Alex Earl
                Reporter:
                ciaranj ciaranj
              • Votes:
                4 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: