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

"java.io.IOException: Stream closed" when monitoring a jenkins job build number

    Details

      Description

      I have a URL trigger on jenkins server A (v1.439) setup to monitor the build number of job on jenkins server B (v1.437).

      This is the URL trigger log:

      Polling started on Nov 24, 2011 9:46:30 AM
      Invoking the url: 
       http://<jenkinsB>/job/<somejob>/lastSuccessfulBuild/buildNumber
      Inspecting the content
      The line '124' matches the pattern '[0-9]+'
      [ERROR] - SEVERE - Polling error java.io.IOException: Stream closed
      

      This is the response header for the url when viewing it in chrome debugger:

      HTTP/1.1 200 OK
      Server: Winstone Servlet Engine v0.9.10
      Content-Type: text/plain;charset=US-ASCII
      Connection: Close
      Date: Thu, 24 Nov 2011 10:11:31 GMT
      X-Powered-By: Servlet/2.5 (Winstone/0.9.10)
      

      I can workaround this by using the api url to fetch the build number http://<jenkinsB>/job/<somejob>/lastSuccessfulBuild/api/xml?xpath=string(*/number) which does not close the connection.

      1. config.xml
        1 kB
        Oliver Walsh
      2. config.xml
        0.5 kB
        Oliver Walsh

        Activity

        oliverw Oliver Walsh created issue -
        Hide
        oliverw Oliver Walsh added a comment -

        Actually the workaround isn't working either. It continues triggering for the same content e.g with a 1 minute schedule:

        Inspecting TXT content for URL http://<jenkinsB>/job/<somejob>/lastSuccessfulBuild/api/xml?xpath=string(*/number)
        Polling started on Nov 29, 2011 1:17:29 PM
        Invoking the url: 
         http://<jenkinsB>/job/<somejob>/lastSuccessfulBuild/api/xml?xpath=string(*/number)
        Inspecting the content
        The line '153' matches the pattern '[0-9]+'
        Polling complete. Took 0.37 sec
        There are changes. Scheduling a build.
        
        Inspecting TXT content for URL http://<jenkinsB>/job/<somejob>/lastSuccessfulBuild/api/xml?xpath=string(*/number)
        Polling started on Nov 29, 2011 1:18:29 PM
        Invoking the url: 
         http://<jenkinsB>/job/<somejob>/lastSuccessfulBuild/api/xml?xpath=string(*/number)
        Inspecting the content
        The line '153' matches the pattern '[0-9]+'
        Polling complete. Took 0.37 sec
        There are changes. Scheduling a build.
        
        Show
        oliverw Oliver Walsh added a comment - Actually the workaround isn't working either. It continues triggering for the same content e.g with a 1 minute schedule: Inspecting TXT content for URL http://<jenkinsB>/job/<somejob>/lastSuccessfulBuild/api/xml?xpath=string(*/number) Polling started on Nov 29, 2011 1:17:29 PM Invoking the url: http://<jenkinsB>/job/<somejob>/lastSuccessfulBuild/api/xml?xpath=string(*/number) Inspecting the content The line '153' matches the pattern '[0-9]+' Polling complete. Took 0.37 sec There are changes. Scheduling a build. Inspecting TXT content for URL http://<jenkinsB>/job/<somejob>/lastSuccessfulBuild/api/xml?xpath=string(*/number) Polling started on Nov 29, 2011 1:18:29 PM Invoking the url: http://<jenkinsB>/job/<somejob>/lastSuccessfulBuild/api/xml?xpath=string(*/number) Inspecting the content The line '153' matches the pattern '[0-9]+' Polling complete. Took 0.37 sec There are changes. Scheduling a build.
        Hide
        oliverw Oliver Walsh added a comment - - edited

        The issue with the workaround looks like a doc issue. The help for the TXT content type says:

        Check text content of the specified URL.
        You have to give regular expressions (regEx).
        A build is triggered if the value of regular expressions have changed between 2 polls.

        I took this to mean that the md5sum of the matched strings would be compared between 2 polls to determine if a build is triggered.
        From looking at source a build is triggered by the first regular expression match and it has nothing to do with changes between 2 polls.

        Show
        oliverw Oliver Walsh added a comment - - edited The issue with the workaround looks like a doc issue. The help for the TXT content type says: Check text content of the specified URL. You have to give regular expressions (regEx). A build is triggered if the value of regular expressions have changed between 2 polls. I took this to mean that the md5sum of the matched strings would be compared between 2 polls to determine if a build is triggered. From looking at source a build is triggered by the first regular expression match and it has nothing to do with changes between 2 polls.
        gbois Gregory Boissinot made changes -
        Field Original Value New Value
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        gbois Gregory Boissinot added a comment -

        Could you attach your job configuration file (config.xml in your JENKINS_HOME/jobs/<job_name>)?

        Show
        gbois Gregory Boissinot added a comment - Could you attach your job configuration file (config.xml in your JENKINS_HOME/jobs/<job_name>)?
        Hide
        scm_issue_link SCM/JIRA link daemon added a comment -

        Code changed in jenkins
        User: Gregory Boissinot
        Path:
        src/main/java/org/jenkinsci/plugins/urltrigger/URLTrigger.java
        src/main/java/org/jenkinsci/plugins/urltrigger/service/URLTriggerService.java
        src/main/resources/org/jenkinsci/plugins/urltrigger/URLTriggerAction/index.jelly
        src/test/java/org/jenkinsci/plugins/urltrigger/service/URLTriggerServiceTest.java
        http://jenkins-ci.org/commit/urltrigger-plugin/6543a8daef9c2b982facad5cf4ccb161e20c8e3e
        Log:
        Fix JENKINS-11859

        Show
        scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: src/main/java/org/jenkinsci/plugins/urltrigger/URLTrigger.java src/main/java/org/jenkinsci/plugins/urltrigger/service/URLTriggerService.java src/main/resources/org/jenkinsci/plugins/urltrigger/URLTriggerAction/index.jelly src/test/java/org/jenkinsci/plugins/urltrigger/service/URLTriggerServiceTest.java http://jenkins-ci.org/commit/urltrigger-plugin/6543a8daef9c2b982facad5cf4ccb161e20c8e3e Log: Fix JENKINS-11859
        gbois Gregory Boissinot made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        oliverw Oliver Walsh added a comment -

        Job A config

        Show
        oliverw Oliver Walsh added a comment - Job A config
        oliverw Oliver Walsh made changes -
        Attachment config.xml [ 21371 ]
        Hide
        oliverw Oliver Walsh added a comment -

        Job B config

        Show
        oliverw Oliver Walsh added a comment - Job B config
        oliverw Oliver Walsh made changes -
        Attachment config.xml [ 21372 ]
        Hide
        oliverw Oliver Walsh added a comment -

        Hi,

        I can't confirm if this issue is fixed. Polling does not seems run at all with the latest jenkins and urltrigger plugin.

        I've attached the configs for a simple no-op job A and another job B that monitors the MD5 of http://localhost:<port>/job/job%20A/lastSuccessfulBuild/buildNumber every minute.

        The URL Trigger log contains the following (after ~15 minutes):

        Inspecting XML content for URL http://localhost:8001/job/job%20A/lastSuccessfulBuild/api/xml

        Polling has not run yet.

        Thanks,
        Ollie

        Show
        oliverw Oliver Walsh added a comment - Hi, I can't confirm if this issue is fixed. Polling does not seems run at all with the latest jenkins and urltrigger plugin. I've attached the configs for a simple no-op job A and another job B that monitors the MD5 of http://localhost: <port>/job/job%20A/lastSuccessfulBuild/buildNumber every minute. The URL Trigger log contains the following (after ~15 minutes): Inspecting XML content for URL http://localhost:8001/job/job%20A/lastSuccessfulBuild/api/xml Polling has not run yet. Thanks, Ollie
        Hide
        oliverw Oliver Walsh added a comment -

        Working with jenkins 1.452 & urltrigger 0.14.

        Thanks,
        Ollie

        Show
        oliverw Oliver Walsh added a comment - Working with jenkins 1.452 & urltrigger 0.14. Thanks, Ollie
        oliverw Oliver Walsh made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            gbois Gregory Boissinot
            Reporter:
            oliverw Oliver Walsh
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: