1 Reply Latest reply on Sep 21, 2015 8:08 AM by johnrellis

    LrCatalog:withPrivateWriteAccessDo blocked by another write access call




      I recently downloaded the trial version of lightroom 6/CC (Windows version). I started developing my own plugin and got quite far until the point where I was starting to write data back to the catalog. Then I ran into "LrCatalog:withPrivateWriteAccessDo: could not execute action... It was blocked by another write access call, and no timeout parameters were provided"


      I tried all kinds of things, but couldn't get around this (also read other posts on this and other sites). Even the minimal script below fails.


      local LrApplication = import 'LrApplication'

      local LrDialogs = import 'LrDialogs'


      curCatalog = LrApplication.activeCatalog();


      exres = curCatalog:withPrivateWriteAccessDo(function()




      Same happens for a few other plugins I downloaded and also with withWriteAccessDo.


      Is the trial version limited in this or is it a bug in the latest version?

      Can you confirm that your (purchased) version Lr 6 CC or standalone can run this script?


      Thanks in advance!


        • 1. Re: LrCatalog:withPrivateWriteAccessDo blocked by another write access call
          johnrellis Most Valuable Participant

          Hmm, something very strange was going on that I've never seen before.


          I'm running LR CC 2015.1.1 / OS X 10.10.5, and just now, a couple of my plugins that I use every day got the same message, "LrCatalog:withPrivateWriteAccessDo: could not execute action... It was blocked by another write access call, and no timeout parameters were provided".    A corrected version of your test script, with a timeout of 30 seconds on the witheWriteAccessDo() call, timed out after 30 seconds. Normally, a timeout means that some other task was writing the catalog (for 30 seconds in this case).


          I restarted LR, and now the test script and my plugins are behaving normally.  I'm guessing that LR was running some ill-mannered internal bookkeeping operation with very long-running access to the catalog.  To be conservative, try rebooting your computer and see if the error still occurs.


          By the way, it's a good idea to provide a timeout parameter of 30 seconds to catalog:withWriteAccessDo ().  Without the timeout, a plugin's catalog:withWriteAccessDo() could fail.  I've never seen it fail when no other plugins are running, but it is pretty common to fail when a plugin that runs in the background is active.  30 seconds seems to be more than enough for any well-mannered plugin.


          I haven't upgraded all of my older plugins to have a timeout parameter.  Timeouts were added in LR 4, I believe, after Adobe realized they had an architectural design flaw in providing plugins with catalog access.  I think the original SDK design was supposed to obviate the need for timeouts, but that didn't work out.


          Here's the script I'm testing with (note the use of LrTasks.startAsyncTask()):


          local Require = require 'Require'.path ("../common").reload()
          local Debug = require 'Debug'.init ()
          require 'strict'
          local LrApplication = import 'LrApplication'
          local LrTasks = import 'LrTasks'
          local curCatalog = LrApplication.activeCatalog ();
          LrTasks.startAsyncTask (function ()
              local exres = curCatalog:withWriteAccessDo ("with", function() end,
                  {timeout = 30})
              Debug.pause (exres)
              local exres = curCatalog:withWriteAccessDo ("without", function() end)
              Debug.pause (exres)