"Could not downloading artwork" / "Renaming temp file failed"
#1
Hello all,

I am brand new to TinyMM, and so apologies in advance if this is a stupid question. I know ahead of time there's a good chance it's something I'm doing wrong...

I recently started working through a list of movies, adding all the cool data that TinyMM offers. Poster images, cast, IMDb info, etc.

In some cases, it works perfectly. In others, I get the errors listed in the subject - particularly when it comes to images. The poster, anything in the Artwork tab. Is it something I'm doing wrong? A setting I have failed to change?

Any advice would be greatly appreciated. Thanks in advance!
#2
in 99% of all cases there are permission-problem when moving/copying the temp files (from the systems temp folder) to the movie folder; please check the access permissions!
tinyMediaManager - THE media manager of your choice - available for Windows, macOS and Linux
Help us translate tinyMediaManager at Weblate | Translations at 66%
Found a bug or want to submit a feature request? Contact us at GitLab
#3
I also had the same issue with downloading a poster, but most of the time it's with a video file.
Renaming with a different path fails only for a video file while other files moves to the new folder, and the error says the file is being used by another process. I am pretty sure the process using the file is tmm's own process because it always works after relaunching tmm.
Other symptoms with the same cause include that external HDDs refuse to disconnect, which gets immediately resolved if tmm is closed. Also you cannot delete a video file from a folder, which gets possible if tmm is closed.
This doesn't happen often, but keeps happening from time to time. This is new with v3 (on Windows 10) since I never had this issue with v2.
#4
(2020-05-08, 11:26)tars Wrote: I also had the same issue with downloading a poster, but most of the time it's with a video file.
Renaming with a different path fails only for a video file while other files moves to the new folder, and the error says the file is being used by another process. I am pretty sure the process using the file is tmm's own process because it always works after relaunching tmm.
Other symptoms with the same cause include that external HDDs refuse to disconnect, which gets immediately resolved if tmm is closed. Also you cannot delete a video file from a folder, which gets possible if tmm is closed.
This doesn't happen often, but keeps happening from time to time. This is new with v3 (on Windows 10) since I never had this issue with v2.

I have the same problem once in a while. Restarting TMM seems to solve it.
#5
(2020-05-08, 10:12)mlaggner Wrote: in 99% of all cases there are permission-problem when moving/copying the temp files (from the systems temp folder) to the movie folder; please check the access permissions!

Thank you for the response!

This whole issue is quite likely to be due to a failure of mine to understand some technical aspect or another, honestly. 

When I look at the Security tab of my Temp folder, it lists SYSTEM, my name/e-mail, and Administrators in the top area, and in the bottom area marked "Permissions for Administrators" all Allow boxes are ticked (and greyed out) except Special Permissions at the very bottom. This is the case no matter which user I select. Does this mean that access permissions should be working correctly and something else might be the issue, or is any part of that not as it should be? Is this TinyMM process counted as a 'Special Permission'?
#6
I've just reviewed much code which is involved in writing files and I have not found any piece of code which does not release the file descriptors..

could you please try to exactly guide me where it happens, that tmm locks files from being moved/unmounted/... maybe there is still some hidden code which is not clean (and searching > 100k lines of code without any hint does not make any sense)
tinyMediaManager - THE media manager of your choice - available for Windows, macOS and Linux
Help us translate tinyMediaManager at Weblate | Translations at 66%
Found a bug or want to submit a feature request? Contact us at GitLab
#7
Could it be the play button on the details tab that's not releasing the file sometimes?
I'm not 100% sure since I can't reproduce it intentionally but I think most of the time before that happens I was using the button at least once to check the file.
#8
(2020-05-09, 11:31)mlaggner Wrote: I've just reviewed much code which is involved in writing files and I have not found any piece of code which does not release the file descriptors..

could you please try to exactly guide me where it happens, that tmm locks files from being moved/unmounted/... maybe there is still some hidden code which is not clean (and searching > 100k lines of code without any hint does not make any sense)

Thank you for checking it out, I appreciate it. As I mentioned before, my lack of knowledge here is the most likely source of the issue, and this is backed up by the fact that it seems to be working now.

Previously, NFO files for some films were not automatically being created, and I would guess that is why the posters kept failing to download. I realised there was a separate(?) issue with the letters assigned to the two external SSDs on which I keep my movies. Plug them in, take them out, plug them in again, and they would end up with new, random designations. This meant that when I told TinyMM to look at E: and F:, for example, it would dutifully do so but sometimes that would be incorrect and therefore add confusion.

I fixed that, and I tentatively now believe I am able to work through my list of movies without additional problems. It takes a long time, but it will be worth it when I'm finished!

I'm a bit worried about finishing then adding one more film then trying to get TinyMM to find that one additional entry, because I don't want to scan the whole drive again (it will re-introduce a bunch of nonsense I'll have to manually delete all over again), but I'll deal with that when I get to it. Smile
#9
@tars kinda hard to identify the problem since there are no file locks left over here at my linux machine.. and as long as we do not find any reproducable example we won't have any success here.
I suppose you are using windows? IIRC windows has more problem with those left over file descriptors than linux, but I do not have any windows machine to test here.
Nevertheless I will review all parts of the code which do have direct access to files and make sure they close the file descriptors
tinyMediaManager - THE media manager of your choice - available for Windows, macOS and Linux
Help us translate tinyMediaManager at Weblate | Translations at 66%
Found a bug or want to submit a feature request? Contact us at GitLab
#10
(2020-05-09, 17:23)mlaggner Wrote: @tars kinda hard to identify the problem since there are no file locks left over here at my linux machine.. and as long as we do not find any reproducable example we won't have any success here.
I suppose you are using windows? IIRC windows has more problem with those left over file descriptors than linux, but I do not have any windows machine to test here.
Nevertheless I will review all parts of the code which do have direct access to files and make sure they close the file descriptors

I am using Windows 10 Pro. I also attached a log here: https://gitlab.com/tinyMediaManager/tiny...issues/877
#11
(2020-05-09, 17:23)mlaggner Wrote: @tars kinda hard to identify the problem since there are no file locks left over here at my linux machine.. and as long as we do not find any reproducable example we won't have any success here.
I suppose you are using windows? IIRC windows has more problem with those left over file descriptors than linux, but I do not have any windows machine to test here.
Nevertheless I will review all parts of the code which do have direct access to files and make sure they close the file descriptors

Yes, I am running Windows 10.
I just had the same issue again. Only the video file kept refusing to move with the error "The process cannot access the file because it is being used by another process" logged when I tried renaming several times. Then I played the video file again using the play button on the details tab. After that, rename command worked and the file moved to the new folder.
I will try using the button again when the same issue occurs like refusing to disconnect external HDDs and to delete video files to see if that fixes. I'd suggest other Windows users trying the same rather than restarting tmm.
#12
I am unsure why tmm should keep open handles if you play movies (which invokes the systems media player for playing...)

could you try to analyze which process is keeping the file handle open using sysinternals? (https://docs.microsoft.com/de-de/sysinte...s-explorerhttps://stackoverflow.com/questions/1570...in-windows)
tinyMediaManager - THE media manager of your choice - available for Windows, macOS and Linux
Help us translate tinyMediaManager at Weblate | Translations at 66%
Found a bug or want to submit a feature request? Contact us at GitLab
#13
I had two chances to test it so far. But even though tmm failed to move the video files with the same "being used by another process" error message, there's was no file handle open with those files. So they were not locked. After that, running rename command worked in both cases.
But I remember I had video files locked by tmm before. If such a case happens again, I will let you know after analyzing it.
#14
Found it. It's subtitle search.
Each time you open "search subtitle" window, tmm (javaw.exe) gets two file handles for the video file. And it takes a while for each handle to get released even after the window was closed.
If you open the window several times for the same movie due to a sync issue, then it gets lots of file handles for the same video file.
The problem occurs if you try to move the video file or disconnect the HDD because the file is now completely locked until all those file handles get released.
#15
looks like there is a bug in Java itself (https://stackoverflow.com/questions/1306...map-method); we had the "right" coding to release the file channel, but Java did not release it itself
I've added a change to force releasing it and I could not reproduce the issue any more
tinyMediaManager - THE media manager of your choice - available for Windows, macOS and Linux
Help us translate tinyMediaManager at Weblate | Translations at 66%
Found a bug or want to submit a feature request? Contact us at GitLab

Logout Mark Read Team Forum Stats Members Help
"Could not downloading artwork" / "Renaming temp file failed"0