Unable to delete File - Please check your permissions

@JuiceWSA

Yes because it resets all lock handles when you restart PMS. And then the issue happens again.

I am well aware.

Lets get more diagnostics please

As I understand it, it is not specific to DVR and applies to all TV Shows libraries.

There was nothing in thetvd agent log to indicate that it was doing anything for the file that was locked out and showed in Opened Files Viewer

So I need to establish if that is a common theme - or we have different causes

@sa2000 said:
Lets get more diagnostics please

As I understand it, it is not specific to DVR and applies to all TV Shows libraries.

There was nothing in thetvd agent log to indicate that it was doing anything for the file that was locked out and showed in Opened Files Viewer

So I need to establish if that is a common theme - or we have different causes

I am currently out of town so I cannot provide logs. But I can say that for me it seems to happen when I am watching a show and sometime during that show a new episode or more gets added to the server. Once that happens the episode is locked until I restart. I hope that helps you to be able to recreate the bug. Also, I have not ever used the DVR function.

That follows with what just happened. Was watching E7 of Doc Martin. Stopped to add E8. Watched and deleted E7, but had to restart to delete E8.

I can’t confirm that’s how it always happens, but this time it did.

As for my case, Sonarr is the one notifying Plex to do a library scan. So the idea that while watching and a new episode of the same series gets added could be a possible cause to the issue. I can’t confirm 100% but I can try and recreate it.

@sa2000 said:
Lets get more diagnostics please

As I understand it, it is not specific to DVR and applies to all TV Shows libraries.

There was nothing in thetvd agent log to indicate that it was doing anything for the file that was locked out and showed in Opened Files Viewer

So I need to establish if that is a common theme - or we have different causes

But in the Plex Media Server.log it does notate that thetvdb agent was spawned, and does provide the corresponding PIDs that are shown to be accessing the files.
This shows the same thing as the last time I provided logs. The corresponding PIDs, that are shown to be locking/accessing the files, are reported in the Plex Media Server.log.

So it could be that this file had been locked since 18:25
Streaming started at 18:25 and ended up at 18:46 per plexpy
Nov 06, 2017 18:25:42.878 [1776] DEBUG - Spawned plug-in com.plexapp.agents.thetvdb with PID 11248

This file could have been locked since 18:58
Started streaming at 18:48 and ended up 19:09 per plexpy
Nov 06, 2017 18:58:49.920 [16100] DEBUG - Spawned plug-in com.plexapp.agents.thetvdb with PID 13524

So the agents are getting spawned, regardless of whether or not they are doing anything, and locking the files.

It also does not matter how long the media has been in the library. Could be a day old, could be 6 months old.

I’ll try to collect more files tomorrow.
I wouldn’t say it’s easily reproducable though. It’s truly random. It doesn’t occur every time. For example, tonight it only occurred on half the shows.

As for DrivePool… there’s been a number of posts related to this same issue. I also thought it was DrivePool at one point, as there was an issue with DP though that was resolved.
At the same time, the processes that are accessing the files and preventing them from being deleted, are Plex processes. So that would rule out DrivePool since it’s been proven to be caused by a Plex process.

@j-sta
Before the new process for the agent is spawned, the existing would have been killed / terminated

Nov 06, 2017 18:25:42.878 [1776] DEBUG - Spawned plug-in com.plexapp.agents.thetvdb with PID 11248

Nov 06, 2017 18:55:55.854 [8784] DEBUG - Putting plug-in com.plexapp.agents.thetvdb to sleep.
Nov 06, 2017 18:55:55.854 [8784] DEBUG - Stopping [com.plexapp.agents.thetvdb].
Nov 06, 2017 18:55:55.854 [8784] DEBUG - [com.plexapp.agents.thetvdb] Killing.

Nov 06, 2017 18:58:49.920 [16100] DEBUG - Spawned plug-in com.plexapp.agents.thetvdb with PID 13524

The agent logs thetvdb are not showing any related information for this TV Show / Series / Episode

I have not been able to reproduce the issue. There may be some specific timing

As the logs are not showing when the file is being opened by thetvdb process, i can only think of having SysInternals Process Monitor running and to capture all events (which would include all file accesses) - but ProcMon does use up system resources and one should not leaving it running for very long time. If you can get ProcMon event capture to log when the file was opened and together with the Opened Files Viewer output and logs - may be can get closer.

