java.io.IOException: unexpected end of stream on Connection exception resolution

 <-- HTTP FAILED: java.io.IOException: unexpected end of stream on Connection{public-access.gacicv.com:443, proxy=DIRECT@ hostAddress=public-access.gacicv.com/139.199.92.218:443 cipherSuite=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 protocol=http/1.1}
05-23 10:16:51.955 W/System.err(  992): java.io.IOException: unexpected end of stream on Connection{public-access.gacicv.com:443, proxy=DIRECT@ hostAddress=public-access.gacicv.com/139.199.92.218:443 cipherSuite=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 protocol=http/1.1}
05-23 10:16:51.956 D/GCS_b   (  992): (BridgeInterceptor.java:84)load all of cookie ForRequest
05-23 10:16:51.956 W/System.err(  992):     at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:208)
05-23 10:16:51.957 D/WifiStateMachine(  732): calculateWifiScore freq=5745 speed=156 score=60 highRSSI  -> txbadrate=0.00 txgoodrate=17.56 txretriesrate=0.00 rxrate=57.90 userTriggerdPenalty0
05-23 10:16:51.957 W/System.err(  992):     at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:88)
05-23 10:16:51.957 D/GCS_b   (  992): (b.java:0)cookie Name:IOV_ACCOUNT_SESSIONID : 82cb8693-dd7e-47de-b1f5-a35c1635063d path/
05-23 10:16:51.957 W/System.err(  992):     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
05-23 10:16:51.958 W/System.err(  992):     at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
05-23 10:16:51.958 D/GCS_b   (  992): (b.java:0)cookie Name:usersig : AAAAENMc0emtRSwU5jY6A1ZjgiQ5ZqV3USHxN/pF/slcHtzGcZ183Q+VYloriXNpDcxJ0MMpEfn8p4HmCc4HZRUalXdYAfR+g9binhDXIuN0uDzTn+PUBsjsCGBkXeSnpHF3Pn8B55t7l09OwMwLBZ4mAPJBDofYQy1aWQyWlslquYhT1NLvJYoUxgXOA6AHh9aB6rG1tfnaep6kbRtCHyi29AXzmD45bucMyYOGSIpvrhsQnLKSSkyS8cpXb1E770oZgQN7jPYdE9Vdw79O8u5MyYOlHMEpPq/U6qxOIbMovZVa path/
05-23 10:16:51.958 W/System.err(  992):     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
05-23 10:16:51.958 W/System.err(  992):     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
05-23 10:16:51.958 D/GCS_b   (  992): (b.java:0)cookie Name:userid : 144115205364735127 path/
05-23 10:16:51.959 W/System.err(  992):     at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
05-23 10:16:51.959 W/System.err(  992):     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
05-23 10:16:51.960 W/System.err(  992):     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
05-23 10:16:51.960 D/WifiStateMachine(  732):  good link -> stuck count =0
05-23 10:16:51.960 W/System.err(  992):     at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
05-23 10:16:51.961 W/System.err(  992):     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
05-23 10:16:51.961 W/System.err(  992):     at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
05-23 10:16:51.962 W/System.err(  992):     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
05-23 10:16:51.963 W/System.err(  992):     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
05-23 10:16:51.968 E/_AccountSDK_( 3387): [h](WeCarBaseSDK.java:498):startSDK
05-23 10:16:51.975 W/System.err(  992):     at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:225)
05-23 10:16:51.976 W/System.err(  992):     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
05-23 10:16:51.976 W/System.err(  992):     at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
05-23 10:16:51.976 W/System.err(  992):     at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:254)
05-23 10:16:51.977 W/System.err(  992):     at okhttp3.RealCall$AsyncCall.execute(RealCall.java:200)
05-23 10:16:51.977 W/System.err(  992):     at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
05-23 10:16:51.978 W/System.err(  992):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
05-23 10:16:51.978 W/System.err(  992):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
05-23 10:16:51.978 W/System.err(  992):     at java.lang.Thread.run(Thread.java:818)

The above appears: unexpected end of stream on connection {public access. Gacicv. Com: 443, proxy = direct @ hostaddress = public access. Gacicv. COM / 139.199.92.218:443 ciphersuite = TLS ﹐ ecdhe ﹐ RSA ﹐ AES ﹐ 128 ﹐ GCM ﹐ sha256 protocol = http / 1.1}.

Reason: the client and the server connect through the TCP protocol. After the first request is successful, the client reuses the original connection, but the server is already in the fin? Wait2 state of the TCP connection, so the connection is not successful.

The repair solution, which directly goes to the source code, has changed the absolute solution to the problem:

Set retryOnConnectionFailure() to true, or keep the default setting of okhttpClient (that is, delete this setting, and the default is true)

Tags: Java

Posted on Wed, 06 Nov 2019 11:37:06 -0500 by courtewing