第一次尝试使用我们的APK。它开始很好,但失败了 连接到我们的后端服务器:
SocketException:setsockopt failed:EINVAL(无效参数)
目前的Chrome和ARC已下载2015-04-07。
Stack Trace显示尝试设置不支持的KeepAlive套接字选项失败(对于该指针而言)。
将SocketConfig socket = SocketConfig.custom().setSoKeepAlive(false).build();
添加到HttpClient无济于事,因为HttpClientConnectionOperator
始终会调用sock.setKeepAlive(socketConfig.isSoKeepAlive());
并且在我看来,即使使用false
调用,调用也会崩溃。
谢谢,干杯,汤姆。
I/HttpClient( 204): I/O exception (java.net.SocketException) caught when processing request to HttpRoute[{s}->https://xxx.xxx.xxx:443]: setsockopt failed: EINVAL (Invalid argument)
I/HttpClient( 204): Retrying request to HttpRoute[{s}->https://xxx.xxx.xxx:443]
shell.js:141 I/libposix_translation_static( 204): TCPSocket::Bind: [::0.0.0.0]:0
shell.js:141 I/libposix_translation_static( 204): TCPSocket::connect: [xxx]:443
shell.js:141 E/PortalHttpClient( 204): Failed http request: POST https://xxx.xxx.xxx:443/if/xxx HTTP/1.1
E/PortalHttpClient( 204): java.net.SocketException: setsockopt failed: EINVAL (Invalid argument)
E/PortalHttpClient( 204): at libcore.io.IoBridge.setSocketOption(IoBridge.java:306)
E/PortalHttpClient( 204): at java.net.PlainSocketImpl.setOption(PlainSocketImpl.java:289)
E/PortalHttpClient( 204): at java.net.Socket.setKeepAlive(Socket.java:453)
E/PortalHttpClient( 204): at com.android.org.conscrypt.OpenSSLSocketImplWrapper.setKeepAlive(OpenSSLSocketImplWrapper.java:100)
E/PortalHttpClient( 204): at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:134)
E/PortalHttpClient( 204): at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:314)
E/PortalHttpClient( 204): at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:373)
E/PortalHttpClient( 204): at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:225)
E/PortalHttpClient( 204): at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
E/PortalHttpClient( 204): at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
E/PortalHttpClient( 204): at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
E/PortalHttpClient( 204): at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186)
E/PortalHttpClient( 204): at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
E/PortalHttpClient( 204): at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
E/PortalHttpClient( 204): at xxx.xxx.PortalHttpClient.execute(PortalHttpClient.java:134)
E/PortalHttpClient( 204): at xxx.xxx.PortalHttpClient.executeWithRetry(PortalHttpClient.java:107)
E/PortalHttpClient( 204): at xxx.xxx.PortalHttpClient.post(PortalHttpClient.java:78)
E/PortalHttpClient( 204): at xxx.xxx.HttpServerCommunication.pairDevice(HttpServerCommunication.java:100)
E/PortalHttpClient( 204): at xxx.xxx.ServerCommunicationSwitch.pairDevice(ServerCommunicationSwitch.java:51)
E/PortalHttpClient( 204): at xxx.xxx.xxx.app.base.XxxAsyncTask.doInBackground(XxxAsyncTask.java:53)
E/PortalHttpClient( 204): at android.os.AsyncTask$4.call(AsyncTask.java:372)
E/PortalHttpClient( 204): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E/PortalHttpClient( 204): at android.os.AsyncTask$SerialExecutor$2.run(AsyncTask.java:280)
E/PortalHttpClient( 204): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/PortalHttpClient( 204): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/PortalHttpClient( 204): at java.lang.Thread.run(Thread.java:841)
E/PortalHttpClient( 204): Caused by: libcore.io.ErrnoException: setsockopt failed: EINVAL (Invalid argument)
E/PortalHttpClient( 204): at libcore.io.Posix.setsockoptInt(Native Method)
E/PortalHttpClient( 204): at libcore.io.ForwardingOs.setsockoptInt(ForwardingOs.java:122)
E/PortalHttpClient( 204): at libcore.io.IoBridge.setSocketOptionErrno(IoBridge.java:338)
E/PortalHttpClient( 204): at libcore.io.IoBridge.setSocketOption(IoBridge.java:304)
E/PortalHttpClient( 204): ... 28 more
W/PortalHttpClient( 204): xxx.xxx.comm.common.CommunicationException: HOST_NOT_AVAILABLE[recoverable]: java.net.SocketException: setsockopt failed: EINVAL (Invalid argument) - will retry in 10s
答案 0 :(得分:0)
这里有两个问题:
隐含地,您正在询问基于错误的setsockopt支持。是的,ARC支持setsockopt调用的子集。您可以在我们的开源代码库中看到我们的posix转换层以及支持的标志:https://chromium.googlesource.com/arc/arc/+/release-41.4410.244.0/src/posix_translation/socket_stream.cc#98(这适用于当前的ARC 41版本)。不幸的是,根据您的callstack,您正在尝试设置SO_KEEPALIVE,这当前不受支持。如果您想加注它,这是一个跟踪问题,但不太可能很快实现:https://code.google.com/p/chromium/issues/detail?id=384940
关于HTTPS / SSL,我们已经从外部获得了一些关于此的报告,但这些报告大多都含糊不清。一些SSL确实有效,因此不清楚为什么有些人遇到问题。如果您可以创建一个带有源代码的小型复制APK,以突出显示HTTPS / SSL的问题,您可以file a bug来帮助隔离它。