okhttp icon indicating copy to clipboard operation
okhttp copied to clipboard

Android P has more socket timeouts

Open hkachoria opened this issue 6 years ago • 85 comments

OKHttp version - 3.4.2 on Android Some time our client is facing timeout exception.

Server is available, that we verified using some other service. Problem only come for post request, Timeout increased to 200 seconds still problem exists.

We debug on server as well and noticed that request not reaching to server, network connectivity is not issue as some other service with get request works well at same time.

  • As soon as user switch from mobile network to wifi then all well.

Client code - OkHttpClient client = new OkHttpClient.Builder().connectTimeout(200, TimeUnit.SECONDS). readTimeout(200, TimeUnit.SECONDS) .writeTimeout(200, TimeUnit.SECONDS) .followRedirects(true) .followSslRedirects(true) .build();

Exception -

Caused by: java.net.SocketTimeoutException: timeout at okio.Okio$4.newTimeoutException(Okio.java:227) at okio.AsyncTimeout.exit(AsyncTimeout.java:284) at okio.AsyncTimeout$2.read(AsyncTimeout.java:240) at okio.RealBufferedSource.indexOf(RealBufferedSource.java:325) at okio.RealBufferedSource.indexOf(RealBufferedSource.java:314) at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:210) at okhttp3.internal.http.Http1xStream.readResponse(Http1xStream.java:186) at okhttp3.internal.http.Http1xStream.readResponseHeaders(Http1xStream.java:127) at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:53) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170) at okhttp3.RealCall.execute(RealCall.java:60) at com.mexel.prx.util.general.HttpUtils.postInternal(HttpUtils.java:329) ... 8 more Caused by: java.net.SocketException: Socket closed at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:151) at java.net.SocketInputStream.read(SocketInputStream.java:120) at okio.Okio$2.read(Okio.java:138) at okio.AsyncTimeout$2.read(AsyncTimeout.java:236)

hkachoria avatar Apr 19 '18 11:04 hkachoria

same issues , use okhttp 3.7.0

Warpath avatar Apr 26 '18 03:04 Warpath

ok will upgrade and verify

hkachoria avatar Apr 26 '18 16:04 hkachoria

maybe the server problem

philipSZ avatar Apr 27 '18 00:04 philipSZ

as soon as connected to wifi it works, so server is not a issue, it comes randomly however when problem start coming then even after trying 100 times it get timeout but as soon as connectivity changes or mobile reboot then it works. i will try with latest version and check

hkachoria avatar Apr 28 '18 03:04 hkachoria

Even if the server or network is causing issues, this Exception should be handled somewhere and passed to listeners instead of crashing the whole thread. I've seen many people suggest to increase the timeouts as a fix, but it's only a workaround. I want my requests to time out in a reasonable amount of time, but I want to be able to handle the error.

cbruegg avatar May 04 '18 09:05 cbruegg

Stack traces of related timeout errors:

Fatal Exception: java.net.SocketTimeoutException: failed to connect to allaboutsamsung.de/104.28.16.76 (port 443) from /W.X.Y.Z (port 34860) after 10000ms
       at libcore.io.IoBridge.connectErrno(IoBridge.java:185)
       at libcore.io.IoBridge.connect(IoBridge.java:130)
       at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:129)
       at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:356)
       at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
       at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
       at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:356)
       at java.net.Socket.connect(Socket.java:616)
       at okhttp3.internal.platform.AndroidPlatform.connectSocket(AndroidPlatform.java:70)
       at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:238)
       at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:158)
       at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:256)
       at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:134)
       at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:113)
       at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
       at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
       at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
       at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
       at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
       at okhttp3.RealCall$AsyncCall.execute(RealCall.java:147)
       at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
       at java.lang.Thread.run(Thread.java:764)

and

Fatal Exception: java.net.SocketTimeoutException: timeout
       at okhttp3.internal.http2.Http2Stream$StreamTimeout.newTimeoutException(Http2Stream.java:593)
       at okhttp3.internal.http2.Http2Stream$StreamTimeout.exitAndThrowIfTimedOut(Http2Stream.java:601)
       at okhttp3.internal.http2.Http2Stream.takeResponseHeaders(Http2Stream.java:146)
       at okhttp3.internal.http2.Http2Codec.readResponseHeaders(Http2Codec.java:125)
       at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:88)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
       at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
       at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
       at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
       at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
       at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
       at okhttp3.RealCall$AsyncCall.execute(RealCall.java:147)
       at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
       at java.lang.Thread.run(Thread.java:818)

