Unable to delete File - Please check your permissions

@UsamaWaheed said:
Hi sa2000,

Thanks for the prompt reply and help. I ran the OpenedFilesView and found that the particular file that I was trying to delete via the PMS Web page was opened by another system (vmware-vmx.exe). I have multiple VMs running for different purposes and one of it was interfering. I shut off the particular VMs (Shared-Folder features in VM to be exact) and all is good.

Thanks and sorry for the trouble :smile:

Thanks for the feedback - so you effectively had multiple systems sharing the same media and one of these systems licked out another

I finally had a chance to look at this some. When I noticed a file not being able to be deleted, I checked OpenedFilesView per @sa2000 's request and saw that the show I was trying to delete is open by 3 instances of ā€œPlexScriptHost.exeā€. I also confirmed this with LockHunter just to make sure. The version of PMS I am currently testing this on is 1.8.1.4139.

@changelin said:
I finally had a chance to look at this some. When I noticed a file not being able to be deleted, I checked OpenedFilesView per @sa2000 's request and saw that the show I was trying to delete is open by 3 instances of ā€œPlexScriptHost.exeā€. I also confirmed this with LockHunter just to make sure. The version of PMS I am currently testing this on is 1.8.1.4139.

Good to know but it does mean we need the zipped logs which would include all the PlexScriptHost agent logs and server logs and would also need to see the OpenedFilesView output to establish which log relates to which open file instance

So please one more time with OpenedFilesViewer and when you hit the problem save the output into a csv or xlsx and get all the server logs and i will look into it and then refer to the development team

same issue here. Upwards of 3 PlexScriptHost instances all locking the same file.
The issue only occurs after I have completed watching. After the streaming is stopped.
I have reviewed all the logs, and this is the only thing I can find after a couple delete attempts:
Sep 11, 2017 20:46:27.066 [4016] ERROR - SHFileOperationW returned 0x20 for FO_DELETE on ā€˜Z:\Recorded TV\Series\Real Rob\Season 01\Real Rob S01E07 What’s My Thing.mkv’. Falling back to deleting file.
Sep 11, 2017 21:00:29.919 [11948] WARN - Unable to load episode file [seasons\1\episodes\7.xml]
Sep 11, 2017 21:00:33.447 [0304] ERROR - SHFileOperationW returned 0x20 for FO_DELETE on ā€˜Z:\Recorded TV\Series\Real Rob\Season 01\Real Rob S01E07 What’s My Thing.mkv’. Falling back to deleting file.

So even 15 minutes after ending streaming of media, it’s still locked.

Issue began with version 1.7.5.4035 but has continued through to 1.8.4.4249

FYI, you can use Windows Performance Monitor to view file access, but you have to enable the Maintain Object Files List global flag.
https://technet.microsoft.com/en-us/library/cc732490(v=ws.11).aspx

Where would the PlexScriptHost agent logs be? I can’t find anything with that name.
None of the logs in %programdata%\Plex Media Server\Logs have anything useful other than the snippet above.

looks like it… might be this?

Sep 12, 2017 20:35:08.979 [17864] DEBUG - Spawned plug-in com.plexapp.agents.thetvdb with PID 14900
Sep 12, 2017 20:35:08.980 [17864] DEBUG - [com.plexapp.agents.thetvdb] Sending command: GET /:/prefixes

Sep 12, 2017 20:35:08.996 [17016] DEBUG - Activity: registered new activity df18966d-36e9-4249-a851-06329a175cb8 - Processing subscriptions
Sep 12, 2017 20:35:08.998 [17016] INFO - Notification: Library scan complete - Extra information may still be downloading from the Internet
Sep 12, 2017 20:35:09.002 [2348] DEBUG - Activity: registered new activity c3eaf471-2d65-4377-b677-2f8d919fcfe0 - Processing subscriptions
Sep 12, 2017 20:35:09.003 [2348] DEBUG - DVR:Subscription: Scheduling subscriptions.
Sep 12, 2017 20:35:09.004 [2348] DEBUG - DVR:Subscription: Initialized 0 schedulers.
Sep 12, 2017 20:35:09.005 [2348] DEBUG - DVR:Subscription: Starting with 0 grabs, scheduled 0 active ones preemptively.
Sep 12, 2017 20:35:09.005 [2348] DEBUG - DVR:Subscription: Scheduled all subscriptions in 1 ms.
Sep 12, 2017 20:35:09.005 [2348] DEBUG - Activity: Ended activity c3eaf471-2d65-4377-b677-2f8d919fcfe0.
Sep 12, 2017 20:35:09.006 [2348] DEBUG - DVR:Subscription: There are 0 grabs at the end.
Sep 12, 2017 20:35:09.007 [2348] DEBUG - Activity: Ended activity df18966d-36e9-4249-a851-06329a175cb8.

But per that, it completed in less than a second.

PlexScriptHost with PID 14900 was locking the file.
Media was added to library this morning.
Streaming completed at about 20:39.
About 15 deletion attempts from 20:40-20:41 with 0x20 error.
Finally released lock at some time after 20:54.

I turned off debug logging prior to the release though.

18:39 - American Horror Story locked by PID 19408
19:10 - AHS still locked
19:43 - AHS is no longer locked.

19:43 - Midnight, Texas locked by PIDs 17956 and 6732.
20:12 - Midnight still locked
20:42 - Midnight no longer locked

20:42 - Real Rob locked by PID 8996
21:03 - Real Rob still locked
21:09 - Real Rob no longer locked.

zipped up logs (with debug) attached.

These PIDs are all related to com.plexapp.agents.thetvdb

Did not use OpenFilesView but assume you just need PID of the process.

Thanks @j-sta for the detailed analysis. I will examine the logs later today

Issue still occurs in 1.9.1.4272
Seems like it may not be quite as frequent, but still occurring.

I also found that the issue is also happening in the latest version 1.9.2.4285.

Is his the same bug that is talked about here forums.plex.tv/discussion/289731/bug-cant-delete-show-when-dvr-is-recording

Unknown. That’s on the dam elite forum for elite members only.

@rodgerzeisler said:
Is his the same bug that is talked about here forums.plex.tv/discussion/289731/bug-cant-delete-show-when-dvr-is-recording

The thread you linked is about issues with the DVR and not being able to delete files. In this thread we are all having issues just deleting files with no DVR being used (or even discussed). Mostly it seems because PlexScriptHost.exe is locking them in Windows. Your issues with the DVR may be caused by a similar issue though. If it’s possible, could you check to see what process is locking your files when they become undeletable? Do you still have the same issues if you roll back to version 1.7.2.3878?

… and this is getting quite tedious - and more frequent is the need to restart the server. Pretty soon I’m going to stop believing this can be fixed and chalk it up to yet another ā€˜feature’ Plex can’t call operational.

A Partial Long List of **** Plex can’t fix:
Automatic Updates for Network Shares
A Refresh Metadata Feature that actually Refreshes the Metadata
Locked Metadata Fields that actually lock
and now
Delete Media from a Client (day of last reliable operation - July 12, 2017 - Rest in Peace)

posted in error…never mind.

6 restarts required in the last 24 hours.

I think we can officially call this feature - gone.

@JuiceWSA said:
6 restarts required in the last 24 hours.

I think we can officially call this feature - gone.

Are there any major features or compelling reasons to upgrade past 1.7.2.3878? I too have noticed that every time a new update comes in, the delete option is still broken. I really prefer to be on the latest versions, but rolling back to 1.7.2.3878 100% fixes the issue every time.

I don’t know, but I’m not rolling back that far.

Latest stable for me is 1.5.5 :smiley:

Notable Mention:
October 22 was the day of the ā€˜6 Restarts In 24 Hours’ requirement mentioned above.
October 22 was also the day of the big explosion at Plex.tv wherein no one could log in.
Since then I haven’t had to restart the server. Walking on glass. Awaiting the dropping of the other shoe.

… at the risk of jinxing it - several days now and all is well.
I wonder if the work on Plex.tv had anything to do with it?