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

Crash caused by java.lang.UnsupportedOperationException: at com.google.protobuf.AbstractProtobufList.ensureIsMutable(AbstractProtobufList.java:161) #6625

Open
tolulonge opened this issue Jan 15, 2025 · 7 comments
Labels
api: performance type: bug Something isn't working

Comments

@tolulonge
Copy link

Step 2: Describe your environment

  • Android Studio version: Android Studio Ladybug Feature Drop | 2024.2.2
  • Firebase Component: Firebase performance
  • Component version: Firebase BOM 33.7.0

Step 3: Describe the problem

Stack trace from firebase crashlytics:

Fatal Exception: kotlinx.coroutines.CompletionHandlerException: Exception in invokeOnCancellation handler for 
CancellableContinuation(DispatchedContinuation[Dispatchers.Default.limitedParallelism(1), Continuation at 
com.usercentrics.sdk.domain.api.http.HttpRequestsImpl$getSync2$2.invokeSuspend(HttpRequestsImpl.kt:83)@a62131a]). 
{Cancelled}@db03e4b
   at kotlinx.coroutines.CompletionHandlerException.<init>(CompletionHandlerException.java:9)
   at kotlinx.coroutines.CancellableContinuationImpl.callCancelHandler(CancellableContinuationImpl.kt:711)
   at kotlinx.coroutines.CancellableContinuationImpl.cancel(CancellableContinuationImpl.kt:209)
   at kotlinx.coroutines.CancellableContinuationImpl.parentCancelled$kotlinx_coroutines_core(CancellableContinuationImpl.kt:221)
   at kotlinx.coroutines.ChildContinuation.invoke(CancellableContinuationImpl.kt:698)
   at kotlinx.coroutines.JobSupport.notifyHandlers(JobSupport.kt:365)
   at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:324)
   at kotlinx.coroutines.JobSupport.tryMakeCancelling(JobSupport.kt:826)
   at kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:786)
   at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:702)
   at kotlinx.coroutines.JobSupport.parentCancelled(JobSupport.kt:668)
   at kotlinx.coroutines.ChildHandleNode.invoke(JobSupport.kt:1580)
   at kotlinx.coroutines.JobSupport.notifyHandlers(JobSupport.kt:365)
   at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:324)
   at kotlinx.coroutines.JobSupport.tryMakeCancelling(JobSupport.kt:826)
   at kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:786)
   at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:702)
   at kotlinx.coroutines.JobSupport.cancelInternal(JobSupport.kt:663)
   at kotlinx.coroutines.JobSupport.cancel(JobSupport.kt:648)
   at kotlinx.coroutines.Job$DefaultImpls.cancel$default(Job.java:192)
   at com.usercentrics.sdk.v2.async.dispatcher.Dispatcher$dispatchWithTimeout$1$1$1$1.invoke(Dispatcher.kt:44)
   at com.usercentrics.sdk.v2.async.dispatcher.Dispatcher$dispatchWithTimeout$1$1$1$1.invoke(Dispatcher.kt:43)
   at kotlinx.coroutines.CancelHandler$UserSupplied.invoke(CancellableContinuationImpl.kt:667)
   at kotlinx.coroutines.CancellableContinuationImpl.callCancelHandler(CancellableContinuationImpl.kt:239)
   at kotlinx.coroutines.CancellableContinuationImpl.cancel(CancellableContinuationImpl.kt:209)
   at kotlinx.coroutines.CancellableContinuationImpl.parentCancelled$kotlinx_coroutines_core(CancellableContinuationImpl.kt:221)
   at kotlinx.coroutines.ChildContinuation.invoke(CancellableContinuationImpl.kt:698)
   at kotlinx.coroutines.JobSupport.notifyHandlers(JobSupport.kt:365)
   at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:324)
   at kotlinx.coroutines.JobSupport.tryMakeCancelling(JobSupport.kt:826)
   at kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:786)
   at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:702)
   at kotlinx.coroutines.JobSupport.cancelCoroutine(JobSupport.kt:689)
   at kotlinx.coroutines.TimeoutCoroutine.run(Timeout.kt:156)
   at kotlinx.coroutines.EventLoopImplBase$DelayedRunnableTask.run(EventLoop.common.kt:505)
   at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:263)
   at kotlinx.coroutines.DefaultExecutor.run(DefaultExecutor.kt:105)
   at java.lang.Thread.run(Thread.java:929)


Caused by java.lang.UnsupportedOperationException:
   at com.google.protobuf.AbstractProtobufList.ensureIsMutable(AbstractProtobufList.java:161)
   at com.google.protobuf.ProtobufArrayList.add(ProtobufArrayList.java:52)
   at com.google.protobuf.AbstractMessageLite$Builder.addAllCheckingNulls(AbstractMessageLite.java:355)
   at com.google.protobuf.AbstractMessageLite$Builder.addAll(AbstractMessageLite.java:408)
   at com.google.protobuf.AbstractMessageLite.addAll(AbstractMessageLite.java:117)
   at com.google.firebase.perf.v1.NetworkRequestMetric.addAllPerfSessions(NetworkRequestMetric.java:1232)
   at com.google.firebase.perf.v1.NetworkRequestMetric.access$2900(NetworkRequestMetric.java:17)
   at com.google.firebase.perf.v1.NetworkRequestMetric$Builder.addAllPerfSessions(NetworkRequestMetric.java:2355)
   at com.google.firebase.perf.metrics.NetworkRequestMetricBuilder.build(NetworkRequestMetricBuilder.java:318)
   at com.google.firebase.perf.network.InstrURLConnectionBase.disconnect(InstrURLConnectionBase.java:80)
   at com.google.firebase.perf.network.InstrHttpsURLConnection.disconnect(InstrHttpsURLConnection.java:63)
   at com.usercentrics.sdk.services.api.http.AndroidHttpClient$get$4.invoke(AndroidHttpClient.kt:39)
   at com.usercentrics.sdk.services.api.http.AndroidHttpClient$get$4.invoke(AndroidHttpClient.kt:39)
   at com.usercentrics.sdk.domain.api.http.HttpDisposable.disconnect(HttpDisposable.java:9)
   at com.usercentrics.sdk.domain.api.http.HttpRequestsImpl$getSync2$2$1$1.invoke(HttpRequestsImpl.kt:61)
   at com.usercentrics.sdk.domain.api.http.HttpRequestsImpl$getSync2$2$1$1.invoke(HttpRequestsImpl.kt:60)
   at kotlinx.coroutines.CancelHandler$UserSupplied.invoke(CancellableContinuationImpl.kt:667)
   at kotlinx.coroutines.CancellableContinuationImpl.callCancelHandler(CancellableContinuationImpl.kt:239)
   at kotlinx.coroutines.CancellableContinuationImpl.cancel(CancellableContinuationImpl.kt:209)
   at kotlinx.coroutines.CancellableContinuationImpl.parentCancelled$kotlinx_coroutines_core(CancellableContinuationImpl.kt:221)
   at kotlinx.coroutines.ChildContinuation.invoke(CancellableContinuationImpl.kt:698)
   at kotlinx.coroutines.JobSupport.notifyHandlers(JobSupport.kt:365)
   at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:324)
   at kotlinx.coroutines.JobSupport.tryMakeCancelling(JobSupport.kt:826)
   at kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:786)
   at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:702)
   at kotlinx.coroutines.JobSupport.parentCancelled(JobSupport.kt:668)
   at kotlinx.coroutines.ChildHandleNode.invoke(JobSupport.kt:1580)
   at kotlinx.coroutines.JobSupport.notifyHandlers(JobSupport.kt:365)
   at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:324)
   at kotlinx.coroutines.JobSupport.tryMakeCancelling(JobSupport.kt:826)
   at kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:786)
   at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:702)
   at kotlinx.coroutines.JobSupport.cancelInternal(JobSupport.kt:663)
   at kotlinx.coroutines.JobSupport.cancel(JobSupport.kt:648)
   at kotlinx.coroutines.Job$DefaultImpls.cancel$default(Job.java:192)
   at com.usercentrics.sdk.v2.async.dispatcher.Dispatcher$dispatchWithTimeout$1$1$1$1.invoke(Dispatcher.kt:44)
   at com.usercentrics.sdk.v2.async.dispatcher.Dispatcher$dispatchWithTimeout$1$1$1$1.invoke(Dispatcher.kt:43)
   at kotlinx.coroutines.CancelHandler$UserSupplied.invoke(CancellableContinuationImpl.kt:667)
   at kotlinx.coroutines.CancellableContinuationImpl.callCancelHandler(CancellableContinuationImpl.kt:239)
   at kotlinx.coroutines.CancellableContinuationImpl.cancel(CancellableContinuationImpl.kt:209)
   at kotlinx.coroutines.CancellableContinuationImpl.parentCancelled$kotlinx_coroutines_core(CancellableContinuationImpl.kt:221)
   at kotlinx.coroutines.ChildContinuation.invoke(CancellableContinuationImpl.kt:698)
   at kotlinx.coroutines.JobSupport.notifyHandlers(JobSupport.kt:365)
   at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:324)
   at kotlinx.coroutines.JobSupport.tryMakeCancelling(JobSupport.kt:826)
   at kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:786)
   at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:702)
   at kotlinx.coroutines.JobSupport.cancelCoroutine(JobSupport.kt:689)
   at kotlinx.coroutines.TimeoutCoroutine.run(Timeout.kt:156)
   at kotlinx.coroutines.EventLoopImplBase$DelayedRunnableTask.run(EventLoop.common.kt:505)
   at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:263)
   at kotlinx.coroutines.DefaultExecutor.run(DefaultExecutor.kt:105)
   at java.lang.Thread.run(Thread.java:929)

