thetvdb - random failures serializing

Hi there,

 

I've posted this in the Ask a Ninja forum but thought there would be some relevant expertise here too!

 

I have 0.9.8.18 PMS installed on my Windows 7 old laptop which runs 24 / 7 in a cupboard.

 

I use thetvdb metadata agent for my TV Shows. Initially when I begain using Plex just over a year ago I never had any issues with downloading metadata for either brand new shows or when new episodes were being added - metadata was added successfully.

 

What I have been seeing for about 2 or 3 months now is not consistent, which is infuriating. Sometimes when a new episode is added to a show, Plex will detect the episode fine and thtvdb metadata agent will identify it and attempt to add the show metadata. This fails and causes the metadata for the whole show to go bad.

 

Where it all goes wrong is in thetvdb logs:

2014-01-18 08:53:20,273 (1cc8) : CRITICAL (core:561) - Exception serializing TV_Show with guid 'com.plexapp.agents.thetvdb://75710?lang=en' (most recent call last):
File "D:\PLEX\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\modelling\model.py", line 179, in _write
self._serialize(os.path.join(self._storage_path, subdir))
File "D:\PLEX\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\modelling\model.py", line 209, in _serialize
attr_el = attr._serialize(os.path.join(path, name))
File "D:\PLEX\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\modelling\attributes.py", line 285, in _serialize
shutil.rmtree(path)
File "D:\PLEX\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\subsystem\ospathfix.py", line 81, in shutil_rmtree
return shutil._rmtree(longpathify(uni(path)), ignore_errors, onerror)
File "C:\Program Files\Plex\Plex Media Server\python27.zip\shutil.py", line 247, in rmtree
rmtree(fullname, ignore_errors, onerror)
File "D:\PLEX\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\subsystem\ospathfix.py", line 81, in shutil_rmtree
return shutil._rmtree(longpathify(uni(path)), ignore_errors, onerror)
File "C:\Program Files\Plex\Plex Media Server\python27.zip\shutil.py", line 247, in rmtree
rmtree(fullname, ignore_errors, onerror)
File "D:\PLEX\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\subsystem\ospathfix.py", line 81, in shutil_rmtree
return shutil._rmtree(longpathify(uni(path)), ignore_errors, onerror)
File "C:\Program Files\Plex\Plex Media Server\python27.zip\shutil.py", line 247, in rmtree
rmtree(fullname, ignore_errors, onerror)
File "D:\PLEX\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\subsystem\ospathfix.py", line 81, in shutil_rmtree
return shutil._rmtree(longpathify(uni(path)), ignore_errors, onerror)
File "C:\Program Files\Plex\Plex Media Server\python27.zip\shutil.py", line 256, in rmtree
onerror(os.rmdir, path, sys.exc_info())
File "C:\Program Files\Plex\Plex Media Server\python27.zip\shutil.py", line 254, in rmtree
os.rmdir(path)
File "D:\PLEX\Plex Media Server\Plug-ins\Framework.bundle\Contents\Resources\Versions\2\Python\subsystem\ospathfix.py", line 152, in os_rmdir
return os._rmdir(longpathify(uni(path)))
WindowsError: [Error 145] The directory is not empty: u'\\\\?\\D:\\PLEX\\Plex Media Server\\Metadata\\TV Shows\\5\\dacc15e214010f53d3e43ce5d5415299d53146b.bundle\\Contents\\com.plexapp.agents.thetvdb\\seasons\\3\\episodes\\12' 

The full log for thetvdb metadata agent is attached. If anyone would like to look at any other logs please let me know.

 

The whole metadata for a show is eventually lost when this happens as serializing ie. writing to disk cannot happen. The directory quoted, when I check, is definitely empty. This can happen with any show in any TV library section I have setup. I have to delete the contents of com.plex.agents.thetvdb in order to refresh the show and get the metadata to download correctly. It then serializes the data correctly and we're all set for that show, until a new episode downloads (or I refresh data) a few days or weeks later and we're back to square one.

 

I have googled the bejaysus out of this error message and have tried quite a number of things: disable antivirus, disable windows defender, uninstall any old backup software etc that I'm not using. I've disabled bonjour, network sharing of that folder or drive, I've disabled anything that even looks like an automated scan or that would cause Python / Plex to think that a directory is not empty when it is. I have run a detailed disk check of my laptops HD but not a single error came up. I've reset bundles, uninstalled and reinstalled thetvdb metadata agent, cleaned bundles, optimized library etc. I found I had an old-ish version of python installed on the computer so I uninstalled this, no change unfortunately. I have absolutely no problem with any other metadata agents, such as opensubtitles, imdb etc. Always serializes and never a bother. It's just thetvdb metadata agent.

 

Its not 100% consistent. If 5 new TV Shows downloaded last night, sometimes serializing will fail for 4 of them but not one. This last week I thought I had fixed the issue by moving my Plex localdata folder to the D drive (different partition on same physical disk). It was fine for a few days then the issue came back. This was after a forced reboot for Windows update, so I'm wondering if rebooting might have triggered this.

 

I've seen one or two posts in the Plex forums that included the "Directory not empty" error message but unfortunately I've not found a solution. About a year ago someone reported a bug like this for thetvdb metadata agent but it was apparently fixed. My version of thetvdb metadata agent is up to date.  

 

Does anyone please have any ideas! Is this a Python issue? Something else wrong with my computer? A bug in thetvdb metadata agent? I'm going nuts! Thank you.

This is occurring for me in both the TV section with TheTVDB, an in the movies section with The Movie Database.  Interestingly enough, Freebase will find the movie, but whether metadata is actually download can be a crap shoot. With TheTVDB and The Movie Database, when they go south for a series or movie they will always return an error message instantaneously after trying to fix an incorrect match for a show that states that no matches can be found on their server.  This is something that started around the beginning of the year for me as well, and nothing I do can make it truly go away for good.  Eventually it somehow starts working again for a short while and shows/movies that haven't had any metadata will suddenly download them, but it will mysteriously break again just as mysteriously as it started working once more.

I'm at my wits end!

Of note: I too am using a Mac.  I'm running the latest version of Mavericks.  I also have the OSX Server extensions installed on my Mid-2010 Mac Mini.  I'm wondering if this is a bug with either Mavericks, OSX Server, or both.

@wineaux: more discussion of this topic here: https://forums.plex.tv/topic/81416-plex-server-0986175-tv-shows-downloading-meta-data-issue/

Although it does seem to be more prevalent on Windows machines, and affects the tvdb agent more often.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.