I tried adding episodes and then deleting but have not had a fail. The only file open i recorded was by the localmedia agent and not thetvdb. I am running the test with default settings for agents

@kevindd992002 said:
As for my case, Sonarr is the one notifying Plex to do a library scan. So the idea that while watching and a new episode of the same series gets added could be a possible cause to the issue. I can’t confirm 100% but I can try and recreate it.

I have just heard that Sonarr could be configured to update the library when media is added.

@JuiceWSA said:
That follows with what just happened. Was watching E7 of Doc Martin. Stopped to add E8. Watched and deleted E7, but had to restart to delete E8.

I can’t confirm that’s how it always happens, but this time it did.

Could you get me logs and output from Opened Files Viewer ?
You can set it to auto refresh every 5 seconds and see when the file gets opened
Could you do the test with the new public release 1.9.6.4429

@changelin said:

@sa2000 said:
Lets get more diagnostics please

As I understand it, it is not specific to DVR and applies to all TV Shows libraries.

There was nothing in thetvd agent log to indicate that it was doing anything for the file that was locked out and showed in Opened Files Viewer

So I need to establish if that is a common theme - or we have different causes

I am currently out of town so I cannot provide logs. But I can say that for me it seems to happen when I am watching a show and sometime during that show a new episode or more gets added to the server. Once that happens the episode is locked until I restart. I hope that helps you to be able to recreate the bug. Also, I have not ever used the DVR function.

I have tried to do that to reproduce the problem and failed.
May be it is to do wit specific agent configuration or specific timing

I don’t know what you’re talking about. I do not have the skills necessary. I am a user. Not a coder.

@JuiceWSA said:
I don’t know what you’re talking about. I do not have the skills necessary. I am a user. Not a coder.

well - logs you know how to capture. I am just adding one extra bit - well 2 extra bits - which i will explain and hoping it is doable

  1. Update to the new public release of Plex Media Server - version 1.9.6.4429
  2. Download OpenedFilesView tool from OpenedFilesView - View opened/locked files in your system (sharing violation issues)
    There are 3 download options to choose from, either downloading a zip and you unzip and then run the extracted exe file or download the setup exe which then installs it as a program
  3. When reproducing the issue, restart the server to get fresh logs (usual stuff)
  4. Run the OpenedFileView program. Select Options in the top menu and then Auto-Refresh and from that select every 5-seconds
  5. Reproduce the error
  6. Save the OpenedFilesView data: Menu : File, Save All Items, Save As Type: comma delimited text file (csv), enter a filename to save to
  7. Capture the Plex Media Server logs
  8. zip the csv file saved for the OpenedFilesView data
  9. Attach logs zip and OFV csv file zip
  10. Close OpenedFilesView

@sa2000 said:

@kevindd992002 said:
As for my case, Sonarr is the one notifying Plex to do a library scan. So the idea that while watching and a new episode of the same series gets added could be a possible cause to the issue. I can’t confirm 100% but I can try and recreate it.

I have just heard that Sonarr could be configured to update the library when media is added.

Yes, using a post-processing script.

@JuiceWSA said:
I don’t know what you’re talking about. I do not have the skills necessary. I am a user. Not a coder.

With this kind of attitude, we will go nowhere with this issue. We are all users. You can get Plex logs, you have a lot of guides that are not for the average home user in your signature, so why not exert extra effort in getting the logs that @sa2000 need? He is asking you for the logs and output from a program that you simply need to download and install. Do you really need to be a ā€œcoderā€ to do that? C’mon! You expect solutions to be spoonfed to you.

@sa2000 said:
I tried adding episodes and then deleting but have not had a fail. The only file open i recorded was by the localmedia agent and not thetvdb. I am running the test with default settings for agents

It could be that the issue only occurs during/after the media is streamed.
I cannot say that I have tried to delete a file that I had not just watched.

Of course, maybe you did do that and it just wasn’t clearly stated.

I will work on getting procmon logs this evening.

Well here’s another openedfilesview and Plex logs.
I might need to filter the ProcMon log, as the PML file is at 24 gigs. Trying to ZIP, and it’s sitting at just over 1 hour remaining and I have no idea how big the zip will be.
Chicago PD, tried deleting at 21:55

Upgrade from 1.5.5 to 1.9.7 and it’s great to see this is still an issue… locking files all over the place… unable to delete transcoded temp files. Just great. Not helpful you say? Well, I don’t care anymore. That’s what you have done to me, Plex v1.x. I don’t have time anymore.

I think the general misconception is that I can re-create this issue any time I want. If I could do that it should be easy for anyone to do it - a developer might even be able to do it.

I just got Version 1.9.6.4429 a few minutes ago.
If I have time today, I’ll try to re-create this RANDOM, MYSTERIOUS, DIFFICULT TO NAIL DOWN ISSUE - and if I can re-create it on demand, I’ll tell ya’ll how I did it.

Right now - the power company is having issues maintaining the local power grid, I’ve got about 9 hours of Autocad work to try to get to drop box between outages (while listening to the melodic tones of a UPS screaming bloody murder).

I got my hands full at the moment.

lol

@j-sta said:
Well here’s another openedfilesview and Plex logs.
I might need to filter the ProcMon log, as the PML file is at 24 gigs. Trying to ZIP, and it’s sitting at just over 1 hour remaining and I have no idea how big the zip will be.
Chicago PD, tried deleting at 21:55

Thanks

PML files zip very well - it should get to about 8% of the size of the PML

Could you also let me have the SubZero plugin logs as well (in the Logs\PMS Plugin Logs folder)
Logs for user added plugins are not included in the zipped logs

@j-sta said:
Well here’s another openedfilesview and Plex logs.
I might need to filter the ProcMon log, as the PML file is at 24 gigs. Trying to ZIP, and it’s sitting at just over 1 hour remaining and I have no idea how big the zip will be.
Chicago PD, tried deleting at 21:55

And if you have not deleted the item yet, could you let me have the xml returned from this request
http://localhost:32400/hubs/metadata/33145/postplay?X-Plex-Token=xxxxxxxxxxxxxxxxxxx

And the media info xml
http://localhost:32400/library/metadata/33145?X-Plex-Token=xxxxxxxxxxxxxxxxxxx

And the xml from
http://localhost:32400/library/metadata/33145?checkFiles=1&includeExtras=1&includeRelated=1&includeRelatedCount=1&X-Plex-Token=xxxxxxxxxxxxxx

where the xxxxxxxxxxxxxxxx is the server token which you can find in the settings in the registry or following info on this support article
https://support.plex.tv/hc/en-us/articles/204059436-Finding-an-authentication-token-X-Plex-Token

Well I I had deleted it… I did restore it though, since it was still in the recycle bin.
I can provide the same XMLs for a different show that locked, but not the one included in the log files.

The PML, even compressed, was going to be around 500mb.
I added a couple filters to remove some stuff that should be completely unrelated (eg, explorer.exe)
Working on that now.

So I noticed… XML for Chicago PD is under 33195, not 33145.
View XML from Media Info goes here: /library/metadata/33195?checkFiles=1&includeExtras=1&X-Plex-Token=
At least, now it does.
Though I do see in the log files that it was 33145

33145 was the episode - which has a parent id and a grandparent id
The requests that were being made were for the episode which is what I wanted to see

Anything you filter out of the PML file must not have a path value for the episode file

Upload zip to dropbox or google drive etc and send me link by PM

The xml I want is that for the metadata number that shows on the DELETE /library/metadata/xxxxx line

If you give me other episode xml - then I would need the full set of logs to look into the id’s and how they got referenced

@sa2000 said:
33145 was the episode - which has a parent id and a grandparent id
The requests that were being made were for the episode which is what I wanted to see

Anything you filter out of the PML file must not have a path value for the episode file

Upload zip to dropbox or google drive etc and send me link by PM

The xml I want is that for the metadata number that shows on the DELETE /library/metadata/xxxxx line

If you give me other episode xml - then I would need the full set of logs to look into the id’s and how they got referenced

is the episode a singular unique ID that doesn’t change if the episode is removed and re-added?
2 are identical and all 3 are only a single-line long. These are for 33145.

PostPlay:
MediaContainer size=ā€œ0ā€ allowSync=ā€œ0ā€ identifier=ā€œcom.plexapp.plugins.libraryā€></MediaContainer

the 2 in the library folder:
MediaContainer size=ā€œ0ā€ identifier=ā€œcom.plexapp.plugins.libraryā€ mediaTagPrefix=ā€œ/system/bundle/media/flags/ā€ mediaTagVersion=ā€œ1509120104ā€></MediaContainer

Still working on the PML.
PML file size only dropped 2 gigs; to 22gb total.
Attempting to ZIP, which is currently at >930mb in size and about 79% complete.