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

When triggering a new build from current build page, 'Next Build' isn't shown after reloading page

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: core
    • Labels:
    • Environment:
      1.532.1-rc1, 1.540, 1.533, 1.500
    • Similar Issues:

      Description

      1. Create a freestyle project 'foo' with a shell build step that executes sleep 30 and save.
      2. Click 'Build Now'
      3. Go to the build's page (/job/foo/1) and wait until the build finishes.
      4. From the breadcrumb bar, select 'Build Now' from the 'foo' job's context menu.
      5. Wait a second (so the build is actually started), then reload.

      Expected result: 'Next Build' link is shown
      Actual result: It's not

      If you open the job's main page at /job/foo e.g. in another tab, then reload the build page again, the 'Next Build' link appears after reloading.

        Attachments

          Activity

          Hide
          martin_naughton martin naughton added a comment -

          In the lastest code for jenkins i am not seeing that problem. Do you have auto enable on? Previous and next build appear. using 1.54. followed your exact instruction which were good.

          first one even works for me.

          Show
          martin_naughton martin naughton added a comment - In the lastest code for jenkins i am not seeing that problem. Do you have auto enable on? Previous and next build appear. using 1.54. followed your exact instruction which were good. first one even works for me.
          Hide
          martin_naughton martin naughton added a comment -

          any update?

          Show
          martin_naughton martin naughton added a comment - any update?
          Hide
          danielbeck Daniel Beck added a comment - - edited

          Reproduced every time on newly created Jenkins instances with empty Jenkins home. Just now verified in 1.544.

          Auto enable is disabled (which is the default anyway I believe). It takes until the build is finished, or the /job/foo page is reloaded, for the build to show up as 'Next Build' on the previously completed build's page.

          Show
          danielbeck Daniel Beck added a comment - - edited Reproduced every time on newly created Jenkins instances with empty Jenkins home. Just now verified in 1.544. Auto enable is disabled (which is the default anyway I believe). It takes until the build is finished, or the /job/foo page is reloaded, for the build to show up as 'Next Build' on the previously completed build's page.
          Hide
          danielbeck Daniel Beck added a comment -

          Weirdly enough, an existing instance (RHEL Linux, OpenJDK 1.6, Jenkins installed as service) is not affected by this. So far, all systems I reproduced this with seem to have been OS X 10.8.6 with Oracle Java 1.7, Jenkins launched from the command line using java -jar jenkins.war.

          Show
          danielbeck Daniel Beck added a comment - Weirdly enough, an existing instance (RHEL Linux, OpenJDK 1.6, Jenkins installed as service) is not affected by this. So far, all systems I reproduced this with seem to have been OS X 10.8.6 with Oracle Java 1.7, Jenkins launched from the command line using java -jar jenkins.war .
          Hide
          martin_naughton martin naughton added a comment - - edited

          Works for me when auto refresh is enabled.

          So it also work for you on RHEL Linux, OpenJDK 1.6, Jenkins installed as service even when you have auto refresh is disabled. Could it be your browser? I am using firefox nghtly which is the latest build of firefox.

          Show
          martin_naughton martin naughton added a comment - - edited Works for me when auto refresh is enabled. So it also work for you on RHEL Linux, OpenJDK 1.6, Jenkins installed as service even when you have auto refresh is disabled. Could it be your browser? I am using firefox nghtly which is the latest build of firefox.
          Hide
          danielbeck Daniel Beck added a comment - - edited
          • I used the same web browser Firefox 26 on OS X for both the affected instance (localhost test instance, OS X 10.8, Oracle Java 7) and the instance that isn't affected (RHEL 6 server, OpenJDK 6). No suspicious headers (e.g. Cache-Control) are sent after reloading the page in step 5 AFAICT.
          • New: I set up a new, manually launched (java -jar jenkins.war) instance of 1.544 on the RHEL 6 server with OpenJDK 6. Accessed it using the same browser and client system, and the issue was successfully reproduced. So it's neither the JVM nor the host OS!

          I assume that you're doing something differently when trying to reproduce the issue. The steps to reproduce I provide usually assume you're on a pristine install with no customized preferences. As I have no idea about the cause, any customization on your side could cause reproducing this to fail on your install.

          1. Use a new Jenkins instance without additional plugins and customized configuration. I reproduced it every time on pristine instances with no additional plugins and no configuration changes.
          2. Disable auto-refresh (which isn't enabled by default anyway, hence a preference change not outlined in the issue!). The reload in step 5 is just pressing Ctrl-R/F5/Cmd-R.
          3. Don't have multiple browser tabs open (especially none with auto-refresh!) and don't use an instance with other users accessing it.
          Show
          danielbeck Daniel Beck added a comment - - edited I used the same web browser Firefox 26 on OS X for both the affected instance ( localhost test instance, OS X 10.8, Oracle Java 7) and the instance that isn't affected (RHEL 6 server, OpenJDK 6). No suspicious headers (e.g. Cache-Control) are sent after reloading the page in step 5 AFAICT. New: I set up a new, manually launched ( java -jar jenkins.war ) instance of 1.544 on the RHEL 6 server with OpenJDK 6. Accessed it using the same browser and client system, and the issue was successfully reproduced. So it's neither the JVM nor the host OS! I assume that you're doing something differently when trying to reproduce the issue. The steps to reproduce I provide usually assume you're on a pristine install with no customized preferences. As I have no idea about the cause, any customization on your side could cause reproducing this to fail on your install. Use a new Jenkins instance without additional plugins and customized configuration. I reproduced it every time on pristine instances with no additional plugins and no configuration changes. Disable auto-refresh (which isn't enabled by default anyway, hence a preference change not outlined in the issue!). The reload in step 5 is just pressing Ctrl-R/F5/Cmd-R. Don't have multiple browser tabs open ( especially none with auto-refresh!) and don't use an instance with other users accessing it.
          Hide
          danielbeck Daniel Beck added a comment -

          This seems to be a bug in core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java's getNextBuild():

          The first call to that method (step 3) sets nextBuildR to none().

          Subsequent calls (step 5) check for null (false), then check for none() (true), and then return null.

          Show
          danielbeck Daniel Beck added a comment - This seems to be a bug in core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java 's getNextBuild() : The first call to that method (step 3) sets nextBuildR to none() . Subsequent calls (step 5) check for null ( false ), then check for none() ( true ), and then return null .
          Hide
          jglick Jesse Glick added a comment -

          Not related to JENKINS-22052 since you see this with a freestyle project. Probably also not related to JENKINS-22395 since that involves build deletion.

          I think the bug is that when the new build is created, if you are not displaying it right away (which would be the case if you merely scheduled it), getPreviousBuild is not getting called on the new build, and thus nextBuildR is not getting updated on the first build. If true (and that would be pretty easy to test), the fix would simply be to call getPreviousBuild as soon as possible, such as from LazyBuildMixIn.newBuild.

          Show
          jglick Jesse Glick added a comment - Not related to JENKINS-22052 since you see this with a freestyle project. Probably also not related to JENKINS-22395 since that involves build deletion. I think the bug is that when the new build is created, if you are not displaying it right away (which would be the case if you merely scheduled it), getPreviousBuild is not getting called on the new build, and thus nextBuildR is not getting updated on the first build. If true (and that would be pretty easy to test), the fix would simply be to call getPreviousBuild as soon as possible, such as from LazyBuildMixIn.newBuild .
          Hide
          danielbeck Daniel Beck added a comment -

          Jesse: Sorry about the wrong track!

          Show
          danielbeck Daniel Beck added a comment - Jesse: Sorry about the wrong track!
          Show
          danielbeck Daniel Beck added a comment - https://github.com/jenkinsci/jenkins/pull/1191
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Daniel Beck
          Path:
          core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java
          http://jenkins-ci.org/commit/jenkins/e6e7526021bdc8e4975c816944b931dcc5f739c0
          Log:
          [FIXED JENKINS-20662] Establish relation to new build immediately.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java http://jenkins-ci.org/commit/jenkins/e6e7526021bdc8e4975c816944b931dcc5f739c0 Log: [FIXED JENKINS-20662] Establish relation to new build immediately.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Daniel Beck
          Path:
          test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy
          http://jenkins-ci.org/commit/jenkins/26735ec022d57ffd48340d5aa641e80b84b022c2
          Log:
          JENKINS-20662 Add test.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy http://jenkins-ci.org/commit/jenkins/26735ec022d57ffd48340d5aa641e80b84b022c2 Log: JENKINS-20662 Add test.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Daniel Beck
          Path:
          test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy
          http://jenkins-ci.org/commit/jenkins/b59c490a3b49d72e20007c1ca26051b6602f2401
          Log:
          JENKINS-20662 Simplify test after feedback

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy http://jenkins-ci.org/commit/jenkins/b59c490a3b49d72e20007c1ca26051b6602f2401 Log: JENKINS-20662 Simplify test after feedback
          Hide
          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/LazyBuildMixIn.java
          test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy
          http://jenkins-ci.org/commit/jenkins/b227088704070acf5a50486be0ff6a315e36a9c5
          Log:
          Merge branch 'JENKINS-20662' of github.com:daniel-beck/jenkins

          Show
          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/LazyBuildMixIn.java test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy http://jenkins-ci.org/commit/jenkins/b227088704070acf5a50486be0ff6a315e36a9c5 Log: Merge branch ' JENKINS-20662 ' of github.com:daniel-beck/jenkins
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -
          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: changelog.html http://jenkins-ci.org/commit/jenkins/dad71f530964e99bd0ca9b8d156ddf7ad49b2e43 Log: JENKINS-20662 Noting merge of #1191. Compare: https://github.com/jenkinsci/jenkins/compare/54c5df2c34cf...dad71f530964
          Hide
          dogfood dogfood added a comment -

          Integrated in jenkins_main_trunk #3339
          [FIXED JENKINS-20662] Establish relation to new build immediately. (Revision e6e7526021bdc8e4975c816944b931dcc5f739c0)
          JENKINS-20662 Add test. (Revision 26735ec022d57ffd48340d5aa641e80b84b022c2)
          JENKINS-20662 Simplify test after feedback (Revision b59c490a3b49d72e20007c1ca26051b6602f2401)
          JENKINS-20662 Noting merge of #1191. (Revision dad71f530964e99bd0ca9b8d156ddf7ad49b2e43)

          Result = SUCCESS
          daniel-beck : e6e7526021bdc8e4975c816944b931dcc5f739c0
          Files :

          • core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java

          daniel-beck : 26735ec022d57ffd48340d5aa641e80b84b022c2
          Files :

          • test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy

          daniel-beck : b59c490a3b49d72e20007c1ca26051b6602f2401
          Files :

          • test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy

          Jesse Glick : dad71f530964e99bd0ca9b8d156ddf7ad49b2e43
          Files :

          • changelog.html
          Show
          dogfood dogfood added a comment - Integrated in jenkins_main_trunk #3339 [FIXED JENKINS-20662] Establish relation to new build immediately. (Revision e6e7526021bdc8e4975c816944b931dcc5f739c0) JENKINS-20662 Add test. (Revision 26735ec022d57ffd48340d5aa641e80b84b022c2) JENKINS-20662 Simplify test after feedback (Revision b59c490a3b49d72e20007c1ca26051b6602f2401) JENKINS-20662 Noting merge of #1191. (Revision dad71f530964e99bd0ca9b8d156ddf7ad49b2e43) Result = SUCCESS daniel-beck : e6e7526021bdc8e4975c816944b931dcc5f739c0 Files : core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java daniel-beck : 26735ec022d57ffd48340d5aa641e80b84b022c2 Files : test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy daniel-beck : b59c490a3b49d72e20007c1ca26051b6602f2401 Files : test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy Jesse Glick : dad71f530964e99bd0ca9b8d156ddf7ad49b2e43 Files : changelog.html

            People

            Assignee:
            danielbeck Daniel Beck
            Reporter:
            danielbeck Daniel Beck
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: