我正在使用MF 6.3开发混合应用程序。我在通过请求数据时遇到了Java套接字超时问题 适配器。这不一致。它发生3-4 / 10次。我也有 看到github中提到的同一个问题 https://github.com/google/google-http-java-client/issues/146但是 没有决议。
我使用60秒的适配器超时,并且在10秒内发生此异常。
附加日志的logcat。
09-18 15:07:29.561:I / System.out(10667):pool-6-thread-2次调用 detatch()
09-18 15:07:39.146:I / System.out(10667):pool-6-thread-5个调用 detatch()
09-18 15:07:39.166: E / com.worklight.androidgap.plugin.WLNativeXHRPlugin(10667): WLNativeXHRPlugin $ NativeXHRPostListener.onException in WLNativeXHRPlugin.java:154 :: onException
09-18 15:07:39.166: E / com.worklight.androidgap.plugin.WLNativeXHRPlugin(10667): java.net.SocketTimeoutException:读取超时
09-18 15:07:39.166: E / com.worklight.androidgap.plugin.WLNativeXHRPlugin(10667):at com.android.org.conscrypt.NativeCrypto.SSL_read(原生方法)
09-18 15:07:39.166: E / com.worklight.androidgap.plugin.WLNativeXHRPlugin(10667):at com.android.org.conscrypt.OpenSSLSocketImpl $ SSLInputStream.read(OpenSSLSocketImpl.java:728)
09-18 15:07:39.166: E / com.worklight.androidgap.plugin.WLNativeXHRPlugin(10667):at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:103)
09-18 15:07:39.166: E / com.worklight.androidgap.plugin.WLNativeXHRPlugin(10667):at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:191)
09-18 15:07:39.166: E / com.worklight.androidgap.plugin.WLNativeXHRPlugin(10667):at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:82)
09-18 15:07:39.166: E / com.worklight.androidgap.plugin.WLNativeXHRPlugin(10667):at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:174)
09-18 15:07:39.166: E / com.worklight.androidgap.plugin.WLNativeXHRPlugin(10667):at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:180)
09-18 15:07:39.166: E / com.worklight.androidgap.plugin.WLNativeXHRPlugin(10667):at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:235)
09-18 15:07:39.166: E / com.worklight.androidgap.plugin.WLNativeXHRPlugin(10667):at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:259)
09-18 15:07:39.166: E / com.worklight.androidgap.plugin.WLNativeXHRPlugin(10667):at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:279)
09-18 15:07:39.166: E / com.worklight.androidgap.plugin.WLNativeXHRPlugin(10667):at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:121)
09-18 15:07:39.166: E / com.worklight.androidgap.plugin.WLNativeXHRPlugin(10667):at org.apache.http.impl.client.DefaultRequestDirector.executeOriginal(DefaultRequestDirector.java:1351)
09-18 15:07:39.166: E / com.worklight.androidgap.plugin.WLNativeXHRPlugin(10667):at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:700)
09-18 15:07:39.166: E / com.worklight.androidgap.plugin.WLNativeXHRPlugin(10667):at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:691)
09-18 15:07:39.166: E / com.worklight.androidgap.plugin.WLNativeXHRPlugin(10667):at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:514)
09-18 15:07:39.166: E / com.worklight.androidgap.plugin.WLNativeXHRPlugin(10667):at com.worklight.wlclient.WLHybridRequestSender.run(WLHybridRequestSender.java:63)
09-18 15:07:39.166: E / com.worklight.androidgap.plugin.WLNativeXHRPlugin(10667):at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
09-18 15:07:39.166: E / com.worklight.androidgap.plugin.WLNativeXHRPlugin(10667):at java.util.concurrent.ThreadPoolExecutor中$ Worker.run(ThreadPoolExecutor.java:587)
09-18 15:07:39.166: E / com.worklight.androidgap.plugin.WLNativeXHRPlugin(10667):at java.lang.Thread.run(Thread.java:818)
09-18 15:07:39.176:E / NONE(10667): [/ apps / services / api / SCBBizNet / android / query]主机没有响应。 尝试通过android模拟器浏览器手动访问URL 验证连接性。
答案 0 :(得分:1)
解决!
我们正在调用WL.Logger.send()
来发送$.getJson
内的日志,这些日志会根据我们向服务器发送日志来加载配置json文件。在此步骤之后,我们退出$.getJson
回调并调用适配器以加载包含数据的页面。整个事件发生在点击按钮上。如果我们删除$.getJson
并调用WL.Logger.send()
,则不会给出任何Socket超时异常。
然而,这个问题似乎很不寻常,因为在WL.Logger.send()
内调用$.getJson
并且随后的适配器调用在10次中失败5-6次,给出超出适配器层的套接字超时异常。这个例外在Android中更常见,在iOS中更少。我们正在进一步调查由$.getJson
引起的问题。将发布更新。