Automattic / pocket-casts-ios

Pocket Casts iOS app 🎧
Mozilla Public License 2.0
1.64k stars 129 forks source link

Up Next: Queue Emptied Unexpectedly #24

Open pocketcasts opened 2 years ago

pocketcasts commented 2 years ago

What's happening:

Multiple reports of Up Next lists disappearing:

my up next list just wiped out without no reason

However recently I’ve experienced a problem with the up next queue - one day most of the episodes vanished from the queue and only about the top 20 episodes were left.

User Reports:

105828-zen

106235-zen

106088-zen

Pocket Casts (7.18), running on an iPad 6th generation and on an iPhone SE (2020) both on iOS 14.6

pocketcasts commented 2 years ago

108178-zd

App Version: 7.18.1 Device: iPod9,1 OS: 14.7.1

pocketcasts commented 2 years ago

107112-zen

I’m a longtime avid user of pocket casts. So much so, that I pay for your pocket casts plus service. Thanks for creating such a consistency great app.

I had a recent issue that I wanted to report, and hopefully somehow get my data back. Yesterday I noticed that all of the podcast episodes that I had in my Up Next list were gone, so essentially my Up Next list was empty. I know I would not have cleared the queue, so is there any way to discover what happened and to get this data back?

The Up Next list is what I use to order the episodes (100s) that I want to listen to next, and it would be a huge bummer to have to go back into all my different podcasts and re-add all of the different podcast episodes.

I mostly use it only on my iPhone 12, and I have PocketCasts version 7.18 (821) installed.

No debug logs attached to the email

pocketcasts commented 2 years ago

i am really struggling with the “up next” list. The list is emptying its self every time I start playing a new track. In the past it was like that: I had podcasts in the que -> I start playing a new one -> the current running was shifted into the “up next”-list and ne new one stated to play.

Now I push play for new one and ne list will be deleted and the new one starts to play. I already reinstalled the app and deleted all cash-files. But still have the problem.

106197-zen No debug file attached- web browser report

pocketcasts commented 2 years ago

the app clears my Up Next queue.

110902-zen

pocketcasts commented 2 years ago

We have a case here where the customer was not aware that they were logged out and had a large queue of podcasts. As soon as they logged in, it wiped out the queue and replaced it with the one from the account.

I replicated this on my device too. It might be nice if a popup is shown when logging in to a Pocket Casts account asking if we want to move the podcasts over to our queue or clear them.

4875616-zen

CameronMilliken commented 2 years ago

Since recent 7.2 update listening queue is disappearing at random, all files or podcasts added are gone. Has happened twice in past few days past since that update.

All files in queue disappear, mix of podcasts and files on phone

https://woothemes.zendesk.com/agent/tickets/5458982

reginabally commented 2 years ago

Let’s say I have 10 episodes in queue. If I suddenly hit play on a new lex fridman episode which is not already in queue, the whole queue empties with just this episode playing. The auto-downloaded episodes from the queue still remain downloaded, but the queue never restores.

https://woothemes.zendesk.com/agent/tickets/5488638

Relevant log section:

2022-08-17 12:37:53 Play Next Episode #307 – Brian Armstrong: Coinbase, Cryptocurrency, and Government Regulation
2022-08-17 12:37:53 Remove Top Episode Lighting and tech diffusion
2022-08-17 12:37:53 PlaybackQueue: removing Lighting and tech diffusion episode
2022-08-17 12:37:53 cleanupCurrentPlayer permanent? false
2022-08-17 12:37:53 Loading #307 – Brian Armstrong: Coinbase, Cryptocurrency, and Government Regulation with UUID d87c5535-b23f-40c9-9e7b-f36fb45d7ee8 autoPlay false
2022-08-17 12:37:53 cleanupCurrentPlayer permanent? false
2022-08-17 12:37:53 Using EffectsPlayer
2022-08-17 12:37:53 activating audio session succeeded
2022-08-17 12:37:54 Sent position 1566 status 3 for episode Lighting and tech diffusion to server
2022-08-17 12:37:58 Total user files  0, total size 10000000000 used size 0
2022-08-17 12:37:58 UpNextSyncTask: Syncing Up Next, sending 1 changes, modified time 1660662777657
2022-08-17 12:37:59 UpNextSyncTask: server copy matches our copy, nothing action required
2022-08-17 12:37:59 saving played up to 5.808 for episode #307 – Brian Armstrong: Coinbase, Cryptocurrency, and Government Regulation
2022-08-17 12:38:21 Refresh complete found 0 new episodes
2022-08-17 12:38:21 Total user files  0, total size 10000000000 used size 0
2022-08-17 12:38:21 UpNextSyncTask: Syncing Up Next, sending 0 changes, modified time 1660711078935
2022-08-17 12:38:22 UpNextSyncTask: Server returned not modified to Up Next sync, no changes required
2022-08-17 12:38:22 SyncTask: sending 3 changed items to the server
2022-08-17 12:38:24 PlaybackQueue: removing How Does Facing Death Change Your Life? (Replay from Ep. 49) episode
2022-08-17 12:38:24 Received subscription status paid : 1, platform : 4, frequency : 0, giftDays : 1095, expiryDate :  2022-09-19 02:00:33 +0000, supporterPodcasts : 0
2022-08-17 12:38:24 Sync succeeded
2022-08-17 12:38:26 PlaybackQueue: removing 506. What Is Sportswashing (and Does It Work)? episode
2022-08-17 12:38:28 PlaybackQueue: removing 102. What's So Bad About Nepotism? episode
2022-08-17 12:38:29 PlaybackQueue: removing 499. Don't Worry, Be Tacky episode

Full log: https://mc.a8c.com/encrypted-logs.php?uuid=24EA383E-5439-4BBD-8CEA-A5A6792C724E

igotdes commented 2 years ago

Reported in #5500413-zen. I'm also asking them about any other devices or integrations they've used Pocket Casts with.

Logs: https://mc.a8c.com/encrypted-logs.php?uuid=DB8D02CB-C238-4079-8E03-3D86CCDBBE71

CameronMilliken commented 2 years ago

My playlist cleared again. I wasn’t doing anything or listening to anything. I just unlocked my phone and saw a different show’s art on my widget. And now instead of like 8 items on my playlist, there’s two. It never happens while actively listening. Sometimes I come back and it’s cleared. This time I came back and there are two episodes that I don’t know were on there this morning.

App Version: 7.20.2 Device: iPhone14,5 OS: 15.6.1

Logs: https://mc.a8c.com/encrypted-logs.php?uuid=BACBFCCB-6CF8-4E75-9097-A9179D0D1F20

https://woothemes.zendesk.com/agent/tickets/5501389

CameronMilliken commented 2 years ago

I opened Pocket Casts on my iPhone, and within a few seconds of opening the app, the Up Next queue of approximately 4 episodes that I had queued up disappeared. I am able to find the episode that I had started listening to by going to my Listening History; an episode that is half finished is at the top of the list. All the other episodes will need to be manually found and re-added to the queue.

App Version: 7.20.2 Device: iPhone12,1 OS: 15.6.1

Logs: https://mc.a8c.com/encrypted-logs.php?uuid=B9E53B38-6CA2-4E30-876E-AE471B2404D6

https://woothemes.zendesk.com/agent/tickets/5489870

ezebecke commented 2 years ago

+1 on #5542324-zd

ezebecke commented 2 years ago

+1 on #5545173-zd

'm experiencing a bug where my queue keeps disappearing. I can add episodes to queue but when I listen an episode or two it becomes empty.

App Version: 7.20.2 Device: iPhone14,3 OS: 15.6.1

Logs: https://mc.a8c.com/encrypted-logs.php?uuid=386130AA-96AA-449D-965B-92CFD33288CF

mchowning commented 1 year ago

I'm sure this isn't the cause of most of these issues, but some of them might be due to this Android bug where Android will remove local files from the up next queue if they are not on that device. So the flow I'm imagining is:

  1. User adds a bunch of local files to their Up Next queue from their iOS device
  2. iOS device syncs with PC account
  3. User then signs into the same account on an Android device, which removes all the local files from their Up Next queue
  4. Android device syncs with PC account
  5. iOS device syncs with PC account
  6. All local episodes are gone from the Up Next Queue on the iOS device
thabotswana commented 1 year ago

I'm sure this isn't the cause of most of these issues, but some of them might be due to https://github.com/Automattic/pocket-casts-android/issues/356 where Android will remove local files from the up next queue if they are not on that device.

One of the users came back in 5605737-zen saying they don't use any other devices but they do use the web app once every few months.

emilylaguna commented 1 year ago

I've been investigating this issue and I wanted to document my findings so far.

As of right now I have identified a few ways and scenarios where this could occur, this is not a definitive list but it's a start:

Steps to reproduce

If the user is using multiple devices:

New Device Wipe:

