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

Random HTTP 404 when viewing build details

    XMLWordPrintable

Details

    Description

      I noticed API calls (such as /job/doStuff/17/api/xml) failing "randomly" with HTTP 404. The thing is, you then open a browser to /job/doStuff and API calls would start working again. The same with job details, such as /job/doStuff/17/console. It would only happen to some jobs and not others, but not always the same jobs.

      Attaching a debugger to the running instance where this happened, I eventually was able to trace the defect to the search() method of the AbstractLazyLoadRunMap class, where it was able to obtain a "ceiling" entry that had a BuildReference with a null referent, which then hit all the right conditions for the method to return null even though the requested build number indeed existed. A SoftReference helps explain why this would occur "randomly" and then suddenly start working again after visiting the job's page, which would [re-]load all the builds.

      From what I can tell, this corner case has been missing since commit cf85b72

      Attachments

        Issue Links

          Activity

            dogfood dogfood added a comment -

            Integrated in jenkins_main_trunk #2871
            JENKINS-19418 Noting. (Revision 06ccff707c24bb4401e8faaeaf0b7710ccf2f299)

            Result = SUCCESS
            Jesse Glick : 06ccff707c24bb4401e8faaeaf0b7710ccf2f299
            Files :

            • changelog.html
            dogfood dogfood added a comment - Integrated in jenkins_main_trunk #2871 JENKINS-19418 Noting. (Revision 06ccff707c24bb4401e8faaeaf0b7710ccf2f299) Result = SUCCESS Jesse Glick : 06ccff707c24bb4401e8faaeaf0b7710ccf2f299 Files : changelog.html

            Code changed in jenkins
            User: Olivier Dagenais
            Path:
            core/src/main/java/jenkins/model/lazy/AbstractLazyLoadRunMap.java
            core/src/test/java/jenkins/model/lazy/AbstractLazyLoadRunMapTest.java
            core/src/test/java/jenkins/model/lazy/FakeMapBuilder.java
            http://jenkins-ci.org/commit/jenkins/b6dfb7ac90b4b5b0dd46b88244111cd2ec654801
            Log:
            JENKINS-19418 Fix random HTTP 404 when viewing build details

            Added a unit test (and supporting localExpiredBuilder) to expose a
            defect in the search() method of AbstractLazyLoadRunMap whereby the
            index contained an entry for the requested build number, but the
            BuildReference's referent was null.
            Fixed the search() method to handle this rare[ish] corner case.

            (cherry picked from commit 7c9aab3831e3df9f30585473e265efa8e2519537)

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Olivier Dagenais Path: core/src/main/java/jenkins/model/lazy/AbstractLazyLoadRunMap.java core/src/test/java/jenkins/model/lazy/AbstractLazyLoadRunMapTest.java core/src/test/java/jenkins/model/lazy/FakeMapBuilder.java http://jenkins-ci.org/commit/jenkins/b6dfb7ac90b4b5b0dd46b88244111cd2ec654801 Log: JENKINS-19418 Fix random HTTP 404 when viewing build details Added a unit test (and supporting localExpiredBuilder) to expose a defect in the search() method of AbstractLazyLoadRunMap whereby the index contained an entry for the requested build number, but the BuildReference's referent was null. Fixed the search() method to handle this rare [ish] corner case. (cherry picked from commit 7c9aab3831e3df9f30585473e265efa8e2519537)

            Code changed in jenkins
            User: Olivier Dagenais
            Path:
            core/src/main/java/jenkins/model/lazy/AbstractLazyLoadRunMap.java
            core/src/test/java/jenkins/model/lazy/AbstractLazyLoadRunMapTest.java
            http://jenkins-ci.org/commit/jenkins/33ad058fae24a5e3ea7498c29adf3af4f99b250e
            Log:
            JENKINS-19418 Minor formatting fixes.

            (cherry picked from commit d12b16c66b6cb2e382321f7bafb653c027931b1a)

            Compare: https://github.com/jenkinsci/jenkins/compare/b358d71ce0f0...33ad058fae24

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Olivier Dagenais Path: core/src/main/java/jenkins/model/lazy/AbstractLazyLoadRunMap.java core/src/test/java/jenkins/model/lazy/AbstractLazyLoadRunMapTest.java http://jenkins-ci.org/commit/jenkins/33ad058fae24a5e3ea7498c29adf3af4f99b250e Log: JENKINS-19418 Minor formatting fixes. (cherry picked from commit d12b16c66b6cb2e382321f7bafb653c027931b1a) Compare: https://github.com/jenkinsci/jenkins/compare/b358d71ce0f0...33ad058fae24

            Code changed in jenkins
            User: Jesse Glick
            Path:
            changelog.html
            core/src/main/java/jenkins/model/lazy/AbstractLazyLoadRunMap.java
            core/src/test/java/jenkins/model/lazy/AbstractLazyLoadRunMapTest.java
            core/src/test/java/jenkins/model/lazy/FakeMap.java
            http://jenkins-ci.org/commit/jenkins/b6b7bfd27c9b5551fde04416ee9b7b5faf16ad99
            Log:
            [FIXED JENKINS-22681] Fix of JENKINS-19418 should have used getById, not load, to avoid reloading the last build gratuitously.

            Compare: https://github.com/jenkinsci/jenkins/compare/e12e40adc6c2...b6b7bfd27c9b

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: changelog.html core/src/main/java/jenkins/model/lazy/AbstractLazyLoadRunMap.java core/src/test/java/jenkins/model/lazy/AbstractLazyLoadRunMapTest.java core/src/test/java/jenkins/model/lazy/FakeMap.java http://jenkins-ci.org/commit/jenkins/b6b7bfd27c9b5551fde04416ee9b7b5faf16ad99 Log: [FIXED JENKINS-22681] Fix of JENKINS-19418 should have used getById, not load, to avoid reloading the last build gratuitously. Compare: https://github.com/jenkinsci/jenkins/compare/e12e40adc6c2...b6b7bfd27c9b

            Code changed in jenkins
            User: Jesse Glick
            Path:
            core/src/main/java/jenkins/model/lazy/AbstractLazyLoadRunMap.java
            core/src/test/java/jenkins/model/lazy/AbstractLazyLoadRunMapTest.java
            core/src/test/java/jenkins/model/lazy/FakeMap.java
            http://jenkins-ci.org/commit/jenkins/701045e6a27bb93ba739b111505d01c238ad455e
            Log:
            [FIXED JENKINS-22681] Fix of JENKINS-19418 should have used getById, not load, to avoid reloading the last build gratuitously.
            (cherry picked from commit b6b7bfd27c9b5551fde04416ee9b7b5faf16ad99)

            Conflicts:
            changelog.html

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: core/src/main/java/jenkins/model/lazy/AbstractLazyLoadRunMap.java core/src/test/java/jenkins/model/lazy/AbstractLazyLoadRunMapTest.java core/src/test/java/jenkins/model/lazy/FakeMap.java http://jenkins-ci.org/commit/jenkins/701045e6a27bb93ba739b111505d01c238ad455e Log: [FIXED JENKINS-22681] Fix of JENKINS-19418 should have used getById, not load, to avoid reloading the last build gratuitously. (cherry picked from commit b6b7bfd27c9b5551fde04416ee9b7b5faf16ad99) Conflicts: changelog.html

            People

              oli_at_jsi Olivier Dagenais
              oli_at_jsi Olivier Dagenais
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: