[Bug]: Create/Update Media Progress does not update personalized rows #1460

Closed
opened 2026-04-24 23:46:24 +02:00 by adam · 13 comments
Owner

Originally created by @rasmuslos on GitHub (Oct 13, 2023).

Describe the issue

Sending progress updates to the Create/Update Media Progress endpoint causes items to stay in "continue listening", even though they are completed. Marking them as unfinished / finished does not resolve the issue

Bildschirmfoto 2023-10-13 um 12 02 50

Steps to reproduce the issue

  1. Update media progress via the create update media progress endpoint

Audiobookshelf version

v2.4.4

How are you running audiobookshelf?

Docker

Originally created by @rasmuslos on GitHub (Oct 13, 2023). ### Describe the issue Sending progress updates to the [Create/Update Media Progress](https://api.audiobookshelf.org/#create-update-media-progress) endpoint causes items to stay in "continue listening", even though they are completed. Marking them as unfinished / finished does not resolve the issue <img width="456" alt="Bildschirmfoto 2023-10-13 um 12 02 50" src="https://github.com/advplyr/audiobookshelf/assets/49640416/528ab8da-7b37-4b18-a4f6-2425290ce7de"> ### Steps to reproduce the issue 1. Update media progress via the create update media progress endpoint ### Audiobookshelf version v2.4.4 ### How are you running audiobookshelf? Docker
adam added the bug label 2026-04-24 23:46:24 +02:00
adam closed this issue 2026-04-24 23:46:26 +02:00
Author
Owner

@rasmuslos commented on GitHub (Oct 13, 2023):

It seems like the endpoint creates a second media progress

Bildschirmfoto 2023-10-13 um 12 34 44
@rasmuslos commented on GitHub (Oct 13, 2023): It seems like the endpoint creates a second media progress <img width="644" alt="Bildschirmfoto 2023-10-13 um 12 34 44" src="https://github.com/advplyr/audiobookshelf/assets/49640416/2bb09f11-1237-4c57-853e-c3b99df2a5a0">
Author
Owner

@advplyr commented on GitHub (Oct 14, 2023):

I'm not able to reproduce this. This worked well:

curl --request PATCH 'http://localhost:3333/api/me/progress/99604f53-2850-42d5-8274-3c6dcdfcef72/57470d09-4009-4785-954a-3b12fe55163e' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI[...]1Ni85QQ' \
--data '{
    "progress": 0.25,
    "currentTime": 2000
}'

99604f53-2850-42d5-8274-3c6dcdfcef72 is the library item id
57470d09-4009-4785-954a-3b12fe55163e is the podcast episode id

@advplyr commented on GitHub (Oct 14, 2023): I'm not able to reproduce this. This worked well: ```bash curl --request PATCH 'http://localhost:3333/api/me/progress/99604f53-2850-42d5-8274-3c6dcdfcef72/57470d09-4009-4785-954a-3b12fe55163e' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer eyJhbGciOiJIUzI[...]1Ni85QQ' \ --data '{ "progress": 0.25, "currentTime": 2000 }' ``` `99604f53-2850-42d5-8274-3c6dcdfcef72` is the library item id `57470d09-4009-4785-954a-3b12fe55163e` is the podcast episode id
Author
Owner

@rasmuslos commented on GitHub (Oct 15, 2023):

I have been able to reproduce it multiple times on the latest version. The problem only occurs when you update progress using both the create/update media progress and the regular api/session/<ID>/sync one. Both create their own media progress entity. Updating progress by only using one or the other is fine

Bildschirmfoto 2023-10-15 um 09 44 28 Bildschirmfoto 2023-10-15 um 09 44 37
@rasmuslos commented on GitHub (Oct 15, 2023): I have been able to reproduce it multiple times on the latest version. The problem only occurs when you update progress using both the create/update media progress and the regular `api/session/<ID>/sync` one. Both create their own media progress entity. Updating progress by only using one or the other is fine <img width="854" alt="Bildschirmfoto 2023-10-15 um 09 44 28" src="https://github.com/advplyr/audiobookshelf/assets/49640416/554cf69d-3f49-4394-b015-3727e386ff88"> <img width="1206" alt="Bildschirmfoto 2023-10-15 um 09 44 37" src="https://github.com/advplyr/audiobookshelf/assets/49640416/a8a6403d-b4c4-45c8-a832-1176349fa043">
Author
Owner

@advplyr commented on GitHub (Oct 15, 2023):

