[Bug]: Multiple instances of library scan which do not complete. #2430

Open
opened 2026-04-25 00:07:02 +02:00 by adam · 8 comments
Owner

Originally created by @grv688 on GitHub (Dec 19, 2024).

What happened?

Within the last few versions / during modest growth of my library, scheduled scans of the library have begun failing to complete. Clicking on the active tasks icon at the top of the page and canceling each task sometimes causes them to terminate, but this is not always true. Restarting the container (docker on Ubuntu 24.04 LTS managed with Portainer) also works. Upon restarting the container, a manually initiated library scan will complete, but the problem eventually returns.

In the logs, the "scan" items that are present look to complete, but I do see running scans in the UI as described.

This can happen with my modest Podcast library or my larger Audiobook library. My libraries are mounted NFS shares on the Ubuntu server.

I have about 4,300 items in my library, comprised of about 25,600 tracks.

The folder watcher is enabled for the library as well as hourly scans, so that could be a conflict. With that said, it has always been that way, even before the problem started.

image

What did you expect to happen?

Library scans eventually complete, even for larger libraries.

Steps to reproduce the issue

  1. Start the container.
  2. Configure hourly scans and watched folder for library/libraries.
  3. Wait.

Audiobookshelf version

2.17.5

How are you running audiobookshelf?

Docker

What OS is your Audiobookshelf server hosted from?

Linux

If the issue is being seen in the UI, what browsers are you seeing the problem on?

Chrome

Logs

2024-12-19 13:01:56.923

INFO

[LibraryScanner] Library scan "922e0d20-c93f-495b-aa92-1288c6b6a03d" completed in 1:56.0 | 0 Added | 0 Updated | 0 Missing

2024-12-19 13:01:56.954

INFO

[LibraryScan] Scan log saved "/metadata/logs/scans/2024-12-19_922e0d20-c93f-495b-aa92-1288c6b6a03d.txt"

2024-12-19 14:00:00.220

INFO

[LibraryScanner] Starting library scan a0371066-b69d-4c3e-a9e9-7e9d0192d60d for Podcasts

2024-12-19 14:00:00.227

INFO

[LibraryScanner] Starting library scan 7d796acc-068c-40b0-9003-dd8e1c000533 for Audiobooks

2024-12-19 14:00:02.952

INFO

[LibraryScanner] Library scan "a0371066-b69d-4c3e-a9e9-7e9d0192d60d" completed in 0:02.0 | 0 Added | 2 Updated | 0 Missing

2024-12-19 14:00:02.977

INFO

[LibraryScan] Scan log saved "/metadata/logs/scans/2024-12-19_a0371066-b69d-4c3e-a9e9-7e9d0192d60d.txt"

2024-12-19 14:00:42.440

INFO

[LibraryScanner] Library scan "7d796acc-068c-40b0-9003-dd8e1c000533" completed in 0:42.0 | 0 Added | 0 Updated | 0 Missing

2024-12-19 14:00:42.471

INFO

[LibraryScan] Scan log saved "/metadata/logs/scans/2024-12-19_7d796acc-068c-40b0-9003-dd8e1c000533.txt"

Additional Notes

No response

Originally created by @grv688 on GitHub (Dec 19, 2024). ### What happened? Within the last few versions / during modest growth of my library, scheduled scans of the library have begun failing to complete. Clicking on the active tasks icon at the top of the page and canceling each task sometimes causes them to terminate, but this is not always true. Restarting the container (docker on Ubuntu 24.04 LTS managed with Portainer) also works. Upon restarting the container, a manually initiated library scan will complete, but the problem eventually returns. In the logs, the "scan" items that are present look to complete, but I do see running scans in the UI as described. This can happen with my modest Podcast library or my larger Audiobook library. My libraries are mounted NFS shares on the Ubuntu server. I have about 4,300 items in my library, comprised of about 25,600 tracks. The folder watcher is enabled for the library as well as hourly scans, so that could be a conflict. With that said, it has always been that way, even before the problem started. ![image](https://github.com/user-attachments/assets/65796006-8aa7-4665-b51e-00bb01daaf35) ### What did you expect to happen? Library scans eventually complete, even for larger libraries. ### Steps to reproduce the issue 1. Start the container. 2. Configure hourly scans and watched folder for library/libraries. 3. Wait. ### Audiobookshelf version 2.17.5 ### How are you running audiobookshelf? Docker ### What OS is your Audiobookshelf server hosted from? Linux ### If the issue is being seen in the UI, what browsers are you seeing the problem on? Chrome ### Logs ```shell 2024-12-19 13:01:56.923 INFO [LibraryScanner] Library scan "922e0d20-c93f-495b-aa92-1288c6b6a03d" completed in 1:56.0 | 0 Added | 0 Updated | 0 Missing 2024-12-19 13:01:56.954 INFO [LibraryScan] Scan log saved "/metadata/logs/scans/2024-12-19_922e0d20-c93f-495b-aa92-1288c6b6a03d.txt" 2024-12-19 14:00:00.220 INFO [LibraryScanner] Starting library scan a0371066-b69d-4c3e-a9e9-7e9d0192d60d for Podcasts 2024-12-19 14:00:00.227 INFO [LibraryScanner] Starting library scan 7d796acc-068c-40b0-9003-dd8e1c000533 for Audiobooks 2024-12-19 14:00:02.952 INFO [LibraryScanner] Library scan "a0371066-b69d-4c3e-a9e9-7e9d0192d60d" completed in 0:02.0 | 0 Added | 2 Updated | 0 Missing 2024-12-19 14:00:02.977 INFO [LibraryScan] Scan log saved "/metadata/logs/scans/2024-12-19_a0371066-b69d-4c3e-a9e9-7e9d0192d60d.txt" 2024-12-19 14:00:42.440 INFO [LibraryScanner] Library scan "7d796acc-068c-40b0-9003-dd8e1c000533" completed in 0:42.0 | 0 Added | 0 Updated | 0 Missing 2024-12-19 14:00:42.471 INFO [LibraryScan] Scan log saved "/metadata/logs/scans/2024-12-19_7d796acc-068c-40b0-9003-dd8e1c000533.txt" ``` ### Additional Notes _No response_
adam added the bugunable to reproduce labels 2026-04-25 00:07:02 +02:00
Author
Owner

@nichwall commented on GitHub (Dec 19, 2024):

Can you enable Debug logs in the server settings? That will give a lot more information as to what is going on.

@nichwall commented on GitHub (Dec 19, 2024): Can you enable Debug logs in the server settings? That will give a lot more information as to what is going on.
Author
Owner

@grv688 commented on GitHub (Dec 19, 2024):

I had filtered to INFO in the GUI for the logs in Settings, but DEBUG was already on. I have the last couple days of "scan" and "daily" logs at DEBUG level. There are a lot of scan logs due to the hourly nature. Do you want me to attach it all here? Thanks for your help.

@grv688 commented on GitHub (Dec 19, 2024): I had filtered to INFO in the GUI for the logs in Settings, but DEBUG was already on. I have the last couple days of "scan" and "daily" logs at DEBUG level. There are a lot of scan logs due to the hourly nature. Do you want me to attach it all here? Thanks for your help.
Author
Owner

@nichwall commented on GitHub (Dec 19, 2024):

Yeah, if you could attach one of each log, that would be good. It is generally nice to embed it so it's easier to read, but since you have so many items it may be easier to just attach the file.

Does the periodic scan take longer to run than the time between your periodic scans? I wonder if it's something like the scan takes so long, a new one starts, so now two things are trying to access the library over the network, then 3 things, etc. but that doesn't explain why a manual library scan works.

@nichwall commented on GitHub (Dec 19, 2024): Yeah, if you could attach one of each log, that would be good. It is generally nice to embed it so it's easier to read, but since you have so many items it may be easier to just attach the file. Does the periodic scan take longer to run than the time between your periodic scans? I wonder if it's something like the scan takes so long, a new one starts, so now two things are trying to access the library over the network, then 3 things, etc. but that doesn't explain why a manual library scan works.
Author
Owner

@grv688 commented on GitHub (Dec 19, 2024):

When I run a manual scan it completes within a minute or so, so I don't think the hourly scans are stepping on each other. I am not sure what the monitored folder feature does, exactly, so it is possible that the scheduled scans and monitoring feature are conflicting in some way. I hate to make it even more cumbersome, but the daily logs exceed the size limit I can include here, so I've attached a zip file with two daily logs and today's scan logs. Please let me know if there's more you need.

Thank you.

abs_logs.zip

@grv688 commented on GitHub (Dec 19, 2024): When I run a manual scan it completes within a minute or so, so I don't think the hourly scans are stepping on each other. I am not sure what the monitored folder feature does, exactly, so it is possible that the scheduled scans and monitoring feature are conflicting in some way. I hate to make it even more cumbersome, but the daily logs exceed the size limit I can include here, so I've attached a zip file with two daily logs and today's scan logs. Please let me know if there's more you need. Thank you. [abs_logs.zip](https://github.com/user-attachments/files/18200330/abs_logs.zip)
Author
Owner

@advplyr commented on GitHub (Jan 9, 2025):

I added a message to the schedule library scan tab since there is often confusion about this.

In general, if the folder watcher works for your file system you should not have scheduled library scans enabled. It shouldn't be an issue if you do but it adds unnecessary overhead if the watcher is listening to changes and the scanner is continually running.

image

I'm not sure about the issue you are having but this should help explain what the folder watcher is

@advplyr commented on GitHub (Jan 9, 2025): I added a message to the schedule library scan tab since there is often confusion about this. In general, if the folder watcher works for your file system you should not have scheduled library scans enabled. It shouldn't be an issue if you do but it adds unnecessary overhead if the watcher is listening to changes and the scanner is continually running. ![image](https://github.com/user-attachments/assets/35c09c8f-c0d2-4fc8-916c-acc725dfb837) I'm not sure about the issue you are having but this should help explain what the folder watcher is
Author
Owner

@grv688 commented on GitHub (Jan 10, 2025):

Thanks. I had noticed both the scheduled scan and folder watcher were on a while back and turned the watcher off. It almost seems like a UI thing. When I log in, I see a dozen or so scans running on the status bar like in my screenshot. I refresh the page, and things appear idle. It's not as if the scans were actually still running, maybe?

@grv688 commented on GitHub (Jan 10, 2025): Thanks. I had noticed both the scheduled scan and folder watcher were on a while back and turned the watcher off. It almost seems like a UI thing. When I log in, I see a dozen or so scans running on the status bar like in my screenshot. I refresh the page, and things appear idle. It's not as if the scans were actually still running, maybe?
Author
Owner

@nichwall commented on GitHub (Jan 10, 2025):

In general, if the folder watcher works for your file system you should not have scheduled library scans enabled. It shouldn't be an issue if you do but it adds unnecessary overhead if the watcher is listening to changes and the scanner is continually running.

Is there ever a case where someone should use the file watcher and have periodic scans enabled?

Maybe it is worth making them mutually exclusive on the same tab so people can't enable them both, and keep the text you added here for explaining it. I realize having both enabled should not cause any problems, but may help with removing edge cases.

@nichwall commented on GitHub (Jan 10, 2025): > In general, if the folder watcher works for your file system you should not have scheduled library scans enabled. It shouldn't be an issue if you do but it adds unnecessary overhead if the watcher is listening to changes and the scanner is continually running. Is there ever a case where someone should use the file watcher and have periodic scans enabled? Maybe it is worth making them mutually exclusive on the same tab so people can't enable them both, and keep the text you added here for explaining it. I realize having both enabled should not cause any problems, but may help with removing edge cases.
Author
Owner

@advplyr commented on GitHub (Jan 10, 2025):

I'm not sure if there is a use-case for it. If the pattern continues despite the note I added we can make further tweaks.
I think we should add an information tooltip for the library settings enable watcher. We have one for the global enable watcher setting which I just realized may not need a server restart anymore like the tooltip says.

@advplyr commented on GitHub (Jan 10, 2025): I'm not sure if there is a use-case for it. If the pattern continues despite the note I added we can make further tweaks. I think we should add an information tooltip for the library settings enable watcher. We have one for the global enable watcher setting which I just realized may not need a server restart anymore like the tooltip says.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#2430