Closed edifris closed 7 months ago
Sorry for the delay. I somehow missed this. Starting to dive in.
I have seen this behavior myself, but only in Sonarr, in both versions 3 and 4.
I still don't have it pinned down yet, because as you pointed out, it happen sporadically. However, I have a theory.
I think that when downloading multiple files at once (say, when you search for an entire TV show season) there is a race condition that can occur where the Sonarr show is refreshed while the mkvmerge task is still running, which adds the .tmp
file to the list of "extra files" in the episode database. After mkvmerge completes it sends a delete command to Sonarr for the episode, but because Sonarr now knows about both the original episode file and the temporary file, it deletes both. I don't know why this is causing Sonarr to hang, but I confirm that it does.
I have uploaded a new development version of the script where I've changed the temporary file naming logic that hopefully will keep it out of the Sonarr database. I'm still testing.
If you want to use this version of the script, please stop your container and change your DOCKER_MODS
variable to:
DOCKER_MODS=thecaptain989/radarr-striptracks:develop
Then restart your container.
I was going to comment that it broke Radarr for me, but the latest commit seems to have fixed it hopefully.
I was going to comment that it broke Radarr for me, but the latest commit seems to have fixed it hopefully.
Yeah, I've been fighting it, as you can tell. I found the actual source of the hang and permanently fixed that, then I also reworked the temporary filename generation anyway because the temporary file was still being deleted sometimes, broke it, and re-fixed it again. 😝 It seems stable for me now, though. I'm going to keep it in develop
for a bit more before merging just to be sure. Let me know how it goes.
P.S. - This issue has been disappearing and reappearing in GitHub every few days. No idea what that's about.
Sometimes (especially with bigger files) it seems mkvmerge doesn't finish and then the file gets deleted instead. It correctly moves the file to the media folder, starts mkvmerge then when the file is 95% finished it gives up and deletes both the original and the .tmp file. This then confuses Sonarr/Radarr and it stops importing files altogether until restart. MKVmerge has exit code of 0 though which seems to imply it ran correctly. In my bin I've got a 6.2GB original file and 6GB .tmp.