Can you give me sample payloads and a step by step so I can reproduce it?

@advplyr commented on GitHub (Oct 15, 2023): Can you give me sample payloads and a step by step so I can reproduce it?
Author
Owner

@rasmuslos commented on GitHub (Oct 15, 2023):

Ok, so I managed to replicate it, but only on my main server, not one I setup just to test this. Maybe this is related to the database migration?

If progress is only reported using the session endpoint or the create update media endpoint everything works fine

Managed to replicate on main server:

  1. Start a listening session
    POST api/items/f756025e-f463-4a5b-952c-3de365e8d6a6/play/d2637f9e-0b47-44a2-b35c-3f3ff57e26b7
{
  "deviceInfo": {
    "clientName": "Audiobooks iOS"
  },
  "supportedMimeTypes": ["audio/flac", "audio/mpeg", "audio/mp4", "audio/aac", "audio/x-aiff"]
}
  1. Report progress to the session endpoint
    POST api/session/b20ee258-7dfd-4f75-be2b-64cbd50e39e5/sync
{
  "timeListened": 5.4028099775314331,
  "currentTime": 0.59915390099999999,
  "duration" : 174.00163265306122
}
  1. Mark the item as played via the create/update media progress endpoint
    PATCH api/me/progress/f756025e-f463-4a5b-952c-3de365e8d6a6/d2637f9e-0b47-44a2-b35c-3f3ff57e26b7
{
  "isFinished": true,
  "progress": 1,
  "currentTime": 174.00163265306122,
  "duration" : 174.00163265306122
}

f756025e-f463-4a5b-952c-3de365e8d6a6 is the podcast id
d2637f9e-0b47-44a2-b35c-3f3ff57e26b7 is the episode id
b20ee258-7dfd-4f75-be2b-64cbd50e39e5 is the the session id

Bildschirmfoto 2023-10-15 um 16 56 47

4 Treffer translates to 4 matches

Not working on my development server:

  1. Start a listening session
    POST api/items/a4352c2a-3163-4609-b047-8b2773e29e6b/play/88562dab-c0ed-45f7-a664-cdfb0bb81497
{
  "deviceInfo": {
    "clientName": "Audiobooks iOS"
  },
  "supportedMimeTypes": ["audio/flac", "audio/mpeg", "audio/mp4", "audio/aac", "audio/x-aiff"]
}
  1. Report progress to the session endpoint
    POST api/session/e15a0745-8289-4dc9-91b3-50e4955c2438/sync
{
  "duration": 1090.5861224489795,
  "currentTime": 0.52575628100000005,
  "timeListened": 1.6900789737701416
}
  1. Mark the item as played via the create/update media progress endpoint
    PATCH api/me/progress/a4352c2a-3163-4609-b047-8b2773e29e6b/88562dab-c0ed-45f7-a664-cdfb0bb81497
{
  "currentTime": 1090.5861224489795,
  "duration": 1090.5861224489795,
  "isFinished": true,
  "progress": 1
}

a4352c2a-3163-4609-b047-8b2773e29e6b is the podcast id
88562dab-c0ed-45f7-a664-cdfb0bb81497 is the episode id
e15a0745-8289-4dc9-91b3-50e4955c2438 is the the session id

Bildschirmfoto 2023-10-15 um 16 56 17

Here only two matches are found

@rasmuslos commented on GitHub (Oct 15, 2023): Ok, so I managed to replicate it, but only on my main server, not one I setup just to test this. Maybe this is related to the database migration? If progress is only reported using the session endpoint or the create update media endpoint everything works fine ## Managed to replicate on main server: 1. Start a listening session `POST` `api/items/f756025e-f463-4a5b-952c-3de365e8d6a6/play/d2637f9e-0b47-44a2-b35c-3f3ff57e26b7` ``` { "deviceInfo": { "clientName": "Audiobooks iOS" }, "supportedMimeTypes": ["audio/flac", "audio/mpeg", "audio/mp4", "audio/aac", "audio/x-aiff"] } ``` 2. Report progress to the session endpoint `POST` `api/session/b20ee258-7dfd-4f75-be2b-64cbd50e39e5/sync` ``` { "timeListened": 5.4028099775314331, "currentTime": 0.59915390099999999, "duration" : 174.00163265306122 } ``` 3. Mark the item as played via the create/update media progress endpoint `PATCH` `api/me/progress/f756025e-f463-4a5b-952c-3de365e8d6a6/d2637f9e-0b47-44a2-b35c-3f3ff57e26b7` ``` { "isFinished": true, "progress": 1, "currentTime": 174.00163265306122, "duration" : 174.00163265306122 } ``` `f756025e-f463-4a5b-952c-3de365e8d6a6` is the podcast id `d2637f9e-0b47-44a2-b35c-3f3ff57e26b7` is the episode id `b20ee258-7dfd-4f75-be2b-64cbd50e39e5` is the the session id <img width="1728" alt="Bildschirmfoto 2023-10-15 um 16 56 47" src="https://github.com/advplyr/audiobookshelf/assets/49640416/026aa600-be92-4c93-93a5-801c53e84d3e"> _`4 Treffer` translates to 4 matches_ ## Not working on my development server: 1. Start a listening session `POST` `api/items/a4352c2a-3163-4609-b047-8b2773e29e6b/play/88562dab-c0ed-45f7-a664-cdfb0bb81497` ``` { "deviceInfo": { "clientName": "Audiobooks iOS" }, "supportedMimeTypes": ["audio/flac", "audio/mpeg", "audio/mp4", "audio/aac", "audio/x-aiff"] } ``` 2. Report progress to the session endpoint `POST` `api/session/e15a0745-8289-4dc9-91b3-50e4955c2438/sync` ``` { "duration": 1090.5861224489795, "currentTime": 0.52575628100000005, "timeListened": 1.6900789737701416 } ``` 3. Mark the item as played via the create/update media progress endpoint `PATCH` `api/me/progress/a4352c2a-3163-4609-b047-8b2773e29e6b/88562dab-c0ed-45f7-a664-cdfb0bb81497` ``` { "currentTime": 1090.5861224489795, "duration": 1090.5861224489795, "isFinished": true, "progress": 1 } ``` `a4352c2a-3163-4609-b047-8b2773e29e6b` is the podcast id `88562dab-c0ed-45f7-a664-cdfb0bb81497` is the episode id `e15a0745-8289-4dc9-91b3-50e4955c2438` is the the session id <img width="1728" alt="Bildschirmfoto 2023-10-15 um 16 56 17" src="https://github.com/advplyr/audiobookshelf/assets/49640416/146c660e-34c5-43af-9dd5-f99d03a2b76f"> _Here only two matches are found_
Author
Owner

@advplyr commented on GitHub (Oct 15, 2023):

I can't think of any reason why this would happen

This is where media progress is created/updated from session syncs: https://github.com/advplyr/audiobookshelf/blob/cdd740015c2daa08e870090f35a8e42a28c55042/server/managers/PlaybackSessionManager.js#L283

This is where media progress is created/updated from the api/me/progress/ api endpoint: https://github.com/advplyr/audiobookshelf/blob/cdd740015c2daa08e870090f35a8e42a28c55042/server/controllers/MeController.js#L87

@advplyr commented on GitHub (Oct 15, 2023): I can't think of any reason why this would happen This is where media progress is created/updated from session syncs: https://github.com/advplyr/audiobookshelf/blob/cdd740015c2daa08e870090f35a8e42a28c55042/server/managers/PlaybackSessionManager.js#L283 This is where media progress is created/updated from the `api/me/progress/` api endpoint: https://github.com/advplyr/audiobookshelf/blob/cdd740015c2daa08e870090f35a8e42a28c55042/server/controllers/MeController.js#L87
Author
Owner

@rasmuslos commented on GitHub (Oct 15, 2023):

So I have create a backup of my server and restored it and I think the problem is now resolved... This makes no sense.

I would suggest closing the issue as this is apparently not reproducibly and has no clear cause... If it happens again I can open it again and look into it further

@rasmuslos commented on GitHub (Oct 15, 2023): So I have create a backup of my server and restored it and I _think_ the problem is now resolved... This makes no sense. I would suggest closing the issue as this is apparently not reproducibly and has no clear cause... If it happens again I can open it again and look into it further
Author
Owner

@rasmuslos commented on GitHub (Apr 5, 2024):

So apparently this happened again to @tehguitarist while he was using ShelfPlayer. He also has a library that was migrated to the new database system, so my guess is that this is a prerequisite. I looked at the code again and found that ShelfPlayer includes the property isFinished in the api/me/progress request, while the session endpoint does not. Could this be the cause?

@rasmuslos commented on GitHub (Apr 5, 2024): So apparently this happened again to @tehguitarist while he was using ShelfPlayer. He also has a library that was migrated to the new database system, so my guess is that this is a prerequisite. I looked at the code again and found that ShelfPlayer includes the property `isFinished` in the `api/me/progress` request, while the session endpoint does not. Could this be the cause?
Author
Owner

@advplyr commented on GitHub (Apr 5, 2024):

I don't think so, is it with a specific book or episode? There is a known issue on an older version of Abs where 2 copies of media progress are in the database. That can be tested by deleting the progress on the web client using the small x button.

image

There is also cache on the server side, that should be cleared automatically but I need more info to look into it.

@advplyr commented on GitHub (Apr 5, 2024): I don't think so, is it with a specific book or episode? There is a known issue on an older version of Abs where 2 copies of media progress are in the database. That can be tested by deleting the progress on the web client using the small x button. ![image](https://github.com/advplyr/audiobookshelf/assets/67830747/84926266-f0bc-4a64-bfa8-77c07a5910ce) There is also cache on the server side, that should be cleared automatically but I need more info to look into it.
Author
Owner

@rasmuslos commented on GitHub (Apr 5, 2024):

Apparently the issue can be resoled by reseting the progress using the app or web client, but it seems like this happens with all items. I don't know specific details, so take this with a grain of salt.

The solution right now is that ShelfPlayer has a opt in feature that checks for multiple progress entities for the same item and deletes the oldest ones.

@rasmuslos commented on GitHub (Apr 5, 2024): Apparently the issue can be resoled by reseting the progress using the app or web client, but it seems like this happens with all items. I don't know specific details, so take this with a grain of salt. The solution right now is that ShelfPlayer has a opt in feature that checks for multiple progress entities for the same item and deletes the oldest ones.
Author
Owner

@advplyr commented on GitHub (Apr 5, 2024):

If that is the same bug it was with a server version maybe 9 months ago that would only impact a very small number of users. It's so minor that I didn't write an extra script to check for this on server start, I just asked those few users to discard the progress for that item.
It may not be the same issue though if it is impacting many items for many users because this was very specific.

@advplyr commented on GitHub (Apr 5, 2024): If that is the same bug it was with a server version maybe 9 months ago that would only impact a very small number of users. It's so minor that I didn't write an extra script to check for this on server start, I just asked those few users to discard the progress for that item. It may not be the same issue though if it is impacting many items for many users because this was very specific.
Author
Owner

@tehguitarist commented on GitHub (Apr 6, 2024):

Hey, I'm trying to get this to reliably replicate. Here are some of the details of the most recent book it happened to:

My initial server version was around the v2.1 mark, possibly 2.0?
Book was added to the library about the 31st of October - I keep ABS up to date within a week or so of updates, so this would have been v2.5 or v2.6
I was listening to the book nearly exclusively in a downloaded state using ShelfPlayer. This was a combination of online, offline, and listening sessions where I would be offline, but listening across days.
This initial listening session only started a few weeks ago, so the book was unplayed until then.
Doing a quick test where I skipped to the end of a book (streaming, not downloaded) did not cause the issue to pop up again.

I'm currently a few hours until the end of a book I'm listening to in a similar manner so will try and see if it happens again.

@tehguitarist commented on GitHub (Apr 6, 2024): Hey, I'm trying to get this to reliably replicate. Here are some of the details of the most recent book it happened to: My initial server version was around the v2.1 mark, possibly 2.0? Book was added to the library about the 31st of October - I keep ABS up to date within a week or so of updates, so this would have been v2.5 or v2.6 I was listening to the book nearly exclusively in a downloaded state using ShelfPlayer. This was a combination of online, offline, and listening sessions where I would be offline, but listening across days. This initial listening session only started a few weeks ago, so the book was unplayed until then. Doing a quick test where I skipped to the end of a book (streaming, not downloaded) did not cause the issue to pop up again. I'm currently a few hours until the end of a book I'm listening to in a similar manner so will try and see if it happens again.
Author
Owner

@rasmuslos commented on GitHub (Apr 23, 2024):

It started happening again...

Bildschirmfoto 2024-04-23 um 20 08 56

I will look into it, maybe I will find the cause this time

@rasmuslos commented on GitHub (Apr 23, 2024): It started happening again... <img width="408" alt="Bildschirmfoto 2024-04-23 um 20 08 56" src="https://github.com/advplyr/audiobookshelf/assets/49640416/5fbaf1b6-4b91-4826-a4ba-e8d874c8e3c6"> I will look into it, maybe I will find the cause this time
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#1460