SimpleCache assertion error
Open
@marcbaechinger is already working on this.
Since Oct 9, 2025.
bug
needs triage
- Dominant language
- Java
- Stars
- 3k
- Forks
- 955
- Avg merge
- 12d 14h
- Merged PRs (30d)
- 2
Description
Version
Media3 1.8.0
More version details
No response
Devices that reproduce the issue
All
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Yes
Reproduction steps
I do not have a proper repro as it looks like a race. SimpleCache can throw assertions during source closeQuietly that should not be thrown.
2025-10-01 09:37:12.294 Error ExoPlayer LoadTask - Unexpected exception loading stream
java.lang.IllegalStateException
at androidx.media3.common.util.Assertions.checkState(Assertions.java:85)
at androidx.media3.datasource.cache.SimpleCache.commitFile(SimpleCache.java:409)
at androidx.media3.datasource.cache.CacheDataSink.closeCurrentOutputStream(CacheDataSink.java:278)
at androidx.media3.datasource.cache.CacheDataSink.close(CacheDataSink.java:234)
at androidx.media3.datasource.TeeDataSource.close(TeeDataSource.java:101)
at androidx.media3.datasource.cache.CacheDataSource.closeCurrentSource(CacheDataSource.java:855)
at androidx.media3.datasource.cache.CacheDataSource.close(CacheDataSource.java:688)
at androidx.media3.datasource.StatsDataSource.close(StatsDataSource.java:123)
at androidx.media3.datasource.DataSourceUtil.closeQuietly(DataSourceUtil.java:87)
at androidx.media3.exoplayer.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1160)
at androidx.media3.exoplayer.upstream.Loader$LoadTask.run(Loader.java:453)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1156)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651)
at java.lang.Thread.run(Thread.java:1119)
Since the media was properly played already the assertion breaks gapless due to player error.
Usually closeQuietly are meant to drop errors, and so
Expected result
Do not throw errors as it happens while playback was successful.
Actual result
The player send errors triggering side effects.
025-10-01 09:38:47.799 Error ExoPlayer ExoPlayerImplInternal - Playback error
androidx.media3.exoplayer.ExoPlaybackException: Source error
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:926)
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:902)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loopOnce(Looper.java:257)
at android.os.Looper.loop(Looper.java:342)
at android.os.HandlerThread.run(HandlerThread.java:85)
Caused by: androidx.media3.exoplayer.upstream.Loader$UnexpectedLoaderException: Unexpected IllegalStateException
at androidx.media3.exoplayer.upstream.Loader$LoadTask.run(Loader.java:474)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1156)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651)
at java.lang.Thread.run(Thread.java:1119)
Caused by: java.lang.IllegalStateException
at androidx.media3.common.util.Assertions.checkState(Assertions.java:85)
at androidx.media3.datasource.cache.SimpleCache.commitFile(SimpleCache.java:409)
at androidx.media3.datasource.cache.CacheDataSink.closeCurrentOutputStream(CacheDataSink.java:278)
at androidx.media3.datasource.cache.CacheDataSink.close(CacheDataSink.java:234)
at androidx.media3.datasource.TeeDataSource.close(TeeDataSource.java:101)
at androidx.media3.datasource.cache.CacheDataSource.closeCurrentSource(CacheDataSource.java:855)
at androidx.media3.datasource.cache.CacheDataSource.close(CacheDataSource.java:688)
at androidx.media3.datasource.StatsDataSource.close(StatsDataSource.java:123)
at androidx.media3.datasource.DataSourceUtil.closeQuietly(DataSourceUtil.java:87)
at androidx.media3.exoplayer.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1160)
at androidx.media3.exoplayer.upstream.Loader$LoadTask.run(Loader.java:453)
... 3 more
Media
N/A
Bug Report
- You will email the zip file produced by
adb bugreportto android-media-github@google.com after filing this issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.