I patched my way around the bug reported by pygmalion, and found a different issue with the database service.
When invoking functions that use the Database functions from the GUI, I sometimes get a Python exception like this:
SQLite objects created in a thread can only be used in that same thread.The object was created in thread id 1101532080 and this is thread id 1269304240
This is a showstopper for database access in Plex plugins.
Some searching reveals that single SQLite connection objects can’t be used by multiple threads (correct me if I’m wrong, but I think that Plex Media Server uses multithreading in order to act as a concurrent server). There’s what appears to be a good solution here, but it’s complex.
Let me know if I can contribute anything more to fixing this issue.
That’s a strange one - where are you trying to access the database from when that happens? Plug-ins run in their own processes & usually only use a single thread, so threading shouldn’t be an issue (apart from the UpdateCache function, which runs in its own thread).
That explains it; I am doing database access from both the UpdateCache function and from other functions. I can make my own connection object for use in that function, which seems like the easiest solution, unless you have a better one.
Thanks.
We’ve found some good info on how to make sqlite3 play nicely with multiple threads
It’ll be fixed in the next framework release (along with a bunch of other stuff).
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.