cbruegg avatar May 04 '18 09:05 cbruegg

OkHttp notifies you with an exception on execute() calls, and a callback on enqueue() calls. It doesn't crash the whole thread.

swankjesse avatar May 04 '18 10:05 swankjesse

@swankjesse That's strange. I'm pretty sure I'm catching this type of Exception everywhere and yet I receive crash reports like the ones above. I've spent several hours on making sure I'm handling it everywhere, but maybe I'm still missing a catch somewhere. The stack trace unfortunately makes it hard to tell since I can't see where the request was started.

cbruegg avatar May 04 '18 11:05 cbruegg

These are async calls. You're handling them in onFailure?

swankjesse avatar May 04 '18 12:05 swankjesse

I use OkHttp in two ways: Directly with coroutines and using Retrofit's Deferred-adapter.

Direct usage works like this:

override fun onFailure(call: Call, e: IOException) {
        // Don't bother with resuming the continuation if it is already cancelled.
        if (continuation.isCancelled) return
        continuation.resumeWithException(e)
}

I suppose Retrofit does it similarly. In both ways I then just use try-catch as I would in plain old procedural code, handling any IOException.

Thanks for your help!

cbruegg avatar May 04 '18 13:05 cbruegg

Not sure but is it linked with any static variable declare some where. Because in our case we do have some large file upload in another thread and that gets timeout sometime.

As soon as we switch of net and restart in 5-10 minutes then everything start working fine.

Harish

On Fri, May 4, 2018, 20:36 Yuri Schimke [email protected] wrote:

We should handle this, it's not an IOException

public class SocketTimeoutException extends java.io.InterruptedIOException {

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/square/okhttp/issues/3974#issuecomment-386630482, or mute the thread https://github.com/notifications/unsubscribe-auth/AkvlmEOwvf7PegLWrT5_8TYwMaa_3LxGks5tvG6DgaJpZM4Tbo6O .

hkachoria avatar May 05 '18 05:05 hkachoria

okhttp-3.8.0 same problem:

.onFailure(UploadIntentService.java:72) timeout java.net.SocketTimeoutException: timeout at okio.Okio$3.newTimeoutException(Okio.java:210) at okio.AsyncTimeout.exit(AsyncTimeout.java:277) at okio.AsyncTimeout$2.read(AsyncTimeout.java:244) at okio.RealBufferedSource.indexOf(RealBufferedSource.java:325) at okio.RealBufferedSource.indexOf(RealBufferedSource.java:314) at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:210) at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:189) at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:75) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at java.lang.reflect.Method.invoke(Native Method) at com.android.tools.profiler.support.network.okhttp.reflection.okhttp3.Interceptor$$Chain$.proceed(Interceptor$.java:52) at com.android.tools.profiler.support.network.okhttp.OkHttp3Interceptor.invoke(OkHttp3Interceptor.java:53) at java.lang.reflect.Proxy.invoke(Proxy.java:393) at $Proxy1.intercept(Unknown Source) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185) at okhttp3.RealCall$AsyncCall.execute(RealCall.java:135) at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818)

louiewh avatar May 17 '18 07:05 louiewh

the same in 3.10.0

lizhangqu avatar Jun 10 '18 08:06 lizhangqu

@swankjesse This is the Socket Timeout Error which in my monitor data. It happend about 200000+/day. Some time it will reach to 500000+/day. I'm sure the server may don't have any problem. It always happend with HTTP/1.1 And HTTP/2.0

data

lizhangqu avatar Jun 10 '18 08:06 lizhangqu

