-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Couldn't do get request after turning off internet #6853
Comments
Thanks for the great reproduction. Was able to reproduce with 5.0.0-alpha2, but couldn't on 4.9.1. To unblock you, I'd suggest building against 4.9.1 until we fix this issue. |
@swankjesse I'm still taking a look, but most likely candidate is 9533117 |
If it fails writing the request headers
Then we try to read after the exception, but are in STATE_IDLE
We could either a) Not try to read response headers if we haven't successfully written the request headers, so we only attempt to read the response headers if sending the body fails. |
Quick attempt at a reproduction on JDK didn't work, I suspect I'm not faithfully reproducing the actual observable behaviour on Android after a network disconnection (airplane mode etc). No luck making a reproducing test yet. |
Of the two options I think |
Closing as a likely dupe of #3278 |
The same problem happens sporadically on my system after making a couple of changes, including an update of okhttp from 4.10.0 to 4.11.0. Here is my stacktrace:
|
Will take a look again. |
Timing of #7453 jives with a regression between 4.10 and 4.11. But that doesn't link in with the original bug report, so I suspect two bugs. One existing, and one in 4.11. But I tried the repro at the top and the content has changed, even swallowing 404, I don't think we get the same observable behaviour. Servers returning an early response must be a factor... So no repro, but I'll test a few more things. |
@kate-fin are you able to repro still? |
We have started experiencing the same crash after updating OkHttp 4.10.0 -> 4.12.0:
|
I am getting the same error, but only when the fullMode is enabled. I am using |
I tried to reproduce without success. Not sure if AGP, R8 or a bug/race condition in OkHttp. Without a repro, it's hard to take further. |
Interestingly 4.10 to 4.12 does change this code to allow reading response headers early |
I also got a single report of this crash for my app (so fairly rare) using v4.12. |
Facing the same issue and the trace is identical for the crash, any update on this? |
Hello.
I do POST request for getting token, next do GET request to get data. I turn off my internet connection, after that turn on it and do GET request again.
Link to the project: https://github.com/kate-fin/OkHttpDoesntWorkApplication.git
You just need click the button, turn off internet, turn it on and click button again
Log of error:
E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
Process: com.example.okhttpdoesntworkapplication, PID: 30701
java.lang.IllegalStateException: state: 0
at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.kt:173)
at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.kt:110)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.kt:222)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
D/OOMEventManagerFK: checkEventAndDumpForJE: 0
I/Process: Sending signal. PID: 30701 SIG: 9
You could answer me to [email protected]
Thank you.
The text was updated successfully, but these errors were encountered: