java.net.SocketTimeoutException: Read timed out

Jenkins JIRA | Pavel Janoušek | 1 year ago
  1. 0

    I've tried to use [Monitoring External Jobs plug-in|https://wiki.jenkins-ci.org/display/JENKINS/Monitoring+external+jobs] 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: {code} 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> . . {code} The same via Jenkins core produces a NPE: {code} 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) {code} 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): {code} 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) {code} *BUT* the output is correctly saved on Jenkins side into the run though...

    Jenkins JIRA | 1 year ago | Pavel Janoušek
    java.net.SocketTimeoutException: Read timed out
  2. 0

    I've tried to use [Monitoring External Jobs plug-in|https://wiki.jenkins-ci.org/display/JENKINS/Monitoring+external+jobs] 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: {code} 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> . . {code} The same via Jenkins core produces a NPE: {code} 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) {code} 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): {code} 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) {code} *BUT* the output is correctly saved on Jenkins side into the run though...

    Jenkins JIRA | 1 year ago | Pavel Janoušek
    java.net.SocketTimeoutException: Read timed out
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Post method of HTTPUrlConnection leads to SocketTimeoutException, CLOSE_WAIT state for TCP connection

    Stack Overflow | 2 years ago
    java.net.SocketTimeoutException: Read timed out

  1. Bálint Pató 1 times, last 8 months ago
  2. Nikolay Rybak 1 times, last 1 month ago
  3. tvrmsmith 1 times, last 4 months ago
  4. poroszd 3 times, last 5 months ago
  5. aldrinleal 1 times, last 5 months ago
11 more registered users
70 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.net.SocketTimeoutException

    Read timed out

    at java.net.SocketInputStream.socketRead0()
  2. Java RT
    SocketInputStream.read
    1. java.net.SocketInputStream.socketRead0(Native Method)
    2. java.net.SocketInputStream.read(SocketInputStream.java:152)
    3. java.net.SocketInputStream.read(SocketInputStream.java:122)
    3 frames
  3. Java JSSE
    AppInputStream.read
    1. sun.security.ssl.InputRecord.readFully(InputRecord.java:442)
    2. sun.security.ssl.InputRecord.read(InputRecord.java:480)
    3. sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:927)
    4. sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:884)
    5. sun.security.ssl.AppInputStream.read(AppInputStream.java:102)
    5 frames
  4. Java RT
    HttpsURLConnectionImpl.getResponseCode
    1. java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
    2. java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
    3. java.io.BufferedInputStream.read(BufferedInputStream.java:334)
    4. sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
    5. sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:633)
    6. sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1323)
    7. java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
    8. sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
    8 frames
  5. Hudson
    Main.main
    1. hudson.Main.remotePost(Main.java:183)
    2. hudson.Main.run(Main.java:73)
    3. hudson.Main.main(Main.java:55)
    3 frames