Skip to content
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

Extra "try" got added in okio library in "okio.AsyncTimeout$Watchdog" #629

Open
vramasam opened this issue Sep 27, 2024 · 0 comments
Open

Comments

@vramasam
Copy link

vramasam commented Sep 27, 2024

Hello @ThexXTURBOXx @pxb1988

Okhttp3 is popular network library in android, that internally depends on okio library

Its been noticed this is the original class of okio library https://github.com/square/okio/blob/master/okio/src/jvmMain/kotlin/okio/AsyncTimeout.kt

In Apk that class looks like

@Override // java.lang.Thread, java.lang.Runnable
        public void run() {
            AsyncTimeout awaitTimeout$okio;
            while (true) {
                try {
                    synchronized (AsyncTimeout.class) {
                        awaitTimeout$okio = AsyncTimeout.INSTANCE.awaitTimeout$okio();
                        if (awaitTimeout$okio == AsyncTimeout.head) {
                            Companion companion = AsyncTimeout.INSTANCE;
                            AsyncTimeout.head = null;
                            return;
                        }
                        Unit unit = Unit.INSTANCE;
                    }
                    if (awaitTimeout$okio != null) {
                        awaitTimeout$okio.timedOut();
                    }
                } catch (InterruptedException unused) {
                    continue;
                }
            }
        }

But after Dex2Jar its added try after synchronized that cause the crash in app:

@Override // java.lang.Thread, java.lang.Runnable
        public void run() {
            AsyncTimeout awaitTimeout$okio;
            while (true) {
                try {
                    synchronized (AsyncTimeout.class) {
                        try {
                            awaitTimeout$okio = AsyncTimeout.Companion.awaitTimeout$okio();
                            if (awaitTimeout$okio == AsyncTimeout.head) {
                                Companion companion = AsyncTimeout.Companion;
                                AsyncTimeout.head = null;
                                return;
                            }
                            Unit unit = Unit.INSTANCE;
                        } finally {
                        }
                    }
                    if (awaitTimeout$okio != null) {
                        awaitTimeout$okio.timedOut();
                    }
                } catch (InterruptedException e) {
                }
            }
        }

can you please check is it possible to check out this issue. I tried out with latest 2.4 SNAPSHOT issue is exist.

Exception detail because of above error:
java.lang.VerifyError: Verifier rejected class okio.AsyncTimeout$Watchdog: void okio.AsyncTimeout$Watchdog.run() failed to verify: void okio.AsyncTimeout$Watchdog.run(): [0x15] expected to be within a catch-all for an instruction where a monitor is held (declaration of 'okio.AsyncTimeout$Watchdog' appears in /data/app/~~24ItOk81KC4e1c_K0I8jqA==/com.manageengine.sdp-mqW5CXPHtXWLtltZ61rpuQ==/base.apk!classes4.dex)
at okio.AsyncTimeout$Companion.scheduleTimeout(Unknown Source:31)
at okio.AsyncTimeout$Companion.access$scheduleTimeout(Unknown Source:0)
at okio.AsyncTimeout.enter(Unknown Source:19)
at okio.AsyncTimeout$sink$1.write(Unknown Source:50)
at okio.RealBufferedSink.flush(Unknown Source:26)
at okhttp3.internal.http1.Http1ExchangeCodec.finishRequest(Unknown Source:2)
at okhttp3.internal.connection.RealConnection.createTunnel(Unknown Source:67)
at okhttp3.internal.connection.RealConnection.connectTunnel(Unknown Source:19)
at okhttp3.internal.connection.RealConnection.connect(Unknown Source:94)
at okhttp3.internal.connection.ExchangeFinder.findConnection(Unknown Source:182)
at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(Unknown Source:1)
at okhttp3.internal.connection.ExchangeFinder.find(Unknown Source:48)
at okhttp3.internal.connection.RealCall.initExchange$okhttp(Unknown Source:32)
at okhttp3.internal.connection.ConnectInterceptor.intercept(Unknown Source:14)
at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:80)
at okhttp3.internal.cache.CacheInterceptor.intercept(Unknown Source:191)
at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:80)
at okhttp3.internal.http.BridgeInterceptor.intercept(Unknown Source:171)
at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:80)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(Unknown Source:35)
at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:80)
at com.manageengine.sdp.rest.SDPHeaderInterceptor.intercept(Unknown Source:339)
at okhttp3.internal.http.RealInterceptorChain.proceed(Unknown Source:80)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(Unknown Source:119)
at okhttp3.internal.connection.RealCall$AsyncCall.run(Unknown Source:34)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant