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

Show does not delete after "Take action after days" = 0 #1140

Open
truncsphere opened this issue Jun 21, 2024 · 29 comments
Open

Show does not delete after "Take action after days" = 0 #1140

truncsphere opened this issue Jun 21, 2024 · 29 comments

Comments

@truncsphere
Copy link

Describe the bug
I have a rule that deletes stale shows that haven't been watched in over 1 year. Currently 2 shows fit this description. I have watched the countdown reach 0 twice and neither time did it delete the show. Instead the logs show it's been removed from the collection and then it re-adds and restarts the timer.

Expected behavior
To delete said shows after 30 days.

Screenshots
image

Device (please complete the following information):

  • Maintainerr version 2.0.4

Other notes
I have a rule to delete movies not watched after X years and it removes these with no issues.

@adampetrovic
Copy link

adampetrovic commented Jun 22, 2024

Also have the same problem, running on both older versions and the most recent version. The logs aren't overly helpful. I can see there's a problem but it's just logging out a generic error.

[maintainerr] | 22/06/2024 03:49:52  [WARN] [OverseerrGetterService] Couldn't get addUser from Overseerr
[maintainerr] | 22/06/2024 03:49:52  [DEBUG] [OverseerrGetterService] Cannot read properties of undefined (reading 'seasonNumber')
[maintainerr] | 22/06/2024 03:50:04  [DEBUG] [undefined] GET request failed: AxiosError: Request failed with status code 500
[maintainerr] | 22/06/2024 03:50:04  [WARN] [OverseerrGetterService] Couldn't get addUser from Overseerr
[maintainerr] | 22/06/2024 03:50:04  [DEBUG] [OverseerrGetterService] Cannot read properties of undefined (reading 'seasonNumber')
[maintainerr] | 22/06/2024 03:50:12  [DEBUG] [undefined] GET request failed: AxiosError: Request failed with status code 500

@jorenn92
Copy link
Owner

Hey, something else re-adds the media. Mostly this is a due to Overseerr’s auto watchlist download feature. Make sure something like that isn’t enabled

@adampetrovic
Copy link

Overseerr works off the Plex Watchlist. None of these items are on that list.

screenshot_2024_06_22_19_07_43

@truncsphere
Copy link
Author

I don't use watchlists with Overseer so the media is not being re-added. It never gets deleted.

@truncsphere
Copy link
Author

Any update on this issue?

@jorenn92
Copy link
Owner

Hey, Sorry for the late reply. I haven't seen any related reports and haven't been able to replicate this myself. So i'm actually unsure what's going on. Do you happen to have logs from Plex, Sonarr, and perhaps Overseerr during the deletion timeframe?

I think it has something to do with a failure to fetch the tvdb id, which is used for removal through Sonarr. Altough it should log a message when this is the case.

This error is due to a failure while fetching the tvdb ID from tmdb. But there are a few fallback mechanisms, so it's possible one of those did find the ID.
[maintainerr] | 22/06/2024 03:50:12 [DEBUG] [undefined] GET request failed: AxiosError: Request failed with status code 500

@truncsphere
Copy link
Author

So this just happened to happen again this morning. Shows got removed by Maintainer, but are still on Plex. The shows were re-added and the counter started again at 30 days.

I check Sonarr logs and didn't see anything around the time these were supposed to be deleted. The closest I found was below
2024-07-16 08:58:47.8|Info|RefreshEpisodeService|Starting episode info refresh for: [341164][Yellowstone (2018)] 2024-07-16 08:58:48.4|Info|RefreshEpisodeService|Finished episode refresh for series: [341164][Yellowstone (2018)]. 2024-07-16 08:58:48.4|Info|DiskScanService|Scanning Yellowstone (2018) 2024-07-16 08:58:48.4|Info|DiskScanService|Completed scanning disk for Yellowstone (2018)

Overseer shows the following
image

However these are just refreshes and nothing re-downloaded to my server.

@jorenn92
Copy link
Owner

I pushed a few changes that might fix your issue. If not, it'll hopefully log more 'debug' level info this time,

You can try it out with the 'ghcr.io/jorenn92/maintainerr:main' image. This image gets build after each git change.
I don't recommend to stay on it for long, since this image might not stay stable, and after big changes you might not always be able to roll back to the latest release version. However, for now it'll be safe.

@truncsphere
Copy link
Author

I pushed a few changes that might fix your issue. If not, it'll hopefully log more 'debug' level info this time,

You can try it out with the 'ghcr.io/jorenn92/maintainerr:main' image. This image gets build after each git change. I don't recommend to stay on it for long, since this image might not stay stable, and after big changes you might not always be able to roll back to the latest release version. However, for now it'll be safe.

I just installed the main version. Will let you know in 4 days what happens.

@truncsphere
Copy link
Author

truncsphere commented Jul 22, 2024

@jorenn92 Unfortunately the same thing is occurring. Here is what the logs show.

[maintainerr] | 22/07/2024 00:00:00  [INFO] [TasksService] Task Collection Handler is waiting for task Rule Handler to finish...
[maintainerr] | 22/07/2024 00:00:01  [INFO] [RuleExecutorService] Executing rules for ' To be Deleted'
[maintainerr] | 22/07/2024 00:00:05  [INFO] [RuleExecutorService] Execution of rules for ' To be Deleted' done.
[maintainerr] | 22/07/2024 00:00:05  [INFO] [RuleExecutorService] Synced collection ' To be Deleted' with Plex
[maintainerr] | 22/07/2024 00:00:05  [INFO] [RuleExecutorService] Executing rules for 'Stale Shows'
[maintainerr] | 22/07/2024 00:00:08  [INFO] [RuleExecutorService] Execution of rules for 'Stale Shows' done.
[maintainerr] | 22/07/2024 00:00:08  [INFO] [RuleExecutorService] Synced collection 'Stale Shows' with Plex
[maintainerr] | 22/07/2024 00:00:11  [INFO] [CollectionWorkerService] Start handling all collections
[maintainerr] | 22/07/2024 00:00:11  [INFO] [CollectionWorkerService] Handling collection ' To be Deleted'
[maintainerr] | 22/07/2024 00:00:11  [INFO] [CollectionWorkerService] Handling collection ' To be Deleted' finished
[maintainerr] | 22/07/2024 00:00:11  [INFO] [CollectionWorkerService] Handling collection 'Stale Shows'
[maintainerr] | 22/07/2024 00:00:11  [INFO] [CollectionsService] Removing media with id 309852 from collection..
[maintainerr] | 22/07/2024 00:00:16  [INFO] [SonarrApi] Unmonitored season(s)  from Sonarr show with ID 180
[maintainerr] | 22/07/2024 00:00:16  [INFO] [CollectionWorkerService] [Sonarr] Unmonitored show 'The Rig (2023)' and removed all episodes
[maintainerr] | 22/07/2024 00:00:16  [INFO] [CollectionsService] Removing media with id 308105 from collection..
[maintainerr] | 22/07/2024 00:00:16  [INFO] [PlexApiService] Removed collection from Plex
[maintainerr] | 22/07/2024 00:00:18  [INFO] [SonarrApi] Unmonitored season(s)  from Sonarr show with ID 129
[maintainerr] | 22/07/2024 00:00:18  [INFO] [CollectionWorkerService] [Sonarr] Unmonitored show 'Yellowstone (2018)' and removed all episodes
[maintainerr] | 22/07/2024 00:00:18  [INFO] [CollectionWorkerService] Handling collection 'Stale Shows' finished
[maintainerr] | 22/07/2024 00:00:25  [INFO] [CollectionWorkerService] All collections handled. Triggered Overseerr's availability-sync because media was altered
[maintainerr] | 22/07/2024 04:20:00  [INFO] [RuleMaintenanceService] Starting maintenance
[maintainerr] | 22/07/2024 04:20:01  [INFO] [RuleMaintenanceService] Maintenance done
[maintainerr] | 22/07/2024 08:00:00  [INFO] [RuleExecutorService] Starting Execution of all active rules
[maintainerr] | 22/07/2024 08:00:02  [INFO] [RuleExecutorService] Executing rules for ' To be Deleted'
[maintainerr] | 22/07/2024 08:00:08  [INFO] [RuleExecutorService] Execution of rules for ' To be Deleted' done.
[maintainerr] | 22/07/2024 08:00:08  [INFO] [RuleExecutorService] Synced collection ' To be Deleted' with Plex
[maintainerr] | 22/07/2024 08:00:08  [INFO] [RuleExecutorService] Executing rules for 'Stale Shows'
[maintainerr] | 22/07/2024 08:00:11  [INFO] [RuleExecutorService] Adding 2 media items to 'Stale Shows'.
[maintainerr] | 22/07/2024 08:00:11  [WARN] [PlexApiService] Couldn't find collection with id 321689
[maintainerr] | 22/07/2024 08:00:11  [INFO] [CollectionsService] Creating collection in Plex..
[maintainerr] | 22/07/2024 08:00:11  [INFO] [CollectionsService] Adding media with id 309852 to collection..
[maintainerr] | 22/07/2024 08:00:11  [INFO] [CollectionsService] Adding media with id 308105 to collection..
[maintainerr] | 22/07/2024 08:00:11  [INFO] [RuleExecutorService] Execution of rules for 'Stale Shows' done.
[maintainerr] | 22/07/2024 08:00:11  [INFO] [RuleExecutorService] Synced collection 'Stale Shows' with Plex

@jorenn92
Copy link
Owner

jorenn92 commented Jul 23, 2024

Unfortunately, the above log seems fine. It successfully unmonitored the show and removed all episodes. At least, the API calls to Sonarr were successful from Maintainer's point of view.

Did you enable the 'DEBUG=true' flag in your environment variables? If not, maybe that'll give us some more info. If you did enable it, it looks like everything went alright.

Also, could you check the history of an episode of these shows in Sonarr to make sure it wasn't redownloaded?

I did push some minor changes today, one of which fixes a small issue where seasons would stay monitored while the show is unmonitored. But I don't think this has any functional impact, since Sonarr wouldn't download episodes of an unmonitored show anyway.

@truncsphere
Copy link
Author

I did not have DEBUG enabled.

Sonarr does not re-download the shows (I would get a notification at several stages of the download/addition to Plex).

I've deleted the shows manually for now.

@jorenn92
Copy link
Owner

jorenn92 commented Aug 9, 2024

Okay, hopefully you won't run into it again! But If you do, could you share a log file when the DEBUG flag has been set?

@DataBitz
Copy link

DataBitz commented Aug 21, 2024

I'm seeing a similar problem, the files are deleted from disks and it is removed from Sonarr. However the problem is that the TV shows are still showing in Plex, though when I try to play a show the files are unavailable.
When I rerun the rules in maintainerr I think it is picking up the unavailable TV shows from Plex.
Still testing but this may help if anyone else hits this.

@DataBitz
Copy link

Another quick update, I have " Empty trash automatically after every scan" in Plex Library settings disabled.
Once I emptied the trash in Plex manually it stopped coming back.

@jorenn92
Copy link
Owner

Another quick update, I have " Empty trash automatically after every scan" in Plex Library settings disabled. Once I emptied the trash in Plex manually it stopped coming back.

Good catch! I can confirm your theory: If the item is still showing in Plex, Maintainerr assumes it's still available, which is why it keeps coming back.

@DataBitz
Copy link

What's the solution in the scenario, could maintainerr be set-up to take into account if the content is available or not?

@jorenn92
Copy link
Owner

What's the solution in the scenario, could maintainerr be set-up to take into account if the content is available or not?

I could explore a way for Maintainerr to check if any files are associated with the Plex item, assuming Plex updates its file path to be empty. However, I don't have the time to implement this right now. For the foreseeable future, Plex servers should be configured to always reflect the actual state.

@DataBitz
Copy link

Ok
The reason automatic garbage collection is disabled, is that if there is a problem with the media storage, it stops Plex doing a cleanup automatically and removing the history etc.

@appiekap653
Copy link
Contributor

appiekap653 commented Sep 12, 2024

I have a similar problem. Mostly with movies.
When the timer in maintainerr reaches 0, maintainerr logs shows this:

Screenshot_20240904_174720_Firefox.jpg

When looking at Radarr, there are no API calls to remove the files and delete the movie from Radarr.

It seems like maintainerr is just skipping the whole Radarr part but removes the movie from itself, then at the next scan, he re-adds the movie again.
Occasionally the logs from Maintainerr shows removed come fly with me (like on 8-8-2024 in above screenshot), but does not show Successfully handled come fly with me.

This has been happening for a long time now in multiple maintainerr versions.

When looking at the XML from Plex for this movie, it does have all the necessary IDs:

<Guid id="imdb://tt29081098"/>
<Guid id="tmdb://1165403"/>
<Guid id="tvdb://349372"/>

@jorenn92
Copy link
Owner

I

I have a similar problem. Mostly with movies. When the timer in maintainerr reaches 0, maintainerr logs shows this:

Screenshot_20240904_174720_Firefox.jpg

When looking at Radarr, there are no API calls to remove the files and delete the movie from Radarr.

It seems like maintainerr is just skipping the whole Radarr part but removes the movie from itself, then at the next scan, he re-adds the movie again. Occasionally the logs from Maintainerr shows removed come fly with me (like on 8-8-2024 in above screenshot), but does not show Successfully handled come fly with me.

This has been happening for a long time now in multiple maintainerr versions.

When looking at the XML from Plex for this movie, it does have all the necessary IDs:

<Guid id="imdb://tt29081098"/>
<Guid id="tmdb://1165403"/>
<Guid id="tvdb://349372"/>

Do you have logs of these executions as well? This looks quite bizarre. It seems that something else is removing the item from the collection between runs, which causes Maintainer to re-add it. (However, when manually removed from the Plex collection, Maintainerr should create an exclusion)

Regarding the 'Removed ...' log line without a corresponding 'Successfully handled ...' message: This can occur if the item no longer matches the rule criteria before the removal takes place. In such cases, the item is removed again, and you'll only see the 'removed' message.

@macstainless
Copy link

I'm running into this issue as well. I have a library of YouTube videos that is exhibiting the same behavior. Items will get removed and then re-added to the collection. They are not getting deleted. Here is an example. You can see this is getting removed and then re-added daily:

Screenshot 2024-10-17 at 11 48 05 AM

@ydkmlt84
Copy link
Collaborator

I'm running into this issue as well. I have a library of YouTube videos that is exhibiting the same behavior. Items will get removed and then re-added to the collection. They are not getting deleted. Here is an example. You can see this is getting removed and then re-added daily:

Screenshot 2024-10-17 at 11 48 05 AM

Are you seeing anything in your Sonarr logs? Are there any entries about deleting or failure to delete? This has happened to a few people in the past, and the answer was usually a change to the hostname they were using in the Sonarr/Radarr settings of Maintainerr. I even had this problem when I started because I was using the docker container hostname. When I switched to the IP address it started to work. Even though my connection test were coming back as successful.

@macstainless
Copy link

I'm running into this issue as well. I have a library of YouTube videos that is exhibiting the same behavior. Items will get removed and then re-added to the collection. They are not getting deleted. Here is an example. You can see this is getting removed and then re-added daily:
Screenshot 2024-10-17 at 11 48 05 AM

Are you seeing anything in your Sonarr logs? Are there any entries about deleting or failure to delete? This has happened to a few people in the past, and the answer was usually a change to the hostname they were using in the Sonarr/Radarr settings of Maintainerr. I even had this problem when I started because I was using the docker container hostname. When I switched to the IP address it started to work. Even though my connection test were coming back as successful.

In my situation, my YouTube Plex library is not associated with Sonarr, so there's no logs. Those items are imported via a script into my Plex library. My understanding is Maintainarr isn't dependent on the item being located in Sonarr / Radarr and will delete from Plex as long as it meets the criteria in the library.

Copy link
Contributor

This issue has been marked stale because it has been 30 days with no activity.

@github-actions github-actions bot added the stale When something hasn't had any activity in a while. label Nov 18, 2024
@benscobie
Copy link
Collaborator

In my situation, my YouTube Plex library is not associated with Sonarr, so there's no logs. Those items are imported via a script into my Plex library. My understanding is Maintainarr isn't dependent on the item being located in Sonarr / Radarr and will delete from Plex as long as it meets the criteria in the library.

Hi @macstainless, that should be the case yes. I presume you have Allow media deletion enabled in Plex?

@github-actions github-actions bot removed the stale When something hasn't had any activity in a while. label Nov 20, 2024
@macstainless
Copy link

In my situation, my YouTube Plex library is not associated with Sonarr, so there's no logs. Those items are imported via a script into my Plex library. My understanding is Maintainarr isn't dependent on the item being located in Sonarr / Radarr and will delete from Plex as long as it meets the criteria in the library.

Hi @macstainless, that should be the case yes. I presume you have Allow media deletion enabled in Plex?

Yes I do have that enabled on Plex.

@lediszep
Copy link

I have the same issue, media is not being deleted for the past months is there a solution or has it been fixed?

@ydkmlt84
Copy link
Collaborator

I have the same issue, media is not being deleted for the past months is there a solution or has it been fixed?

I would like to see what we can get figured out on Discord. Mind coming over there and we can take a look?

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

No branches or pull requests

10 participants