Skip to content

ConcurrentModificationException in MediaLibrarySessionImpl.getSubscribedControllers() #3056

@jjohnstz

Description

@jjohnstz

Version

Media3 1.8.0

More version details

No response

Devices that reproduce the issue

Pixel 10 Pro Fold, Pixel 9 Pro XL, Pixel 8, Pixel 6, Galaxy S20, Galaxy S23 Ultra

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Not tested

Reproduction steps

Not able to reproduce, crash information is from Crashlytics

Expected result

No exception thrown

Actual result

Fatal Exception: java.util.ConcurrentModificationException:
       at com.google.common.collect.CompactHashSet$1.checkForConcurrentModification(CompactHashSet.java:582)
       at com.google.common.collect.CompactHashSet$1.next(CompactHashSet.java:556)
       at com.google.common.collect.AbstractMapBasedMultimap$WrappedCollection$WrappedIterator.next(AbstractMapBasedMultimap.java:465)
       at java.util.AbstractCollection.toArray(AbstractCollection.java:146)
       at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:264)
       at androidx.media3.session.MediaLibrarySessionImpl.getSubscribedControllers(MediaLibrarySessionImpl.java:246)
       at androidx.media3.session.MediaLibraryService$MediaLibrarySession.getSubscribedControllers(MediaLibraryService.java:798)
       at fm.libro.service.session.LibroMediaSession$subscribeToMediaItemsChanges$1$1.invokeSuspend(LibroMediaSession.kt:24)
       at fm.libro.service.session.LibroMediaSession$subscribeToMediaItemsChanges$1$1.invoke(:12)
       at fm.libro.service.session.LibroMediaSession$subscribeToMediaItemsChanges$1$1.invoke(:8)
       at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit(Emitters.kt:50)
       at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:33)
       at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
       at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(:14)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1154)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:652)
       at java.lang.Thread.run(Thread.java:1563)

Media

NA

Bug Report

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions