question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AssertionError at AsyncTimeout.java:101 for some android 4.4.2 and 4.4.4 devices

See original GitHub issue

Hey okhttp. I’ve been confused with this AssertionError error for a while now. It only occurs on some android 4.4.2 and 4.4.4 devices. Have I missed something or could there be a real issue?

I am using okhttp 3.8.1 with retrofit 2.3.0 and dagger 2.11

    @Provides
    @Singleton
    OkHttpClient providesOkHttpClient() {
        OkHttpClient.Builder builder = new OkHttpClient().newBuilder()
                .readTimeout(30L, TimeUnit.SECONDS)
                .connectTimeout(30L, TimeUnit.SECONDS)
                .writeTimeout(30L, TimeUnit.SECONDS)
                .addInterceptor(new NetworkInterceptor());
        return builder.build();
    }

    @Provides
    @Singleton
    Retrofit provideCall(OkHttpClient client) {
        return new Retrofit.Builder()
                .baseUrl(BuildConfig.SERVER_PATH)
                .client(client)
                .addConverterFactory(MoshiConverterFactory.create())
                .addCallAdapterFactory(RxJava2CallAdapterFactory.createAsync())
                .build();
    }

StackTrace

Android: 4.4.2
Thread: OkHttp Dispatcher-729

java.lang.AssertionError
	at okio.AsyncTimeout.scheduleTimeout(AsyncTimeout.java:101)
	at okio.AsyncTimeout.enter(AsyncTimeout.java:80)
	at okio.AsyncTimeout$1.flush(AsyncTimeout.java:193)
	at okio.RealBufferedSink.flush(RealBufferedSink.java:218)
	at okhttp3.internal.http1.Http1Codec.finishRequest(Http1Codec.java:164)
	at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:84)
	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:848)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:14
  • Comments:27 (3 by maintainers)

github_iconTop GitHub Comments

12reactions
lucastsantoscommented, Nov 6, 2017

We at @StudioSol had the exactly same problem. We did a series of tests trying to solve it and we ended up finding out that the problem was in the build process.

We had switched to Gradle 3.1.0-alpha1, which uses D8 compiler instead of DX compiler by default. After switching to DX compiler, the problem is no longer appearing.

A temporarily solution may be using Gradle 3.0.0 or disabling D8 compiler in gradle.properties with:

android.enableD8=false
10reactions
madsagercommented, Mar 6, 2018

We finally managed to reproduce this issue and identified the MediaTek JIT bug in the VM that is causing this. Certain long arithmetic and comparison instructions are incorrectly handled by the JIT. Luckily, we can workaround the issue by forcing the register allocator to avoid certain registers combinations for long operations. We are working on that fix now and will push it out ASAP. When Android Studio 3.1 goes final we expect this fix to be included. Thanks for all of the reports and help tracking this down.

Bug to follow for progress on the fix: https://issuetracker.google.com/issues/70909581

Read more comments on GitHub >

github_iconTop Results From Across the Web

AssertionError at AsyncTimeout.java:101 for some android 4.4.2 and ...
Hey okhttp. I've been confused with this AssertionError error for a while now. It only occurs on some android 4.4.2 and 4.4.4 devices....
Read more >
Android 4.4.2 - java.lang.RuntimeException: Performing stop ...
I'm getting this exception on a 4.4.2 device. Not reproducible on Android 4.3 device or lower. Setup is I have a home activity...
Read more >
Permitted Version Strings for Android 4.4
As described in Section 3.2.2 of the Android 4.4 Compatibility Definition, only certain strings are allowable for the system property ...
Read more >
OkHttp 3.X on Android 4.4.4 - bendb
4 and 4.4.2 - it cannot reliably load the system's default TrustManagers without looping and eventually crashing with an OutOfMemoryError. The ...
Read more >
DevLifeMatter
... for necessarily required but not explicitly used namespaces · ✓ okhttp AssertionError at AsyncTimeout.java:101 for some android 4.4.2 and 4.4.4 devices.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found