Jason Howk created JENKINS-13865:
------------------------------------

             Summary: Jenkins /queue/api does not produce properly formatted 
JSON when a build in queue where the destination node/s are busy.
                 Key: JENKINS-13865
                 URL: https://issues.jenkins-ci.org/browse/JENKINS-13865
             Project: Jenkins
          Issue Type: Bug
          Components: core
    Affects Versions: current
         Environment: Linux
            Reporter: Jason Howk


Jenkins /queue/api does not produce properly formatted JSON when build in queue 
where a node/s are fully busy.  The json produced is un-parsable.  This can be 
visible on the builds.apache.org server. 

Example:
"why":"Waiting for next available executor on 
[8mha:AAAAkB+LCAAAAAAAAABb85aBtbiIQSajNKU4P08vOT+vOD8nVc+jsiC1KCczL9svvyT1dMUiOWdZ/mImBiZPBrac1Lz0kgwfBubSopwSBiGfrMSyRP2cxLx0/eCSosy8dOuKIgYpNOOcITTIMAYIYGRiYKgoADLYShgE9JPzcwtKS1KL9HNKk1PzUgENqikilQAAAA==[0mlucene"

Appears that the "why" property of the queued build isn't being formatted 
properly.  Actually it's being gzipped...

Looking at the source, the hudson.model.queue.CauseOfBlockage class appears to 
be the culprit. To wit:

public String getShortDescription() {
            return 
Messages.Queue_WaitingForNextAvailableExecutorOn(HyperlinkNote.encodeTo("/computer/"+
 node.getNodeName(), node.getNodeName()));
        }

The nodename is attempting to be encoded with HyperlinkNote:

public static String encodeTo(String url, String text) {
        try {
            return new HyperlinkNote(url,text.length()).encode()+text;
        } catch (IOException e) {
            // impossible, but don't make this a fatal problem
            LOGGER.log(Level.WARNING, "Failed to serialize 
"+HyperlinkNote.class,e);
            return text;
        }
    }

Which calls the supers encode() method:

public String encode() throws IOException {
        return encodeToBytes().toString();
    }

And finally encodeToBytes():

private ByteArrayOutputStream encodeToBytes() throws IOException {
        ByteArrayOutputStream buf = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(new 
GZIPOutputStream(buf));
        oos.writeObject(this);
        oos.close();

        ByteArrayOutputStream buf2 = new ByteArrayOutputStream();

        DataOutputStream dos = new DataOutputStream(new 
Base64OutputStream(buf2,true,-1,null));
        buf2.write(PREAMBLE);
        dos.writeInt(buf.size());
        buf.writeTo(dos);
        dos.close();
        buf2.write(POSTAMBLE);
        return buf2;
    }

Full output:
{"items":[{"actions":[{"causes":[{"shortDescription":"Started by 
timer"},{"shortDescription":"Started by an SCM 
change"}]}],"blocked":true,"buildable":false,"id":7947,"inQueueSince":1337702458328,"params":"","stuck":false,"task":{"name":"Hive-trunk-h0.21","url":"https://builds.apache.org/job/Hive-trunk-h0.21/","color":"blue_anime"},"why":"Build
 #1,444 is already in progress 
(ETA:N/A)","buildableStartMilliseconds":1337702458330},{"actions":[{"causes":[{"shortDescription":"Started
 by upstream project \"Qpid-Java-Java-MMS-TestMatrix\" build number 
272","upstreamBuild":272,"upstreamProject":"Qpid-Java-Java-MMS-TestMatrix","upstreamUrl":"job/Qpid-Java-Java-MMS-TestMatrix/"}]}],"blocked":true,"buildable":false,"id":8029,"inQueueSince":1337718485444,"params":"","stuck":false,"task":{"name":"Qpid-Java-Java-BDB-TestMatrix","url":"https://builds.apache.org/job/Qpid-Java-Java-BDB-TestMatrix/","color":"red_anime"},"why":"Build
 #244 is already in 
progress","buildableStartMilliseconds":1337718490548},{"actions":[{"causes":[{"shortDescription":"Started
 by 
timer"}]}],"blocked":false,"buildable":true,"id":8036,"inQueueSince":1337719498327,"params":"","stuck":false,"task":{"name":"Lucene-Solr-tests-only-trunk-java7","url":"https://builds.apache.org/job/Lucene-Solr-tests-only-trunk-java7/","color":"blue"},"why":"Waiting
 for next available executor on 
[8mha:AAAAkB+LCAAAAAAAAABb85aBtbiIQSajNKU4P08vOT+vOD8nVc+jsiC1KCczL9svvyT1dMUiOWdZ/mImBiZPBrac1Lz0kgwfBubSopwSBiGfrMSyRP2cxLx0/eCSosy8dOuKIgYpNOOcITTIMAYIYGRiYKgoADLYShgE9JPzcwtKS1KL9HNKk1PzUgENqikilQAAAA==[0mlucene","buildableStartMilliseconds":1337719498431},{"actions":[{"causes":[{"shortDescription":"Started
 by an SCM 
change"}]}],"blocked":false,"buildable":true,"id":7979,"inQueueSince":1337709659182,"params":"","stuck":false,"task":{"name":"Camel.trunk.fulltest.spring3.1","url":"https://builds.apache.org/job/Camel.trunk.fulltest.spring3.1/","color":"blue"},"why":"Waiting
 for next available executor on 
[8mha:AAAAkR+LCAAAAAAAAABb85aBtbiIQSajNKU4P08vOT+vOD8nVc+jsiC1KCczL9svvyT1dMUiOWdZ/mImBiZPBrac1Lz0kgwfBubSopwSBiGfrMSyRP2cxLx0/eCSosy8dOuKIgYpNOOcITTIMAYIYGRiYKgoADLYSxgE9ZPzcwtKS1KL9EuTSvNKSo0BGdSO7JYAAAA=[0mubuntu3","buildableStartMilliseconds":1337709664185},{"actions":[{"causes":[{"shortDescription":"Started
 by upstream project \"commons-vfs-trunk\" build number 
174","upstreamBuild":174,"upstreamProject":"commons-vfs-trunk","upstreamUrl":"job/commons-vfs-trunk/"}]}],"blocked":false,"buildable":true,"id":7726,"inQueueSince":1337670102655,"params":"","stuck":true,"task":{"name":"jdk=JDK
 1.6 
(latest),label=Windows","url":"https://builds.apache.org/job/commons-vfs-trunk/./jdk=JDK%201.6%20(latest),label=Windows/","color":"red"},"why":"windows1
 is 
offline","buildableStartMilliseconds":1337670102656},{"actions":[{"causes":[{"shortDescription":"Started
 by 
timer"}]}],"blocked":false,"buildable":true,"id":7656,"inQueueSince":1337659258327,"params":"","stuck":true,"task":{"name":"dir-studio-jdk16-win","url":"https://builds.apache.org/job/dir-studio-jdk16-win/","color":"blue"},"why":"windows1
 is 
offline","buildableStartMilliseconds":1337659258330},{"actions":[{"causes":[{"shortDescription":"Started
 by 
timer"}]}],"blocked":false,"buildable":true,"id":7654,"inQueueSince":1337659258327,"params":"","stuck":true,"task":{"name":"dir-apacheds-jdk16-win","url":"https://builds.apache.org/job/dir-apacheds-jdk16-win/","color":"red"},"why":"windows1
 is 
offline","buildableStartMilliseconds":1337659258329},{"actions":[{"causes":[{"shortDescription":"Started
 by 
timer"}]}],"blocked":false,"buildable":true,"id":7652,"inQueueSince":1337659258327,"params":"","stuck":true,"task":{"name":"dir-apacheds-jdbm-jdk16-win","url":"https://builds.apache.org/job/dir-apacheds-jdbm-jdk16-win/","color":"blue"},"why":"windows1
 is 
offline","buildableStartMilliseconds":1337659258329},{"actions":[{"causes":[{"shortDescription":"Started
 by 
timer"}]}],"blocked":false,"buildable":true,"id":7632,"inQueueSince":1337655658339,"params":"","stuck":true,"task":{"name":"dir-shared-jdk16-win","url":"https://builds.apache.org/job/dir-shared-jdk16-win/","color":"blue"},"why":"windows1
 is 
offline","buildableStartMilliseconds":1337655658341},{"actions":[{"causes":[{"shortDescription":"Started
 by 
timer"}]}],"blocked":false,"buildable":true,"id":7586,"inQueueSince":1337648458355,"params":"","stuck":true,"task":{"name":"Lucene.Net-Trunk-Contrib-Nightly","url":"https://builds.apache.org/job/Lucene.Net-Trunk-Contrib-Nightly/","color":"red"},"why":"windows1
 is 
offline","buildableStartMilliseconds":1337648458356},{"actions":[{"causes":[{"shortDescription":"Started
 by 
timer"}]}],"blocked":false,"buildable":true,"id":7585,"inQueueSince":1337648458347,"params":"","stuck":true,"task":{"name":"Lucene.Net-Trunk-All-Nightly","url":"https://builds.apache.org/job/Lucene.Net-Trunk-All-Nightly/","color":"red"},"why":"windows1
 is 
offline","buildableStartMilliseconds":1337648458356},{"actions":[{"causes":[{"shortDescription":"Started
 by 
timer"}]}],"blocked":false,"buildable":true,"id":7532,"inQueueSince":1337644858334,"params":"","stuck":true,"task":{"name":"Chemistry
 - 
DotCMIS","url":"https://builds.apache.org/job/Chemistry%20-%20DotCMIS/","color":"red"},"why":"windows1
 is 
offline","buildableStartMilliseconds":1337644858335},{"actions":[{"causes":[{"shortDescription":"Started
 by an SCM change"},{"shortDescription":"Started by an SCM 
change"}]}],"blocked":false,"buildable":true,"id":7418,"inQueueSince":1337630158535,"params":"","stuck":true,"task":{"name":"MINA-trunk-jdk1.6-windows","url":"https://builds.apache.org/job/MINA-trunk-jdk1.6-windows/","color":"blue"},"why":"windows1
 is 
offline","buildableStartMilliseconds":1337630163571},{"actions":[{"causes":[{"shortDescription":"Started
 by an SCM change"},{"shortDescription":"Started by an SCM 
change"}]}],"blocked":false,"buildable":true,"id":7275,"inQueueSince":1337614558658,"params":"","stuck":true,"task":{"name":"vysper-trunk-jdk1.6-windows","url":"https://builds.apache.org/job/vysper-trunk-jdk1.6-windows/","color":"blue"},"why":"windows1
 is 
offline","buildableStartMilliseconds":1337614563761},{"actions":[{"causes":[{"shortDescription":"Started
 by upstream project \"Ant-Build-Matrix\" build number 
484","upstreamBuild":484,"upstreamProject":"Ant-Build-Matrix","upstreamUrl":"job/Ant-Build-Matrix/"}]}],"blocked":false,"buildable":true,"id":7200,"inQueueSince":1337605272264,"params":"","stuck":true,"task":{"name":"jdk=JDK
 1.7 
(latest),label=Windows","url":"https://builds.apache.org/job/Ant-Build-Matrix/./jdk=JDK%201.7%20(latest),label=Windows/","color":"red"},"why":"windows1
 is 
offline","buildableStartMilliseconds":1337605272366},{"actions":[{"causes":[{"shortDescription":"Started
 by upstream project \"Ant-Build-Matrix\" build number 
484","upstreamBuild":484,"upstreamProject":"Ant-Build-Matrix","upstreamUrl":"job/Ant-Build-Matrix/"}]}],"blocked":false,"buildable":true,"id":7199,"inQueueSince":1337605272262,"params":"","stuck":true,"task":{"name":"jdk=JDK
 1.6 
(latest),label=Windows","url":"https://builds.apache.org/job/Ant-Build-Matrix/./jdk=JDK%201.6%20(latest),label=Windows/","color":"red"},"why":"windows1
 is 
offline","buildableStartMilliseconds":1337605272264},{"actions":[{"causes":[{"shortDescription":"Started
 by upstream project \"Ant-Build-Matrix\" build number 
484","upstreamBuild":484,"upstreamProject":"Ant-Build-Matrix","upstreamUrl":"job/Ant-Build-Matrix/"}]}],"blocked":false,"buildable":true,"id":7195,"inQueueSince":1337605272255,"params":"","stuck":true,"task":{"name":"jdk=JDK
 1.5 
(latest),label=Windows","url":"https://builds.apache.org/job/Ant-Build-Matrix/./jdk=JDK%201.5%20(latest),label=Windows/","color":"red"},"why":"windows1
 is 
offline","buildableStartMilliseconds":1337605272258},{"actions":[{"causes":[{"shortDescription":"Started
 by an SCM change"},{"shortDescription":"Started by an SCM 
change"},{"shortDescription":"Started by an SCM 
change"},{"shortDescription":"Started by an SCM 
change"},{"shortDescription":"Started by an SCM 
change"}]}],"blocked":false,"buildable":true,"id":7077,"inQueueSince":1337589060276,"params":"","stuck":true,"task":{"name":"Syncope-windows","url":"https://builds.apache.org/job/Syncope-windows/","color":"blue"},"why":"windows1
 is 
offline","buildableStartMilliseconds":1337589065378},{"actions":[{"causes":[{"shortDescription":"Started
 by timer"},{"shortDescription":"Started by 
timer"}]}],"blocked":false,"buildable":true,"id":7075,"inQueueSince":1337589058332,"params":"","stuck":true,"task":{"name":"ZooKeeper-trunk-WinVS2008_java","url":"https://builds.apache.org/job/ZooKeeper-trunk-WinVS2008_java/","color":"aborted"},"why":"windows1
 is 
offline","buildableStartMilliseconds":1337589058334},{"actions":[{"causes":[{"shortDescription":"Started
 by timer"},{"shortDescription":"Started by upstream project 
\"ZooKeeper-trunk\" build number 
1,562","upstreamBuild":1562,"upstreamProject":"ZooKeeper-trunk","upstreamUrl":"job/ZooKeeper-trunk/"},{"shortDescription":"Started
 by timer"},{"shortDescription":"Started by upstream project 
\"ZooKeeper-trunk\" build number 
1,563","upstreamBuild":1563,"upstreamProject":"ZooKeeper-trunk","upstreamUrl":"job/ZooKeeper-trunk/"}]}],"blocked":false,"buildable":true,"id":7074,"inQueueSince":1337589058332,"params":"","stuck":true,"task":{"name":"ZooKeeper-trunk-WinVS2008","url":"https://builds.apache.org/job/ZooKeeper-trunk-WinVS2008/","color":"blue"},"why":"windows1
 is 
offline","buildableStartMilliseconds":1337589058334},{"actions":[{"causes":[{"shortDescription":"Started
 by upstream project \"TomcatMavenPlugin-mvn3.x\" build number 
150","upstreamBuild":150,"upstreamProject":"TomcatMavenPlugin-mvn3.x","upstreamUrl":"job/TomcatMavenPlugin-mvn3.x/"},{"shortDescription":"Started
 by upstream project \"maven-plugins\" build number 
711","upstreamBuild":711,"upstreamProject":"maven-plugins","upstreamUrl":"job/maven-plugins/"},{"shortDescription":"Started
 by upstream project \"maven-plugins\" build number 
712","upstreamBuild":712,"upstreamProject":"maven-plugins","upstreamUrl":"job/maven-plugins/"},{"shortDescription":"Started
 by an SCM change"},{"shortDescription":"Started by upstream project 
\"maven-plugins\" build number 
713","upstreamBuild":713,"upstreamProject":"maven-plugins","upstreamUrl":"job/maven-plugins/"},{"shortDescription":"Started
 by an SCM change"},{"shortDescription":"Started by an SCM 
change"},{"shortDescription":"Started by an SCM 
change"},{"shortDescription":"Started by an SCM 
change"}]}],"blocked":false,"buildable":true,"id":7067,"inQueueSince":1337588274403,"params":"","stuck":true,"task":{"name":"archiva-all-maven-3.x-jdk-1.6-with-web-it-windows","url":"https://builds.apache.org/job/archiva-all-maven-3.x-jdk-1.6-with-web-it-windows/","color":"red"},"why":"windows1
 is 
offline","buildableStartMilliseconds":1337588279502},{"actions":[{"causes":[{"shortDescription":"Started
 by upstream project \"TomcatMavenPlugin-mvn3.x\" build number 
150","upstreamBuild":150,"upstreamProject":"TomcatMavenPlugin-mvn3.x","upstreamUrl":"job/TomcatMavenPlugin-mvn3.x/"},{"shortDescription":"Started
 by upstream project \"maven-plugins\" build number 
711","upstreamBuild":711,"upstreamProject":"maven-plugins","upstreamUrl":"job/maven-plugins/"},{"shortDescription":"Started
 by upstream project \"maven-plugins\" build number 
712","upstreamBuild":712,"upstreamProject":"maven-plugins","upstreamUrl":"job/maven-plugins/"},{"shortDescription":"Started
 by an SCM change"},{"shortDescription":"Started by upstream project 
\"maven-plugins\" build number 
713","upstreamBuild":713,"upstreamProject":"maven-plugins","upstreamUrl":"job/maven-plugins/"},{"shortDescription":"Started
 by an SCM change"},{"shortDescription":"Started by an SCM 
change"},{"shortDescription":"Started by an SCM 
change"},{"shortDescription":"Started by an SCM 
change"}]}],"blocked":false,"buildable":true,"id":7066,"inQueueSince":1337588274402,"params":"","stuck":true,"task":{"name":"archiva-all-maven-3.x-jdk-1.6-with-web-it-js-windows","url":"https://builds.apache.org/job/archiva-all-maven-3.x-jdk-1.6-with-web-it-js-windows/","color":"red"},"why":"windows1
 is 
offline","buildableStartMilliseconds":1337588279502},{"actions":[{"causes":[{"shortDescription":"Started
 by upstream project \"TomcatMavenPlugin-mvn3.x\" build number 
150","upstreamBuild":150,"upstreamProject":"TomcatMavenPlugin-mvn3.x","upstreamUrl":"job/TomcatMavenPlugin-mvn3.x/"},{"shortDescription":"Started
 by an SCM change"},{"shortDescription":"Started by an SCM 
change"},{"shortDescription":"Started by an SCM 
change"},{"shortDescription":"Started by an SCM 
change"},{"shortDescription":"Started by an SCM 
change"}]}],"blocked":false,"buildable":true,"id":7065,"inQueueSince":1337588274400,"params":"","stuck":true,"task":{"name":"archiva-all-maven-3.x-jdk-1.6-windows","url":"https://builds.apache.org/job/archiva-all-maven-3.x-jdk-1.6-windows/","color":"red"},"why":"windows1
 is 
offline","buildableStartMilliseconds":1337588279502},{"actions":[{"causes":[{"shortDescription":"Started
 by an SCM change"},{"shortDescription":"Started by an SCM 
change"},{"shortDescription":"Started by an SCM 
change"},{"shortDescription":"Started by an SCM 
change"}]}],"blocked":false,"buildable":true,"id":7018,"inQueueSince":1337580058684,"params":"","stuck":true,"task":{"name":"Camel.trunk.fulltest.windows","url":"https://builds.apache.org/job/Camel.trunk.fulltest.windows/","color":"red"},"why":"windows1
 is 
offline","buildableStartMilliseconds":1337580063751},{"actions":[{"causes":[{"shortDescription":"Started
 by timer"},{"shortDescription":"Started by an SCM 
change"},{"shortDescription":"Started by an SCM 
change"},{"shortDescription":"Started by timer"},{"shortDescription":"Started 
by an SCM 
change"}]}],"blocked":false,"buildable":true,"id":7009,"inQueueSince":1337579938326,"params":"","stuck":true,"task":{"name":"Flex_SDK_build","url":"https://builds.apache.org/job/Flex_SDK_build/","color":"blue"},"why":"windows1
 is 
offline","buildableStartMilliseconds":1337579938427},{"actions":[{"causes":[{"shortDescription":"Started
 by upstream project \"Empire-db multios\" build number 
71","upstreamBuild":71,"upstreamProject":"Empire-db 
multios","upstreamUrl":"job/Empire-db%20multios/"}]}],"blocked":false,"buildable":true,"id":7003,"inQueueSince":1337577371867,"params":"","stuck":true,"task":{"name":"jdk=JDK
 1.6 
(latest),label=Windows","url":"https://builds.apache.org/job/Empire-db%20multios/./jdk=JDK%201.6%20(latest),label=Windows/","color":"blue"},"why":"windows1
 is offline","buildableStartMilliseconds":1337577371968}]} 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to