Steps to reproduce:

Unable to reproduce but seems to be caused by modifications to an immutable list by the firebase performance library

@google-oss-bot
Copy link
Contributor

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@lehcar09
Copy link
Contributor

Hi @tolulonge, thank you for reaching out. Can you share the versions of the dependency you're using:

  • AGP
  • Kotlin
  • Firebase Perf Gradle Plugin

Have you observed this issue to previous Firebase versions? Also, does the issue occur on certain devices and/or android versions? Thanks!

@tolulonge
Copy link
Author

AGP version: 8.8.0
Kotlin version: 2.0.21
Firebase Perf Gradle Plugin: 1.4.2

Yes, it had also been observed in previous firebase versions, it is not unique to the new version
For device distribution, we see mostly samsung devices affected and androd version with highest occurent is Android 14:
88% Samsung, 8% Hauwei, 3% Xiaomi, 3% google and 2% Other
47% Android 14, 22% Android 10, 8% Android 9, 7% Android 12 and 16% Other

@lehcar09
Copy link
Contributor

Thank you for the details @tolulonge. I'll consult this to our engineers and see what we can do here. I 'll get back to you once I hear back from them. Thanks!

@lehcar09 lehcar09 added type: bug Something isn't working and removed needs-attention labels Jan 30, 2025
@lehcar09
Copy link
Contributor

Our engineers confirmed that this is a bug on Network Request Metric builder with a race condition, which is why it'd be very hard to reproduce. We’re working on this and let you know once the fix is released. Thanks!

@samedson
Copy link
Contributor

samedson commented Feb 6, 2025

@tolulonge thanks for reporting. We haven't been able to reproduce the issue yet, but I wanted to get a better idea about how often this is happening.

I was wondering how many events per week you're getting for this crash? And do you know when this started?

@tolulonge
Copy link
Author

Hi @samedson, thanks for looking into this, data is only seen on firebase crashlytics only for as far back as the last 90 days and the issue has been present since then

Approximately, we see 300 events per week for this crash, with total of about 4k crash events in the last 90 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: performance type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants