Curious about A, B, C, and D drives? Learn what they mean and how to use them effectively with Dropbox in this handy guide! - check it out now!

Forum Discussion

sisrael1's avatar
sisrael1
New member | Level 2
2 months ago
Solved

Uploads via API returning many too_many_write_operatios error

I am uploading files using the Dropbox API and I keep on getting (at least once a day) the too_many_write_operations error. Is there any way to reduce the number of these errors?

  • sisrael1 Also, note that if there are multiple changes at the same time in the same account or shared folder, you can run in to this 'too_many_write_operations' error in particular, which is "lock contention". That's not explicit rate limiting, but rather a result of how Dropbox works on the back-end. This is a technical inability to make a modification in the account or shared folder at the time of the API call. This applies to all account types. This error indicates that there was simultaneous activity in the account or shared/team folder preventing your app from making the state-modifying call (e.g., adding, editing, moving, copying, sharing, or deleting files/folders) it is attempting. The simultaneous activity could be coming from your app itself, or elsewhere, e.g., from the user's desktop client. It can come from the same user, or another member of a shared folder. You can find more information about lock contention and optimizations you can make here. The app will need to be written to automatically handle this error.

    In short, to avoid this error, you should avoid making multiple concurrent state modifications and use batch endpoints where possible. That won't guarantee that you won't run in to this error though, as contention can still come from other sources, so you should also implement error handling and automatic retrying as needed.

  • DB-Des's avatar
    DB-Des
    Icon for Dropbox Engineer rankDropbox Engineer

    sisrael1

    The Dropbox API has a general rate limiting system that applies to all account types, but we don't have specific rate numbers documented for that Apps should be written to handle these rate limit responses automatically. The best practice is to retry the request, respecting the Retry-After header if given in the response, or using an exponential back-off, if not. I recommend referring to the error documentation and Error Handling Guide for more information.

    Additionally, there is a specific limit for uploads to some Dropbox team plans of "1 billion API calls/month" for "data transport" noted here. This is a limit on the number of upload API calls that can be made per team per month, for certain Dropbox team plans only. Note that this only applies to upload calls, and not other types of calls. You can find more information on this limit in the developer documentation here.

     

    • Greg-DB's avatar
      Greg-DB
      Icon for Dropbox Staff rankDropbox Staff

      sisrael1 Also, note that if there are multiple changes at the same time in the same account or shared folder, you can run in to this 'too_many_write_operations' error in particular, which is "lock contention". That's not explicit rate limiting, but rather a result of how Dropbox works on the back-end. This is a technical inability to make a modification in the account or shared folder at the time of the API call. This applies to all account types. This error indicates that there was simultaneous activity in the account or shared/team folder preventing your app from making the state-modifying call (e.g., adding, editing, moving, copying, sharing, or deleting files/folders) it is attempting. The simultaneous activity could be coming from your app itself, or elsewhere, e.g., from the user's desktop client. It can come from the same user, or another member of a shared folder. You can find more information about lock contention and optimizations you can make here. The app will need to be written to automatically handle this error.

      In short, to avoid this error, you should avoid making multiple concurrent state modifications and use batch endpoints where possible. That won't guarantee that you won't run in to this error though, as contention can still come from other sources, so you should also implement error handling and automatic retrying as needed.

    • sisrael1's avatar
      sisrael1
      New member | Level 2

      Thank you for the response! I am almost sure I hit these errors due to concurrent updates.

    • Greg-DB's avatar
      Greg-DB
      Icon for Dropbox Staff rankDropbox Staff

      sisrael1 Yes, multiple concurrent uploads can trigger this lock contention error. Refer to the resources in my previous post for information on how to commit multiple changes in one call to avoid triggering lock contention with your own changes.