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

fix: network connection error handling #4

Merged
merged 2 commits into from
Jan 17, 2023
Merged

fix: network connection error handling #4

merged 2 commits into from
Jan 17, 2023

Conversation

marcmrf
Copy link
Contributor

@marcmrf marcmrf commented Jan 17, 2023

Prisa is reporting a huge increase realeted with our sdk, with the following stack trace

Fatal Exception: java.net.SocketTimeoutException: timeout
       at okhttp3.internal.http2.Http2Stream$StreamTimeout.newTimeoutException(Http2Stream.java:675)
       at okhttp3.internal.http2.Http2Stream$StreamTimeout.exitAndThrowIfTimedOut(Http2Stream.java:684)
       at okhttp3.internal.http2.Http2Stream.takeHeaders(Http2Stream.java:143)
       at okhttp3.internal.http2.Http2ExchangeCodec.readResponseHeaders(Http2ExchangeCodec.java:96)
       at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.java:106)
       at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:79)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:109)
       at com.marfeel.compass.di.CompassComponent$apiClient$2$invoke$$inlined$-addNetworkInterceptor$1.intercept(CompassComponent.java:1080)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:109)
       at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:34)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:109)
       at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:95)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:109)
       at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:83)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:109)
       at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:76)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:109)
       at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:221)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:109)
       at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.java:201)
       at okhttp3.internal.connection.RealCall.execute(RealCall.java:154)
       at com.google.firebase.perf.network.FirebasePerfOkHttpClient.execute(FirebasePerfOkHttpClient.java:43)
       at com.marfeel.compass.network.ApiClient.ping(ApiClient.java:35)
       at com.marfeel.compass.usecase.Ping.invoke(Ping.java:42)
       at com.marfeel.compass.core.PingEmitter.ping(PingEmitter.java:48)
       at com.marfeel.compass.core.PingEmitter.access$ping(PingEmitter.java:9)
       at com.marfeel.compass.core.PingEmitter$start$1$1.invokeSuspend(PingEmitter.java:39)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(BaseContinuationImpl.java:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.java:106)
       at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.java:42)
       at kotlinx.coroutines.scheduling.TaskImpl.run(TaskImpl.java:95)
       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.java:570)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.java:750)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.java:677)
       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.java:664)

It looks like the library doesn't deal properly with connection errors reusing http2 connections, square/okhttp#3146.

Forcing http/1 and handling the error so it doesn't affect client app.

@marcmrf marcmrf merged commit 01c2cbc into develop Jan 17, 2023
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

Successfully merging this pull request may close these issues.

2 participants