• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • core
    • Jenkins >= 1.601

      Please look at the following comment:

      https://issues.jenkins-ci.org/browse/JENKINS-12827?focusedCommentId=201381&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-201381

      This behavior does not work anymore in Jenkins 1.601.
      The queue item URL which is in the location header of the start-build URL returns HTTP status code 404.

      Steps to reproduce the problem

      Start build via Remote API

      The initial request was:

      http://myjenkins/job/zzz_dummy_a61d370a3954428a949b87fc3d8f3cf8/build

      The HTTP header contains the correct location URL:

      HTTP/1.1 201 Created
      Date: ...
      Server: ...
      Location: http://myjenkins/queue/item/68/
      

      Queue object while build is in the queue

      That works in all used Jenkins versions.
      URL: https://myjenkins:8081/queue/api/json
      JSON response:

      {
          "items": 
      [
      {
          "actions": 
      [
      {
          "causes": 
      [
                  {
                      "shortDescription": "Started by user XYZ",
                      "userId": "xyz",
                      "userName": "xyz"
                  }
              ]
          }
      ],
      "blocked": false,
      "buildable": false,
      "id": 68,
      "inQueueSince": 1425545634280,
      "params": "",
      "stuck": false,
      "task":
                  {
                      "name": "zzz_dummy_a61d370a3954428a949b87fc3d8f3cf8",
                      "url": "https://myjenkins:8081/job/zzz_dummy_a61d370a3954428a949b87fc3d8f3cf8/",
                      "color": "notbuilt"
                  },
                  "url": "queue/item/68/",
                  "why": "In the quiet period. Expires in 4.2 sec",
                  "timestamp": 1425545639280
              }
          ]
      }
      

      Queue item object while build is in the queue

      That does not work anymore in Jenkins 1.601. The following queue item URL is not found (HTTP status code 404).
      URL: https://myjenkins:8081/queue/item/68/api/json
      JSON response:

      {
          "actions": 
      [
      {
          "causes": 
      [
                  {
                      "shortDescription": "Started by user xyz
                      "userId": "xyz",
                      "userName": "xyz"
                  }
              ]
          }
      ],
      "blocked": false,
      "buildable": false,
      "id": 68,
      "inQueueSince": 1425545634280,
      "params": "",
      "stuck": false,
      "task":
      {
          "name": "zzz_dummy_a61d370a3954428a949b87fc3d8f3cf8",
          "url": "https://myjenkins:8081/job/zzz_dummy_a61d370a3954428a949b87fc3d8f3cf8/",
          "color": "blue"
      },
      "url": "queue/item/68/",
      "why": null,
      "cancelled": false,
      "executable":
          {
              "number": 1,
              "url": "https://myjenkins:8081/job/zzz_dummy_a61d370a3954428a949b87fc3d8f3cf8/1/"
          }
      }
      

      Cause of the issue

      The reasons of the problem could be:

      1. The quiet period parameter is ignored. (In our case in it is 5 seconds by default.) That would mean, that queue item is deleted very fast and could not be requested properly.
      2. Maybe the queue item URL is not yet created anymore.

      Possible Solution

      In my opinion the solution would be to make the queue item URL still accessible even if the queue item is deleted. For our build workflow that would be a fine solution.

      Or is there any other way to request finished queue items?

      Goal

      Our goal is to track a Jenkins build via external tools. So if there is another way to safely track a started build, please let me know.

          [JENKINS-27256] Jenkins Remote API - Queue behavior changed

          Daniel Beck added a comment -

          Thanks for the report!

          This broke due to PR 1566.

          My analysis on Github: https://github.com/jenkinsci/jenkins/pull/1566/files#r25853828

          Daniel Beck added a comment - Thanks for the report! This broke due to PR 1566. My analysis on Github: https://github.com/jenkinsci/jenkins/pull/1566/files#r25853828

          Jesse Glick added a comment -

          Apparently there were no test cases exercising the remote API for the queue.

          Jesse Glick added a comment - Apparently there were no test cases exercising the remote API for the queue.

          Jesse Glick added a comment -

          Need a patch to Stapler.

          Jesse Glick added a comment - Need a patch to Stapler.

          This bug has just broken all CI infrastructure at my organization and we had to downgrade to 1.600.

          Some more investigation:

          • quiet period is NOT ignored and the item actually does await in the queue until the quiet period expires
          • during the quiet period queue api (JENKINS_URL/queue/api/json) does show an item in it, but any attempt to access item's api (JENKINS_URL/queue/item/ITEM_ID/api/json), even while the item is in the quiet period results in 404
          • after the quiet period expires any attempt to access item's api also results in 404, although it should be accessible for 5 more minutes: https://issues.jenkins-ci.org/browse/JENKINS-26228?focusedCommentId=218310#comment-218310

          Morgwai Kotarbinski added a comment - This bug has just broken all CI infrastructure at my organization and we had to downgrade to 1.600. Some more investigation: quiet period is NOT ignored and the item actually does await in the queue until the quiet period expires during the quiet period queue api (JENKINS_URL/queue/api/json) does show an item in it, but any attempt to access item's api (JENKINS_URL/queue/item/ITEM_ID/api/json), even while the item is in the quiet period results in 404 after the quiet period expires any attempt to access item's api also results in 404, although it should be accessible for 5 more minutes: https://issues.jenkins-ci.org/browse/JENKINS-26228?focusedCommentId=218310#comment-218310

          As I understand https://github.com/jenkinsci/jenkins/pull/1566/ does not solve https://issues.jenkins-ci.org/browse/JENKINS-26445 yet, so could we please revert it until it's fixed in a way not to break queue api?

          Morgwai Kotarbinski added a comment - As I understand https://github.com/jenkinsci/jenkins/pull/1566/ does not solve https://issues.jenkins-ci.org/browse/JENKINS-26445 yet, so could we please revert it until it's fixed in a way not to break queue api?

          Daniel Beck added a comment -

          That would be an incompatible change to a released version, something usually avoided.

          In fact, the fix (in Stapler) appears to be pretty trivial, it just needs to be done...

          Daniel Beck added a comment - That would be an incompatible change to a released version, something usually avoided. In fact, the fix (in Stapler) appears to be pretty trivial, it just needs to be done...

          Mike Solomon added a comment -

          Good to know it's trivial. @Morgawai FWIW, you're not alone on feeling the pain... My team has been using a workaround since this bug surfaced, it would be nice to see it resolved shortly.

          Mike Solomon added a comment - Good to know it's trivial. @Morgawai FWIW, you're not alone on feeling the pain... My team has been using a workaround since this bug surfaced, it would be nice to see it resolved shortly.

          @Daniel: I'd say breaking the queue behavior is an incompatible change as well Now, favoring a newly introduced feature (that was introduced as a first of many steps to fix the bug that is not fixed yet anyway and does not seem to bring much value on itself, so most probably is not widely adopted), over a feature that is known to be widely used for a long time (by vast majority of the remote API users) is not a good decision IMHO.

          Additionally 1.600 turned to be unusable because of 27188 and 1.599 and earlier ones have serious security problems, so for example at my organization we don't have CI at the moment and the fact the fix in Stapler is trivial does necessarily implies it will be released soon, so we are all very sad here

          @Mike: Do you have a workaround maybe that is any simpler than supplying unique additional parameter to the build request and then searching among job's builds for the one containing it? If so, could you please share it? Thanks in advance!

          Morgwai Kotarbinski added a comment - @Daniel: I'd say breaking the queue behavior is an incompatible change as well Now, favoring a newly introduced feature (that was introduced as a first of many steps to fix the bug that is not fixed yet anyway and does not seem to bring much value on itself, so most probably is not widely adopted), over a feature that is known to be widely used for a long time (by vast majority of the remote API users) is not a good decision IMHO. Additionally 1.600 turned to be unusable because of 27188 and 1.599 and earlier ones have serious security problems , so for example at my organization we don't have CI at the moment and the fact the fix in Stapler is trivial does necessarily implies it will be released soon, so we are all very sad here @Mike: Do you have a workaround maybe that is any simpler than supplying unique additional parameter to the build request and then searching among job's builds for the one containing it? If so, could you please share it? Thanks in advance!

          Mike Solomon added a comment -

          @Morgwai That is the workaround If this is still live by Friday I will have some time to dig in and play around with it. If anything comes from that I will let you know.

          Mike Solomon added a comment - @Morgwai That is the workaround If this is still live by Friday I will have some time to dig in and play around with it. If anything comes from that I will let you know.

          Daniel Beck added a comment -

          I wrote a plugin that exposes the /queuefix/item/xx URL and can be used like /queue/item/xx.

          Source code (for the paranoid): https://github.com/daniel-beck/jenkins-queuefix-plugin
          Plugin download (for the inept): https://dl.dropboxusercontent.com/u/29853/queuefix-JENKINS-27256.hpi

          Plugins can be uploaded to Jenkins via the Manage Plugins "Advanced" tab.

          Daniel Beck added a comment - I wrote a plugin that exposes the /queuefix/item/xx URL and can be used like /queue/item/xx . Source code (for the paranoid): https://github.com/daniel-beck/jenkins-queuefix-plugin Plugin download (for the inept): https://dl.dropboxusercontent.com/u/29853/queuefix-JENKINS-27256.hpi Plugins can be uploaded to Jenkins via the Manage Plugins "Advanced" tab.

          @Daniel: WOW, many many thanks for this! I will try it later today.

          Morgwai Kotarbinski added a comment - @Daniel: WOW, many many thanks for this! I will try it later today.

          Eloy Lafuente added a comment -

          From an inept (literally)... we have just installed Daniel's queuefix plugin here in 2 servers and... yay, it worked, saving us the day/week. Many, many thanks.

          Hope this becomes fixed upstream soon coz can imagine lots of ppl relying on that for all sort of integrations (as we do). TIA!

          Ciao

          Eloy Lafuente added a comment - From an inept (literally)... we have just installed Daniel's queuefix plugin here in 2 servers and... yay, it worked, saving us the day/week. Many, many thanks. Hope this becomes fixed upstream soon coz can imagine lots of ppl relying on that for all sort of integrations (as we do). TIA! Ciao

          Daniel Beck added a comment -

          Glad it worked!

          Unfortunately I don't have the time to do the fix myself. Throwing together a one-off plugin is much easier than patching the framework used by everyone, at least if I want to do it right.

          Daniel Beck added a comment - Glad it worked! Unfortunately I don't have the time to do the fix myself. Throwing together a one-off plugin is much easier than patching the framework used by everyone, at least if I want to do it right.

          Tom FENNELLY added a comment -

          Not sure who changed the state of this JIRA to "In Progress" (wasn't me), but anyway: https://github.com/stapler/stapler/pull/46

          Tom FENNELLY added a comment - Not sure who changed the state of this JIRA to "In Progress" (wasn't me), but anyway: https://github.com/stapler/stapler/pull/46

          I installed the plugin but to no avail. I am still getting a 404 when going to <server>/jenkins/queue/item/13/

          A fix is urgently needed. Our build system is partially broken because of this.

          Thank you for the very quick reaction and assessment of the situation.

          Barthélémy von Haller added a comment - I installed the plugin but to no avail. I am still getting a 404 when going to <server>/jenkins/queue/item/13/ A fix is urgently needed. Our build system is partially broken because of this. Thank you for the very quick reaction and assessment of the situation.

          Morgwai Kotarbinski added a comment - - edited

          @Barthélémy von Haller,
          Please read Daniel Beck's comment about the plugin again carefully: it's 'queuefix' not 'queue' in the URI.
          You can use some http proxy to rewrite it for you if changing your client side is not an acceptable solution.

          Morgwai Kotarbinski added a comment - - edited @Barthélémy von Haller, Please read Daniel Beck's comment about the plugin again carefully: it's 'queuefix' not 'queue' in the URI. You can use some http proxy to rewrite it for you if changing your client side is not an acceptable solution.

          Tom FENNELLY added a comment -

          @Barthélémy we have a fix ready for this. It requires a release of stapler and we're just waiting on KK to do that. He was traveling last week but will hopefully get to it early this week.

          Tom FENNELLY added a comment - @Barthélémy we have a fix ready for this. It requires a release of stapler and we're just waiting on KK to do that. He was traveling last week but will hopefully get to it early this week.

          @Morgwai Kotarbinski,
          Indeed, I overlooked the address. Unfortunately, it does not work either. I restarted Jenkins after installing the plugin and the plugin is said to be installed. Well, I guess that we will wait for the fix.

          Barthélémy von Haller added a comment - @Morgwai Kotarbinski, Indeed, I overlooked the address. Unfortunately, it does not work either. I restarted Jenkins after installing the plugin and the plugin is said to be installed. Well, I guess that we will wait for the fix.

          that's strange: it works for me and others here also reported it works for them...

          Morgwai Kotarbinski added a comment - that's strange: it works for me and others here also reported it works for them...

          Yes, I must be doing something wrong.

          Barthélémy von Haller added a comment - Yes, I must be doing something wrong.

          Daniel Beck added a comment -

          When running the following in Manage Jenkins, Script Console:

          Jenkins.instance.getExtensionList(RootAction).each { println it.urlName } ; return

          It should show an entry "queuefix" (among other items). Otherwise, something probably went wrong when loading the plugin. Check the Jenkins log.

          Daniel Beck added a comment - When running the following in Manage Jenkins, Script Console : Jenkins.instance.getExtensionList(RootAction).each { println it.urlName } ; return It should show an entry "queuefix" (among other items). Otherwise, something probably went wrong when loading the plugin. Check the Jenkins log.

          Code changed in jenkins
          User: tfennelly
          Path:
          core/pom.xml
          test/src/test/java/hudson/model/QueueTest.java
          http://jenkins-ci.org/commit/jenkins/ad9d191cbcee8928744d375bc13c629bd470329b
          Log:
          [FIXED JENKINS-27256] Added functional test for stapler fix to handle dispatcher methods for getX(long) model methods

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: tfennelly Path: core/pom.xml test/src/test/java/hudson/model/QueueTest.java http://jenkins-ci.org/commit/jenkins/ad9d191cbcee8928744d375bc13c629bd470329b Log: [FIXED JENKINS-27256] Added functional test for stapler fix to handle dispatcher methods for getX(long) model methods

          Code changed in jenkins
          User: tfennelly
          Path:
          changelog.html
          cli/pom.xml
          core/pom.xml
          core/src/main/java/hudson/model/AbstractItem.java
          debian/debian/changelog
          plugins/pom.xml
          pom.xml
          test/pom.xml
          war/pom.xml
          http://jenkins-ci.org/commit/jenkins/7e5063937c31ee33de29254f1f13f5d4aa0d6174
          Log:
          Merge branch 'master' into JENKINS-27256

          • master:
            Updated changelog
            updated changelog as a part of the release
            [maven-release-plugin] prepare for next development iteration
            [maven-release-plugin] prepare release jenkins-1.604
            Noting #1597
            Noting #1593, #1579, move JENKINS-22346, #1558
            Remove two fixes that were backported to RC
            JENKINS-27183 Avoid deadlock when using build-monitor-plugin

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: tfennelly Path: changelog.html cli/pom.xml core/pom.xml core/src/main/java/hudson/model/AbstractItem.java debian/debian/changelog plugins/pom.xml pom.xml test/pom.xml war/pom.xml http://jenkins-ci.org/commit/jenkins/7e5063937c31ee33de29254f1f13f5d4aa0d6174 Log: Merge branch 'master' into JENKINS-27256 master: Updated changelog updated changelog as a part of the release [maven-release-plugin] prepare for next development iteration [maven-release-plugin] prepare release jenkins-1.604 Noting #1597 Noting #1593, #1579, move JENKINS-22346 , #1558 Remove two fixes that were backported to RC JENKINS-27183 Avoid deadlock when using build-monitor-plugin

          Code changed in jenkins
          User: Tom Fennelly
          Path:
          core/pom.xml
          test/src/test/java/hudson/model/QueueTest.java
          http://jenkins-ci.org/commit/jenkins/6bdd321228e1d8bcea43622c0af4b4cd9eedbc74
          Log:
          Merge pull request #1603 from tfennelly/JENKINS-27256

          [FIXED JENKINS-27256] Added functional test for stapler fix

          Compare: https://github.com/jenkinsci/jenkins/compare/11786d8858df...6bdd321228e1

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Tom Fennelly Path: core/pom.xml test/src/test/java/hudson/model/QueueTest.java http://jenkins-ci.org/commit/jenkins/6bdd321228e1d8bcea43622c0af4b4cd9eedbc74 Log: Merge pull request #1603 from tfennelly/ JENKINS-27256 [FIXED JENKINS-27256] Added functional test for stapler fix Compare: https://github.com/jenkinsci/jenkins/compare/11786d8858df...6bdd321228e1

          Code changed in jenkins
          User: tfennelly
          Path:
          changelog.html
          http://jenkins-ci.org/commit/jenkins/73c3021b70807fec81895ef3cee805bbb694d4b9
          Log:
          Noting JENKINS-27256

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: tfennelly Path: changelog.html http://jenkins-ci.org/commit/jenkins/73c3021b70807fec81895ef3cee805bbb694d4b9 Log: Noting JENKINS-27256

          dogfood added a comment -

          Integrated in jenkins_main_trunk #4011
          [FIXED JENKINS-27256] Added functional test for stapler fix to handle dispatcher methods for getX(long) model methods (Revision ad9d191cbcee8928744d375bc13c629bd470329b)

          Result = SUCCESS
          tom.fennelly : ad9d191cbcee8928744d375bc13c629bd470329b
          Files :

          • core/pom.xml
          • test/src/test/java/hudson/model/QueueTest.java

          dogfood added a comment - Integrated in jenkins_main_trunk #4011 [FIXED JENKINS-27256] Added functional test for stapler fix to handle dispatcher methods for getX(long) model methods (Revision ad9d191cbcee8928744d375bc13c629bd470329b) Result = SUCCESS tom.fennelly : ad9d191cbcee8928744d375bc13c629bd470329b Files : core/pom.xml test/src/test/java/hudson/model/QueueTest.java

          Code changed in jenkins
          User: Daniel Beck
          Path:
          changelog.html
          http://jenkins-ci.org/commit/jenkins/f6fa3c79c67521a801c01a99475b3f31fe2c0bf1
          Log:
          Noting JENKINS-27256 more user friendly

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: changelog.html http://jenkins-ci.org/commit/jenkins/f6fa3c79c67521a801c01a99475b3f31fe2c0bf1 Log: Noting JENKINS-27256 more user friendly

            tfennelly Tom FENNELLY
            fastblitzer Christian Gnüchtel
            Votes:
            4 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: