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

NPE if credentials aren't provided but necessary

    XMLWordPrintable

Details

    Description

      I've tried to use Monitoring External Jobs plug-in as described on Wiki. Plug-in works correctly, but I'm not satisfied with error handling - user isn't navigated properly what goes wrong.

      Example:
      Jenkins instance needs a proper credentials provided by client, otherwise request is rejected...

      Well, through programatical way I've got an expected result:

      curl -X POST -d '<run><log encoding="hexBinary">4142430A</log><result>0</result><duration>2000</duration></run>' https://<_hostname_>/hudson/job/<_job_>/postBuildResult 
      
      <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
      <html><head>
      <title>401 Authorization Required</title>
      </head><body>
      <h1>Authorization Required</h1>
      .
      .
      

      The same via Jenkins core produces a NPE:

      export JENKINS_HOME="https://<_hostname_>/hudson/"
      java -Djavax.net.ssl.trustStore=my.store -jar jenkins-core-1.580.3-3.5febb286.jar  <_job_> echo ABC
      ABC
      java.lang.NullPointerException
              at hudson.Util.copyStream(Util.java:460)
              at hudson.Main.remotePost(Main.java:184)
              at hudson.Main.run(Main.java:73)
              at hudson.Main.main(Main.java:55)
      

      Why isn't the second way handled and correctly reported to the user?

      In addition my Jenkins instance is a bit slow (let say, Jenkins spends approx. 30s in each request/response cycle), I've got quite often an SocketTimeoutException for the same request on client side (as described above in second example with fixed JENKINS_HOME content):

      java.net.SocketTimeoutException: Read timed out
              at java.net.SocketInputStream.socketRead0(Native Method)
              at java.net.SocketInputStream.read(SocketInputStream.java:152)
              at java.net.SocketInputStream.read(SocketInputStream.java:122)
              at sun.security.ssl.InputRecord.readFully(InputRecord.java:442)
              at sun.security.ssl.InputRecord.read(InputRecord.java:480)
              at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:927)
              at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:884)
              at sun.security.ssl.AppInputStream.read(AppInputStream.java:102)
              at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
              at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
              at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
              at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
              at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:633)
              at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1323)
              at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
              at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
              at hudson.Main.remotePost(Main.java:183)
              at hudson.Main.run(Main.java:73)
              at hudson.Main.main(Main.java:55)
      

      BUT the output is correctly saved on Jenkins side into the run though...

      Attachments

        Activity

          There are no comments yet on this issue.

          People

            kohsuke Kohsuke Kawaguchi
            pajasoft Pavel Janoušek
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: