Automattic / Automattic/pocket-casts-android

App restarted when playing an episode

Open
#846 0 comments 0 reactions 0 assignees View on GitHub
[Area] Playback [Priority] Low [Type] Bug
Dominant language
Kotlin
Stars
2.8k
Forks
308
Avg merge
1d 13h
Merged PRs (30d)
143

Description

### Description

Internal discussion: p1679020256197549-slack-C02A333D8LQ

The app restarted itself when an episode was playing.

Quoting @ashiagr's findings:

I see a lot of socket timeout and internet connection issues in the debug log. Besides Pocket Casts server, they point to podcast servers also like: "[media.blubrry.com](http://media.blubrry.com/)". So I believe it is not specific to Pocket Casts server issues.
```
I 14/3 13:17:33 Play 4619,674 System Player. RapaduraCast 757 – Analisando os 10 indicados a Melhor Filme do #Oscars 2023 Downloaded: false Downloading: false Audio: true File: https://media.blubrry.com/cinemacomrapadura/content.blubrry.com/cinemacomrapadura/rapaduracast_757-10-filmes-oscars-2023.mp3 Uuid: c2a0d70d-059f-4dd6-aaed-7f4c7fc8c77a
...
Caused by: com.google.android.exoplayer2.upstream.HttpDataSource$HttpDataSourceException: java.net.UnknownHostException: Unable to resolve host "media.blubrry.com": No address associated with hostname
E 14/3 13:18:11 Response failed from https://refresh.pocketcasts.com/user/update.
java.net.UnknownHostException: Unable to resolve host "refresh.pocketcasts.com": No address associated with hostname
E 14/3 13:19:48 Play failed.
...
Caused by: com.google.android.exoplayer2.upstream.HttpDataSource$HttpDataSourceException: java.net.UnknownHostException: Unable to resolve host "media.blubrry.com": No address associated with hostname
I 13/3 13:45:13 Play 849,544 System Player. O Gambito da Rainha Downloaded: false Downloading: false Audio: true File: https://sphinx.acast.com/p/open/s/639392cb6c25ea001115e06a/e/b603e416-1c83-45ca-95bf-ee01b65db01a/media.mp3 Uuid: 498210bf-f046-46e6-b5c1-79945412cf07
E 13/3 13:45:31 Play failed.
...
Caused by: com.google.android.exoplayer2.upstream.HttpDataSource$HttpDataSourceException: java.net.SocketTimeoutException: timeout
...

E 13/3 13:45:32 Playback state error: 1 Could not load podcast. Please check your internet connection and try again.
E 13/3 13:43:48 Play failed.
...
Caused by: com.google.android.exoplayer2.upstream.HttpDataSource$HttpDataSourceException: java.net.SocketTimeoutException: timeout
```

One more issue I see is related to ExoPlayer (the library we use to play media) buffering:

```
E 13/3 15:50:10 Play failed.
com.google.android.exoplayer2.ExoPlaybackException: Unexpected runtime error
...
Caused by: java.lang.IllegalStateException: Playback stuck buffering and not loading
```

I found a few related issues in the ExoPlayer library:
https://github.com/google/ExoPlayer/issues/10361
https://github.com/google/ExoPlayer/issues/8378

I checked that we [set back buffer to 2 minutes](https://github.com/Automattic/pocket-casts-android/blob/7f44dab135cfd45308aeb7a0d811ac987871499b/modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/SimplePlayer.kt#L43) while streaming which is a reasonable limit as opposed to 10 mins set in the linked issue.

At this point, I can only see that the cause of the crashes is linked to an unstable internet connection and partially to the back buffer limit set on the media player. We can ask them to download the episode instead of streaming it just to rule out any issues due to buffering.

### Step-by-step reproduction instructions

Not reproducible.

### Screenshots or screen recording

_No response_

### Did you search for existing bug reports?

- [X] I have searched for existing bug reports.

### Device, Operating system, and Pocket Casts app version

App version : 7.34-rc-1 (9078)
Phone: samsung - Galaxy S20 FE - SM-G780G - r8q
Kernel: 4.19.113-25884040 - 21DK7905
Android version: 13 SDK 33

Contributor guide

Open the contributing guide

Research direction

Start by reading the playback path in modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/playback/SimplePlayer.kt and comparing it with the supplied ExoPlayer buffering and network-error logs. The issue is not reproducible, so done requires identifying a reliable cause of the restart and confirming the resulting behavior with a regression test or repeatable scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile-dev
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.