amplitude / Amplitude-Android

Native Android SDK for Amplitude
MIT License
164 stars 90 forks source link

Fatal Exception: java.lang.InternalError #355

Open kluverua opened 1 year ago

kluverua commented 1 year ago

In my application, I use Firebase Crashlytics, and it sent me a notification that hundreds of users are experiencing similar errors, which it has identified as 'crashes'.

Expected Behavior

No crashes

Current Behavior

Intermittent crashes on user devices reported by firebase crashlytics

Possible Solution

add catch (InternalError e) at AmplitudeClient.java:2383

Steps to Reproduce

All my information is just a stacktraces:

Case#1

Fatal Exception: java.lang.InternalError: Thread starting during runtime shutdown
       at java.lang.Thread.nativeCreate(Thread.java)
       at java.lang.Thread.start(Thread.java:733)
       at okhttp3.internal.http2.Http2Connection.start(Http2Connection.kt:495)
       at okhttp3.internal.http2.Http2Connection.start$default(Http2Connection.kt:486)
       at okhttp3.internal.connection.RealConnection.startHttp2(RealConnection.kt:330)
       at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.kt:314)
       at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:178)
       at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:236)
       at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:109)
       at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:77)
       at okhttp3.internal.connection.Transmitter.newExchange$okhttp(Transmitter.kt:162)
       at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:35)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
       at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:82)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
       at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:84)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
       at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:71)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
       at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.kt:184)
       at okhttp3.RealCall.execute(RealCall.kt:66)
       at com.amplitude.api.AmplitudeClient.makeEventUploadPostRequest(AmplitudeClient.java:2272)
       at com.amplitude.api.AmplitudeClient$12.run(AmplitudeClient.java:2137)
       at android.os.Handler.handleCallback(:2)
       at android.os.Handler.dispatchMessage(:4)
       at android.os.Looper.loop(:152)
       at android.os.HandlerThread.run(:28)

Case#2

Fatal Exception: java.lang.InternalError: Thread starting during runtime shutdown
       at java.lang.Thread.nativeCreate(Thread.java)
       at java.lang.Thread.start(Thread.java:745)
       at okio.AsyncTimeout$Companion.scheduleTimeout(AsyncTimeout.kt:274)
       at okio.AsyncTimeout$Companion.access$scheduleTimeout(AsyncTimeout.kt:247)
       at okio.AsyncTimeout.enter(AsyncTimeout.kt:56)
       at okhttp3.internal.http2.Http2Stream$FramingSink.emitFrame(Http2Stream.kt:539)
       at okhttp3.internal.http2.Http2Stream$FramingSink.write(Http2Stream.kt:526)
       at okio.ForwardingSink.write(ForwardingSink.kt:29)
       at okhttp3.internal.connection.Exchange$RequestBodySink.write(Exchange.kt:222)
       at okio.RealBufferedSink.close(RealBufferedSink.kt:237)
       at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:60)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
       at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:37)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
       at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:82)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
       at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:84)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
       at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:71)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
       at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
       at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.kt:184)
       at okhttp3.RealCall.execute(RealCall.kt:66)
       at com.amplitude.api.AmplitudeClient.makeEventUploadPostRequest(AmplitudeClient.java:2272)
       at com.amplitude.api.AmplitudeClient$12.run(AmplitudeClient.java:2137)
       at android.os.Handler.handleCallback(Handler.java:761)
       at android.os.Handler.dispatchMessage(Handler.java:98)
       at android.os.Looper.loop(Looper.java:156)
       at android.os.HandlerThread.run(HandlerThread.java:61)

Environment