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

MF-464: Explictly remove cache keys that come from InvalidResponseCodeException #105

Merged
merged 2 commits into from
Sep 19, 2024

Conversation

stoyicker
Copy link
Member

This involves some changes to cache management since it used to live on a lower scope.

@stoyicker stoyicker marked this pull request as ready for review September 18, 2024 11:37
@stoyicker stoyicker requested a review from a team as a code owner September 18, 2024 11:37
@@ -802,6 +808,10 @@ internal class ExoPlayerPlaybackEngine(

var errorMessage = "${error.errorCodeName}: ${crawler?.message}"
while (crawler?.cause != null) {
@Suppress("MagicNumber")
if ((crawler as? InvalidResponseCodeException)?.responseCode == 416) {
playerCache.cache.removeResource(crawler.dataSpec.key!!)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the dataSpec key in question is not in the cache and hence why the player made a request to fetch it. And the request failed with 416 because it used invalid cached range data. I'm not sure how the range data is calculated but I suspect it's from the rest of the cached chunks of the track. So, I suggest we remove all resources related to this media track from the cache. In this PR, we are removing /mediatracks/Gi...QQ/34.mp4, but let's remove all /mediatracks/Gi...QQ/*.mp4.

Or alternatively to first validate this fix, we can simply remove all keys from the cache (kinda like a reset) and see if this solves this issue. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if our average user would notice that we wipe their entire online playback cache, so we could do that yeah. The other option is probably enough too, but it might be a little more risky since we'd have introduce some regex and make assumptions about how things can look.

Let's go with wiping the entire cache?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, let's do that 👍🏻

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there we go

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great - I just pushed a small commit just to make onPlayerError not to grow more.

@stoyicker stoyicker force-pushed the jantonio/MF-464_explicit_removal branch 2 times, most recently from 2f9ad02 to 74d6a05 Compare September 18, 2024 14:27
…eException

This involves some changes to cache management since it used to live on a lower
scope.
@stoyicker stoyicker force-pushed the jantonio/MF-464_explicit_removal branch from 74d6a05 to 7e18310 Compare September 18, 2024 14:29
@stoyicker stoyicker added this pull request to the merge queue Sep 19, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 19, 2024
@stoyicker stoyicker added this pull request to the merge queue Sep 19, 2024
Merged via the queue into main with commit 4b7dccc Sep 19, 2024
7 checks passed
@stoyicker stoyicker deleted the jantonio/MF-464_explicit_removal branch September 19, 2024 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants