这是indexloc提供的服务,不要输入任何密码
Skip to content

Exceptions other than IOExceptions, that occurred in the CacheWriter, block CachedContent forever #9760

@badmannersteam

Description

@badmannersteam

Hello and thanks for the great library :)

I've faced an issue when using ProgressiveDownloader and HlsDownloader from ExoPlayer 2.16.1.
If they failed to perform downloading due to not IOException, CacheWriter in them never calls dataSource.close() (sources: 1, 2, 3) and because of that CacheDataSource remains opened and never calls Cache.releaseHoleSpan() -> CachedContent.unlockRange(), so CachedContent becomes blocked until the app restart.
Also I can't close data source manually, because I don't have an access to it in the XxxDownloader.

Example:

java.lang.IllegalStateException: Can't resolve source!
        at myapppackage.UrlResolver.resolveDataSpec(UrlResolver.java:46)
        at com.google.android.exoplayer2.upstream.ResolvingDataSource.open(ResolvingDataSource.java:106)
        at com.google.android.exoplayer2.upstream.TeeDataSource.open(TeeDataSource.java:52)
        at com.google.android.exoplayer2.upstream.cache.CacheDataSource.openNextSource(CacheDataSource.java:776)
        at com.google.android.exoplayer2.upstream.cache.CacheDataSource.open(CacheDataSource.java:589)
        at com.google.android.exoplayer2.upstream.cache.CacheWriter.readBlockToCache(CacheWriter.java:172)
        at com.google.android.exoplayer2.upstream.cache.CacheWriter.cache(CacheWriter.java:134)
        at com.google.android.exoplayer2.offline.ProgressiveDownloader$1.doWork(ProgressiveDownloader.java:95)
        at com.google.android.exoplayer2.offline.ProgressiveDownloader$1.doWork(ProgressiveDownloader.java:92)
        at com.google.android.exoplayer2.util.RunnableFutureTask.run(RunnableFutureTask.java:125)
        at com.google.android.exoplayer2.offline.DefaultDownloaderFactory$$ExternalSyntheticLambda0.execute(Unknown Source:0)
        at com.google.android.exoplayer2.offline.ProgressiveDownloader.download(ProgressiveDownloader.java:114)

If after that I'll try to open same dataSpec through the Cache, it will be blocked here.

I think that CacheWriter must close datasources when any error occur, not only IOException.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions