0

tk-nuke-write-node: sqlite3 database locked

Hi,

Sometimes our artists report this database error. Seems to be quite random. Most of the time it's not locked but sometimes it is. Maybe it makes sense to implement some try-fail-retry mechanism when modifying the cache?

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "\\fsrv-stgt-01\tools\STANDALONE\Shotgun\toolkit\studio\install\apps\app_store\tk-nuke-writenode\v0.1.10\python\tk_nuke_writenode\handler.py", line 384, in on_compute_path_gizmo_callback
render_path = self.compute_path(node, True)
File "\\fsrv-stgt-01\tools\STANDALONE\Shotgun\toolkit\studio\install\apps\app_store\tk-nuke-writenode\v0.1.10\python\tk_nuke_writenode\handler.py", line 357, in compute_path
fields.update(self._app.context.as_template_fields(template))
File "\\fsrv-stgt-01\tools\STANDALONE\Shotgun\toolkit\studio\install\core\python\tank\context.py", line 394, in as_template_fields
if self.entity and len(self.entity_locations) == 0:
File "\\fsrv-stgt-01\tools\STANDALONE\Shotgun\toolkit\studio\install\core\python\tank\context.py", line 248, in entity_locations
paths = self.__tk.paths_from_entity(self.entity["type"], self.entity["id"])
File "\\fsrv-stgt-01\tools\STANDALONE\Shotgun\toolkit\studio\install\core\python\tank\api.py", line 371, in paths_from_entity
path_cache = PathCache(self.pipeline_configuration)
File "\\fsrv-stgt-01\tools\STANDALONE\Shotgun\toolkit\studio\install\core\python\tank\path_cache.py", line 37, in init
self._init_db(db_path)
File "\\fsrv-stgt-01\tools\STANDALONE\Shotgun\toolkit\studio\install\core\python\tank\path_cache.py", line 78, in _init_db
""")
sqlite3.OperationalError: database is locked

 

 

Best Regards,

 

Henry

3 comments

  • 0
    Avatar
    Manne Öhrström

    Hello Henry!

    Sorry to hear you are having problems. This database issue is a bit tricky and can be the result of a couple of different aspects of your setup -- there is another forum posts that discusses some of these: https://support.shotgunsoftware.com/entries/95443658

    In your case, it sounds like perhaps the database is busy and this is why you are getting the lock error. Basically, every time a client needs to make a change to the database, it will be locked and other writers cannot access it. The lock exists as long as the writing occurs, which is usually very quick. Writes to the path cache happens when new folders are created only, so either when someone explicitly calls the create_folders API method or when an application is launched and folders are created as part of that. Does this description sound like it would match what you are experiencing?

    In this case it would definitely help to add a re-try and it is a great idea! I'll log a feature request for this.

    With v0.15 of the Core, which we are releasing soon, we have made a number of changes to the path cache and the sqlite database to make it slightly more robust and future proof. Users no longer need to share a cache, but several caches can exist in parallel in order to avoid contention.

     

  • 0
    Avatar
    Chris Hyman

    We have just started to install & use toolkit and have hit this "database is locked issue".

    What I am struggling with is where is the database stored as at the moment we cannot locate it?

     

    Chris

  • 0
    Avatar
    Ryan Mayeda

    Hi Chris.

    Sorry to hear you're having this issue as well!  The path cache file can be found in the project folder underneath the primary storage.  Using our example storage from the docs, the file lives here:

    /mnt/projects/[project_name]/tank/cache/path_cache.db

    Hope this helps!

    Ryan.

Please sign in to leave a comment.