@swankjesse okhttp 3.10.0 Hello, I find two problems here. It looks like problem 1 caused by problem 2. This is the Socket Timeout Error which in my monitor data. It happend about 400000. I hope to receive your feedback thanks! Bug 1: at okio.Okio$4.newTimeoutException(Okio.java:232) at okio.AsyncTimeout.exit(AsyncTimeout.java:285) at okio.AsyncTimeout$2.read(AsyncTimeout.java:241) at okio.RealBufferedSource.read(RealBufferedSource.java:47) at okhttp3.internal.http1.Http1Codec$AbstractSource.read(Http1Codec.java:363) at okhttp3.internal.http1.Http1Codec$UnknownLengthSource.read(Http1Codec.java:507) at okio.Buffer.writeAll(Buffer.java:1053) at okio.RealBufferedSource.readString(RealBufferedSource.java:200) at okhttp3.ResponseBody.string(ResponseBody.java:175) at com.jd.JDResponse.(JDResponse.java:33) at com.jd..net.core.HttpCore$2.onResponse(HttpCore.java:188) at okhttp3.RealCall$AsyncCall.execute(RealCall.java:153) at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764) Caused by: java.net.SocketException: Socket closed at java.net.SocketInputStream.read(SocketInputStream.java:203) at java.net.SocketInputStream.read(SocketInputStream.java:139) at okio.Okio$2.read(Okio.java:140) at okio.AsyncTimeout$2.read(AsyncTimeout.java:237) ... 13 more

Bug 2: okio.RealBufferedSource.rangeEquals (RealBufferedSource.java:377) okio.RealBufferedSource.rangeEquals (RealBufferedSource.java:371) okhttp3.internal.Util.bomAwareCharset (Util.java:397) okhttp3.ResponseBody.string (ResponseBody.java:173) com.jd.JDResponse. (JDResponse.java:23) com.jd.net.core.HttpCore$2.onResponse (HttpCore.java:175) okhttp3.RealCall$AsyncCall.execute (RealCall.java:135) okhttp3.internal.NamedRunnable.run (NamedRunnable.java:32) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1112) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:587) java.lang.Thread.run (Thread.java:818)

7280423 avatar Jun 11 '18 13:06 7280423

That's great I hope team will be able to fix this quick

Regards Harish

On Mon, Jun 11, 2018, 18:33 jacky_z [email protected] wrote:

@swankjesse https://github.com/swankjesse okhttp 3.10.0 Hello, I find two problems here. It looks like problem 1 caused by problem 2. This is the Socket Timeout Error which in my monitor data. It happend about 400000. I hope to receive your feedback thanks! Bug 1: at okio.Okio$4.newTimeoutException(Okio.java:232) at okio.AsyncTimeout.exit(AsyncTimeout.java:285) at okio.AsyncTimeout$2.read(AsyncTimeout.java:241) at okio.RealBufferedSource.read(RealBufferedSource.java:47) at okhttp3.internal.http1.Http1Codec$AbstractSource.read(Http1Codec.java:363) at okhttp3.internal.http1.Http1Codec$UnknownLengthSource.read(Http1Codec.java:507) at okio.Buffer.writeAll(Buffer.java:1053) at okio.RealBufferedSource.readString(RealBufferedSource.java:200) at okhttp3.ResponseBody.string(ResponseBody.java:175) at com.jd.JDResponse.(JDResponse.java:33) at com.jd..net.core.HttpCore$2.onResponse(HttpCore.java:188) at okhttp3.RealCall$AsyncCall.execute(RealCall.java:153) at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764) Caused by: java.net.SocketException: Socket closed at java.net.SocketInputStream.read(SocketInputStream.java:203) at java.net.SocketInputStream.read(SocketInputStream.java:139) at okio.Okio$2.read(Okio.java:140) at okio.AsyncTimeout$2.read(AsyncTimeout.java:237) ... 13 more

Bug 2: okio.RealBufferedSource.rangeEquals (RealBufferedSource.java:377) okio.RealBufferedSource.rangeEquals (RealBufferedSource.java:371) okhttp3.internal.Util.bomAwareCharset (Util.java:397) okhttp3.ResponseBody.string (ResponseBody.java:173) com.jd.JDResponse. (JDResponse.java:23) com.jd.net.core.HttpCore$2.onResponse (HttpCore.java:175) okhttp3.RealCall$AsyncCall.execute (RealCall.java:135) okhttp3.internal.NamedRunnable.run (NamedRunnable.java:32) java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1112) java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:587) java.lang.Thread.run (Thread.java:818)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/square/okhttp/issues/3974#issuecomment-396235227, or mute the thread https://github.com/notifications/unsubscribe-auth/AkvlmOQBeOIDKNYS6kWALJ3cNYNpiR30ks5t7mqvgaJpZM4Tbo6O .

hkachoria avatar Jun 11 '18 14:06 hkachoria

I have same issue only on Android 7 & 8 okhttp 3.10.0. After wifi restart or connect to the mobile data problem is resolved by itself.

askarsyzdykov avatar Jun 13 '18 16:06 askarsyzdykov

