java.net.SocketTimeoutException

Appcelerator JIRA | Michael G | 1 year ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Being on 2G my http request will timeout and bringing up the following error message: {code:java} (TiHttpClient-3) [96625,96625] HTTP Error (java.net.SocketTimeoutException): java.net.SocketTimeoutException java.net.SocketTimeoutException at java.net.PlainSocketImpl.read(PlainSocketImpl.java:484) at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:37) at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:237) at com.android.okhttp.okio.Okio$2.read(Okio.java:135) at com.android.okhttp.okio.AsyncTimeout$2.read(AsyncTimeout.java:211) at com.android.okhttp.okio.RealBufferedSource.indexOf(RealBufferedSource.java:306) at com.android.okhttp.okio.RealBufferedSource.indexOf(RealBufferedSource.java:300) at com.android.okhttp.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:196) at com.android.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:191) at com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:80) at com.android.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:904) at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:788) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:463) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:408) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getHeaders(HttpURLConnectionImpl.java:170) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getHeaderField(HttpURLConnectionImpl.java:212) at java.net.URLConnection.getHeaderFieldInt(URLConnection.java:543) at java.net.URLConnection.getContentLength(URLConnection.java:315) at ti.modules.titanium.network.TiHTTPClient.handleResponse(TiHTTPClient.java:159) at ti.modules.titanium.network.TiHTTPClient.access$1200(TiHTTPClient.java:85) at ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1207) at java.lang.Thread.run(Thread.java:818) java.lang.NullPointerException: Attempt to invoke interface method 'boolean java.util.Map.isEmpty()' on a null object reference at ti.modules.titanium.network.TiHTTPClient.getAllResponseHeaders(TiHTTPClient.java:615) at ti.modules.titanium.network.HTTPClientProxy.getAllResponseHeaders(HTTPClientProxy.java:99) at org.appcelerator.kroll.runtime.v8.V8Object.nativeCallProperty(Native Method) at org.appcelerator.kroll.runtime.v8.V8Object.callProperty(V8Object.java:73) at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1155) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:168) at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:118) E/TiExceptionHandler(7403): (main) [59,96684] ----- Titanium Javascript Runtime Error ----- E/TiExceptionHandler(7403): (main) [0,96684] - In ti:/console.js:25,62 E/TiExceptionHandler(7403): (main) [0,96684] - Message: Uncaught Error: Attempt to invoke interface method 'boolean java.util.Map.isEmpty()' on a null object reference E/TiExceptionHandler(7403): (main) [1,96685] - Source: ( arg.hasOwnProperty('toString') ? arg.toString() : JSON.stringify(arg) ) {code} The problem is here: https://github.com/appcelerator/titanium_mobile/blob/dcd73f54156cdd0a9f40ae9a2339ccb68e8c216e/android/modules/network/src/java/ti/modules/titanium/network/TiHTTPClient.java#L615 responseHeaders is null so isEmpty() can't be called Test code: {code:java} var url = "http://my.server.com"; var client = Ti.Network.createHTTPClient({ onload : function(e) { Ti.API.info("Received text: " + this.responseText); alert('success'); }, onerror : function(e) { Ti.API.debug(e.error); alert('error'); }, timeout : 5000 }); client.open("GET", url); client.send(); {code} I've changed to 2G and went into a room with bad reception to force the timeout

    Appcelerator JIRA | 1 year ago | Michael G
    java.net.SocketTimeoutException
  2. 0

    Being on 2G my http request will timeout and bringing up the following error message: {code:java} (TiHttpClient-3) [96625,96625] HTTP Error (java.net.SocketTimeoutException): java.net.SocketTimeoutException java.net.SocketTimeoutException at java.net.PlainSocketImpl.read(PlainSocketImpl.java:484) at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:37) at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:237) at com.android.okhttp.okio.Okio$2.read(Okio.java:135) at com.android.okhttp.okio.AsyncTimeout$2.read(AsyncTimeout.java:211) at com.android.okhttp.okio.RealBufferedSource.indexOf(RealBufferedSource.java:306) at com.android.okhttp.okio.RealBufferedSource.indexOf(RealBufferedSource.java:300) at com.android.okhttp.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:196) at com.android.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:191) at com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:80) at com.android.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:904) at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:788) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:463) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:408) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getHeaders(HttpURLConnectionImpl.java:170) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getHeaderField(HttpURLConnectionImpl.java:212) at java.net.URLConnection.getHeaderFieldInt(URLConnection.java:543) at java.net.URLConnection.getContentLength(URLConnection.java:315) at ti.modules.titanium.network.TiHTTPClient.handleResponse(TiHTTPClient.java:159) at ti.modules.titanium.network.TiHTTPClient.access$1200(TiHTTPClient.java:85) at ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1207) at java.lang.Thread.run(Thread.java:818) java.lang.NullPointerException: Attempt to invoke interface method 'boolean java.util.Map.isEmpty()' on a null object reference at ti.modules.titanium.network.TiHTTPClient.getAllResponseHeaders(TiHTTPClient.java:615) at ti.modules.titanium.network.HTTPClientProxy.getAllResponseHeaders(HTTPClientProxy.java:99) at org.appcelerator.kroll.runtime.v8.V8Object.nativeCallProperty(Native Method) at org.appcelerator.kroll.runtime.v8.V8Object.callProperty(V8Object.java:73) at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1155) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:168) at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:118) E/TiExceptionHandler(7403): (main) [59,96684] ----- Titanium Javascript Runtime Error ----- E/TiExceptionHandler(7403): (main) [0,96684] - In ti:/console.js:25,62 E/TiExceptionHandler(7403): (main) [0,96684] - Message: Uncaught Error: Attempt to invoke interface method 'boolean java.util.Map.isEmpty()' on a null object reference E/TiExceptionHandler(7403): (main) [1,96685] - Source: ( arg.hasOwnProperty('toString') ? arg.toString() : JSON.stringify(arg) ) {code} The problem is here: https://github.com/appcelerator/titanium_mobile/blob/dcd73f54156cdd0a9f40ae9a2339ccb68e8c216e/android/modules/network/src/java/ti/modules/titanium/network/TiHTTPClient.java#L615 responseHeaders is null so isEmpty() can't be called Test code: {code:java} var url = "http://my.server.com"; var client = Ti.Network.createHTTPClient({ onload : function(e) { Ti.API.info("Received text: " + this.responseText); alert('success'); }, onerror : function(e) { Ti.API.debug(e.error); alert('error'); }, timeout : 5000 }); client.open("GET", url); client.send(); {code} I've changed to 2G and went into a room with bad reception to force the timeout

    Appcelerator JIRA | 1 year ago | Michael G
    java.net.SocketTimeoutException
  3. 0

    How to get track the streaming error JwPlayer Android

    Stack Overflow | 2 months ago | Cecil Paul
    com.google.android.exoplayer.ExoPlaybackException: com.google.android.exoplayer.upstream.HttpDataSource$HttpDataSourceException: Unable to connect to sample_link.ts
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    How to get Error Response JW Player

    Stack Overflow | 2 months ago | Cecil Paul
    com.google.android.exoplayer.ExoPlaybackException: com.google.android.exoplayer.upstream.HttpDataSource$HttpDataSourceException: Unable to connect to http://localhost:8080/media-uvr9739qf_b2000000_slEnglish_25840.ts
  6. 0

    GitHub comment 1414#243680776

    GitHub | 7 months ago | HanzhiDou
    java.net.SocketTimeoutException: timeout
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

    No message provided

    at java.net.PlainSocketImpl.read()
  2. Java RT
    PlainSocketImpl$PlainSocketInputStream.read
    1. java.net.PlainSocketImpl.read(PlainSocketImpl.java:484)
    2. java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:37)
    3. java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:237)
    3 frames
  3. com.android.okhttp
    RealBufferedSource.readUtf8LineStrict
    1. com.android.okhttp.okio.Okio$2.read(Okio.java:135)
    2. com.android.okhttp.okio.AsyncTimeout$2.read(AsyncTimeout.java:211)
    3. com.android.okhttp.okio.RealBufferedSource.indexOf(RealBufferedSource.java:306)
    4. com.android.okhttp.okio.RealBufferedSource.indexOf(RealBufferedSource.java:300)
    5. com.android.okhttp.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:196)
    5 frames
  4. Android
    HttpEngine.readResponse
    1. com.android.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:191)
    2. com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:80)
    3. com.android.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:904)
    4. com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:788)
    4 frames
  5. com.android.okhttp
    HttpURLConnectionImpl.getHeaderField
    1. com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:463)
    2. com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:408)
    3. com.android.okhttp.internal.huc.HttpURLConnectionImpl.getHeaders(HttpURLConnectionImpl.java:170)
    4. com.android.okhttp.internal.huc.HttpURLConnectionImpl.getHeaderField(HttpURLConnectionImpl.java:212)
    4 frames
  6. Java RT
    URLConnection.getContentLength
    1. java.net.URLConnection.getHeaderFieldInt(URLConnection.java:543)
    2. java.net.URLConnection.getContentLength(URLConnection.java:315)
    2 frames
  7. ti.modules.titanium
    TiHTTPClient$ClientRunnable.run
    1. ti.modules.titanium.network.TiHTTPClient.handleResponse(TiHTTPClient.java:159)
    2. ti.modules.titanium.network.TiHTTPClient.access$1200(TiHTTPClient.java:85)
    3. ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1207)
    3 frames
  8. Java RT
    Thread.run
    1. java.lang.Thread.run(Thread.java:818)
    1 frame