Scenario: The user installs the app on a new device, but doesn't sign in immediately, and then signs later after modifying the up next

  1. On device 1, sign in and add some items to the up next queue
  2. On device 2, fresh install the app
  3. Add an item to the up next queue
  4. Sign in
  5. On device 1, refresh
  6. 💥 The up next queue is replaced with the queue from device 2

Sign out to sign in wipe:

Scenario: The user is signed in on multiple devices, but one of the devices has been logged out, and then later signs in again.

  1. On device 1, Sign in
  2. Add some items to your up next queue
  3. Once device 2, sign in
  4. Your up next queue will sync correctly
  5. On device 2, sign out
  6. On device 1, add some more items to your queue
  7. On device 2, sign back in
  8. 💥 Device 1's up next queue will be replaced with the outdated device 2

Single device:

App reinstalled:

Scenario: The user reinstalls the app, doesn't sign in immediately, modifies their up next queue, then signs in.

  1. On a device, sign in and add some items to the up next queue
  2. Delete the app, and reinstall it
  3. Dismiss the login
  4. Add an item to your up next queue
  5. Sign in
  6. 💥 The previous up next queue is replaced with the new queue

The cause

Part 1

There is a block of code in the up next syncing process that says "if the user has never sync'd before and the user has a queue, then ignore all the remote incoming changes and instead force the server to use what the local device has"

https://github.com/Automattic/pocket-casts-ios/blob/c9a937af6f4d017e337fad91d22915edea4aac57/Modules/Server/Sources/PocketCastsServer/Public/Sync/UpNextSyncTask.swift#L105-L112

The purpose of this code is to avoid a bug where the up next queue is cleared if the user signs out, makes changes to their queue, and then signs back in. However, this solution only works well for a single device, and if the user has multiple devices synced, it can cause the up next queue to be wiped out.

The issue is that it uses the upNextServerModified() function to check if the user is syncing for the first time. However, this value is reset if the user gets signed out, causing the code to run and overwrite the up next queue with an outdated version if they sign back in on a different device.

https://github.com/Automattic/pocket-casts-ios/blob/5e6181fa26d6e1b97dc2fd84b8fb3653f95fa048/Modules/Server/Sources/PocketCastsServer/Public/Sync/SyncManager.swift#L43

Note: While the reproduction steps currently require multiple devices, I suspect that this could also be caused by a device that is also connected to the watch app since it shares similar logic. However I have not been able to reproduce that as of now.

Part 2

Another issue that I've noticed that if the user is signed in, the app will keep track of all the changes to the up next by saving these to the database. However, if the user is signed out these changes are not saved.

This can result in the up next not syncing correctly if the user gets signed out and signs back in again.

Possible solutions

Add a new flag that keeps track of the "type" of sync that is occurring

When thinking about how to handle locally made changes when the user is: Creating a new account, logging into an existing account, or a sync is just happening, we'll want to be able to apply different logic for each of the scenarios:

Keep track of the up next queue changes even if the user is signed out

If we don't keep track of the changes a user is making to their up next queue we may not be able to properly perform a merge of incoming data. This will also allow us to continue to keep track of the changes a user makes if they somehow get signed out without them realizing it.

Add new logic to handle the login merging

When the user is logging into an account and they have items in their queue we should:

Next steps

I have a local proof of concept branch that applies these changes and I am currently testing to verify the changes are working and are not causing any further issues. A PR will be created tomorrow to be tested and discussed further before releasing

emilylaguna commented 1 year ago

Closing as this should be addressed by: https://github.com/Automattic/pocket-casts-ios/pull/661

We should create a new issue if this continues happening.

reginabally commented 1 year ago

Re-opening this because of a user report in 6633062-zen:

My "Up Next" queue disappeared after the recent update.

User log: https://mc.a8c.com/encrypted-logs.php?uuid=0448B689-4228-458B-8ECE-EBE9246D968F

I'm asking them if they use the app on another device or with speaker integration.

igotdes commented 1 year ago

The user in #6633062-zen reported back:

No I have not used Pocket cast with speaker integrations, I just used the laptop APP on my Mac and the in the iPhone and Apple Wathc

I asked them some additional questions, and here are the responses:

igotdes commented 7 months ago

Reported in #7602939-zen.

The user also uses Pocket Casts on their Apple Watch, so I have asked them to uninstall the watch app and uninstall/reinstall the phone app for good measure, according to the recommendations in p1705672435210509/1705637000.116119-slack-C02A333D8LQ.

igotdes commented 5 months ago

Reported in #7995817-zen

igotdes commented 4 months ago

8128499-zen:

Over the last couple of days my app has twice cleared out the up next queue. That’s never happened before that I can recall. Did a bug get shipped recently?