Forum Discussion

Kestas P.'s avatar
Kestas P.
New member | Level 1
11 years ago

Failed to grab locks

We are making simple file copying files via Dropbox API and getting exceptions like 

com.dropbox.core.DbxException$RetryLater: {"error": "Failed to grab locks for 954581991: lock held by connection 22579708.Please re-issue the request."}

How can I avoid this error? Does the new API v2 could help with this?

4 Replies

Replies have been turned off for this discussion
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    11 years ago

    The "Failed to grab locks for" message indicates a technical inability to make the state modification in the account at the time of the API call. This error generally indicates that there was simultaneous activity in the account preventing your app from making the state-modifying call (e.g., adding, copying, or removing files) it is attempting. The simultaneous activity could be coming from your app itself, or elsewhere, e.g., from the user's desktop client. The best practice when receiving this is to just retry the request, respecting the `Retry-After header if given, or after a small delay possibly with an exponential back-off. If the activity is coming from your own app, you should avoid making multiple state-modifying calls in the same account at the same time.

     

    I don't believe API v2 would improve this, as this is how the Dropbox backend itself works.

  • Kestas P.'s avatar
    Kestas P.
    New member | Level 1
    11 years ago

    Yes indeed my app is submitting for file copy concurrently but there are no way to submit batch copy (folder doesn't fit). If I do sequentially it takes plenty of time to copy files. Let say 40 image files with about 600 kb of size each it takes about 30s to copy all but I need to copy 4000 of images and it would take an hour.

    Dropbox sync folder on windows doesn't have similar problem. Looks like it doesn't deal with locking issue. Is it possible to deal with locks in different way? I mean obtain pessimistic lock, do the operations and release lock or take locks just on destination folder where I am copying files.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    11 years ago

    Unfortunately there isn't another way to handle this, but I'll be sure to pass this along as feedback. 

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!