same issue

gulzatique avatar Jun 18 '18 04:06 gulzatique

sounds similar to my issue: I often see timeout errors after unlocking my screen.

if I have my app open, turn off the screen, stick phone in pocket for a couple of minutes, take phone out of pocket and turn on screen, my app triggers a couple of net requests during onResume, I then often but not always see a few timeouts.

steelbytes avatar Jun 19 '18 08:06 steelbytes

FYI @swankjesse: https://stackoverflow.com/questions/41439830/android-7-1-1-nougat-app-standby-and-network

askarsyzdykov avatar Jun 19 '18 08:06 askarsyzdykov

Any update or workaround solution available for this issue?

putuyuwono avatar Jun 20 '18 07:06 putuyuwono

My server uses nginx 1.10.0 and supports HTTP2. I disabled HTTP2 in OkHttp and for now app is working. I'm not sure but maybe it is solution for me: okHttpBuilder.protocols(Collections.singletonList(Protocol.HTTP_1_1));

@putuyuwono @steelbytes @hkachoria @7280423 @lizhangqu @cbruegg @Warpath
which nginx version do you use? Maybe related to https://github.com/square/okhttp/issues/2543

askarsyzdykov avatar Jun 21 '18 11:06 askarsyzdykov

@askarsyzdykov both HTTP/1.1 and HTTP/2.0 have this problem. I have do an A/B Test for this. the timeout exception don't seem to change.

lizhangqu avatar Jun 21 '18 12:06 lizhangqu

I met the same problem : java.net. SocketTimeoutException, version:3.9.1

Microhx avatar Jun 26 '18 02:06 Microhx

I'm having this problem too.. When I switch networks (cellular to WIFI) it works for a while (sometimes some minutes, sometimes for hours) then starts giving the TimeoutException.. Also if I open Chrome and make the GET request I get the answer immediately without problem but if I switch back to my app using OkHttp I keep getting timeouts...

xradeon avatar Jun 26 '18 15:06 xradeon

I have a similar error. Restarting a device fixes the problem. It usually happens when I execute multi-threaded downloads.

java.net.SocketTimeoutException: timeout com.android ettimeoutexception: timeoutcom.android.okhttp.okio.Okio$3.newTimeoutException(Okio.java:221) com.android.okhttp.okio.AsyncTimeout.exit(AsyncTimeout.java:261) com.android. .okhttp.okio.AsyncTimeout$2.read(AsyncTimeout.java:215) com.android.okhttp.okio.RealBufferedSource.read(RealBufferedSource.java:60) com.android.okhttp.internal.http.HttpConnection$FixedLengthSource.read(HttpConnection.java:466) com.android.okhttp.okio.RealBufferedSource$1.read(RealBufferedSource.java:396)

AndroidPat avatar Jun 27 '18 09:06 AndroidPat

I've found a way to reproduce this, though I'm not entirely sure that this is what our customers are hitting. I've been able to trigger this on Android 7.1.2, and Android P r3 using these steps:

https://developer.android.com/training/monitoring-device-state/doze-standby

adb shell dumpsys deviceidle force-idle This puts your device into deep sleep / Doze mode. Network access is limited in this condition.

adb shell dumpsys deviceidle unforce This wakes your device up, and network access is no longer expected to be limited.

Launch your app now, and I get the socket timeouts. I would point out that this doesn't seem to be 100% of how to reproduce this, as I couldn't get this to work across all my test devices.

Interestingly, we do check with the ConnectivityManager to ensure we have a network available before issuing the call, so it does think there is something available. I checked with a debugger, and while debugging I could never reproduce it, but the connectivity manager always reported an active connection to my wifi.

On a Samsung running android 8.0.0 I was unable to reproduce this using these steps atll. Even if I never issue the unforce command things work. I do see users hitting this on Android 8.0 though. I also tried setting my app inactive on Android 8 with no luck.

inktomi avatar Jun 27 '18 22:06 inktomi

@inktomi I reproduce the problem in your way.

lizhangqu avatar Jun 29 '18 08:06 lizhangqu

Workaround

Configure the app’s battery settings to be “not optimized”. (source)

swankjesse avatar Jul 05 '18 01:07 swankjesse

Definatelly an issue here. I came to similar conclusions as @inktomi , before I even found this thread.

c0dehunter avatar Jul 25 '18 18:07 c0dehunter