We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

Győző C.'s avatar
Győző C.
Explorer | Level 3
9 years ago

Parallel file upload fails

My app uses core api v1. When I try to upload 10+ files into my dropbox account, a few of them randomly fails with response:

[..]
<head><title>Dropbox - 403</title> <link href="//www.dropbox.com/static/css/error.css" rel="stylesheet" type="text/css"/>
[..]

It does not occur when uploading a single file.
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    A 403 error with an HTML body is unexpected when using the API. Can you share some sample code that reproduces this? Thanks in advance! 

  • Győző C.'s avatar
    Győző C.
    Explorer | Level 3

    My bad, the 403 response was not for these requests. However some files are still missing. It can be reproduced with this:

    #!/bin/bash
    for i in `seq 10 19`;
    do
    curl -H "Authorization: Bearer <my token>" https://api-content.dropbox.com/1/files_put/auto/ -T file$i &
    done;

    Now I can see that the response for the missing files is:

    {"error": "Failed to grab locks for 532934897: lock held by connection 4695316.Please re-issue the request."}

    Is there a queue I can use on your side for file upload? Else I guess I have to check the response and retry if necessary. Thanks!

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

    That error can occur in some cases, in which case the response status code will be 503. If the response status code is non-200, you should consider the upload failed.

    This error generally indicates that there was simultaneous activity in the account preventing your app from making the state-modifying call (e.g., adding or removing files) it is attempting. The simultaneous activity could be coming from your app itself, or elsewhere, e.g., from a user's desktop client.

    You can't queue these on our side, so the best practice is to reduce the number of simultaneous requests and to just retry a request, respecting the Retry-After header if given, or after a small delay possibly with an exponential back-off, when receiving this error.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,877 PostsLatest Activity: 6 hours ago
325 Following

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 or Facebook.

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!