Serviio Service will not Stop in a timely manner
Do a mass rename on say 10 video files (or the associated poster/cover/etc.), Force Rescan of the Shares or Force Refresh of Metadata. (any or all of the above)
Attempt to rename one of the most recently renamed or added videos, associated graphic or containing folder. You get the the FILE IN USE message and cannot rename or move or delete. So, in the past, I would just stop the Serviio service (in Windows - not the Serviio Console) which releases all file locks and then make the remainder of my changes unimpaired by frustrating file locks. Finally, I Start the Serviio Service and go to shares and Force Refresh. Recently this has been unsuccessful.
The truly salient question is WHY DO YOU NEED TO OPEN THE FILES READ/WRITE and LOCK THE FILES to Refresh(Shares) or Rescan(Metadata) and update the library? In Windows, the normal FILE/OPEN API defaults to READ/WRITE and creates a File Handle LOCK but If you add the extra parameters, you may open them READ ONLY preventing a File Handle Lock and life would be much better!
So just recently. STOP the Serviio service. (alternatively, from a cmd prompt, Net Stop Serviio). The Serviio service progress bar gets to about halfway stopped very quickly and then crawls. Eventually, Services issues the message "The Serviio service did not stop in a timely manner" rather than finishing with the service in a clean stopped state. This leaves the Serviio service in an indeterminite state. The buttons for Start, Stop, etc. are grayed out and unavailable because Windows cannot determine the server state. The file locks remain and it leaves the DLNA server in a dicey state such that it may or may not respond to DLNA Clients (Service not available in KODI or it may only work for selected videos or it may continue to work, for example).
In an attempt to resolve the service state impasse, I have gone into Process Explorer (an advanced Task Manager replacement available from Microsoft) and attempted to restart the Serviio Serivce process threads (akin to taking a crowbar and a sledgehammer to a service) - well it just doesn't end well. The Serviio service apparently restarts after a message that the process may no longer work due to different credentials (I am the Administrator, not just a user with Administrative privilege). Windows Services continues to show the Serviio service in an indeterminite state (yes I did refresh). The DLNA Client can no longer access the Serviio DLNA Server which I expected due to the message during process restart. The only answer at this point is to RESTART WINDOWS. This is not the desirable behavior to say the least!!!!
Apparently, the only answer is to keep trying whatever you are trying to do until the file lock releases. This is frustrating in the extreme!!!!
AGAIN, If it is necessary to open the files READ/WRITE, WHY? What if I force the video files to be READ ONLY? What effect will this have on FILE LOCKS?
Perhaps an answer is to reset the credentials for Serviio Service to a USER which has only the PERMISSIONS "READ & EXECUTE", "LIST FOLDER CONTENTS" and "TRAVERSE FOLDER EXECUTE FILE" for the folder tree(s) containing the Videos? Such Draconian measures should prevent FILE LOCKS but this is not a simple solution for most users of Windows. Such Draconian measures may also prevent certain features of the DLNA Client from working or perhaps Serviio will not function properly at all.
I will presume that the processes that scan for file changes and metadata need software changes so that when the Serviio service is requested to be stopped, those processes/threads stop immediately irrespective of waits for Internet timeouts, perhaps set a progress checkpoint and permit the Serviio service to stop within the Windows timeout for services state change requests thereby stopping in a timely manner. When the service is restarted, those processes should resume from the checkpoint or maybe just restart altogether but with a large collection of videos, this could mean a lot of time getting back to the checkpoint. For +5K videos, Metadata RESCAN can literally take hours.
A request: Is there some way that you can indicate the progress for a REFRESH (Shares) or RESCAN (Metadata) in the Console or progress of those associated activies when Videos are added/deleted/renamed? Perhaps a simple option to post REFRESH START/STOP, RESCAN START/STOP, etc in a log file for diagnostic purposes?