0 Replies Latest reply on Mar 25, 2016 1:32 PM by stevenb5627360

    lrHttp.post keeps timing out after large upload attempt


      I have written a lightroom plugin to upload photos to google cloud storage. I am trying to follow the recommended process outlined in the following link, specifically going for resumable upload. Upload Objects - Cloud Storage — Google Cloud Platform


      Here is an outline of my current steps:


      1. Within exportServiceProvider.processRenderedPhotos I wait for the photo to be rendered and then I read the photo file into memory using io.open. This can be up to 10 megabytes.
      2. I then do a post to GCS to get a resumable session URI (this works great)
      3. Using the session URI I then perform a lrHttp.post(uri, fileData, headers, 'PUT')
        1. So this tries to PUT the entire multi-megabyte file to GCS in one request.
        2. Sometimes it works in one go and the entire file is uploaded successfully
        3. In other cases the PUT times out which is an expected scenario because the file is quite large
      4. In the case of a timeout I am supposed to send another empty PUT request that figures out how much of the file was successfully transferred so I can resume from there
        1. This lrHttp.post(uri,'',headers,'PUT') more often then not, times out after about a minute. Each subsequent attempt can also timeout after a minute. Eventually the call will succeed and return the expected information. The strange thing is if I do this simple PUT request from an external source such as curl or  www.requestmaker.com it returns immediately every time so the problem does not seem to be on Google Cloud Storage end.
      5. Here is the specific error I am getting:


             errorCode: timedOut

             name: The request timed out.

             nativeCode: -1001


      My only guess is that the original lightroom PUT is somehow severely backed up from the original request and it takes a long time for it to work through its memory before being able to successfully make another request, despite the fact that it returned from execution.


      I would like to use lrHttp.postMultipart and point it at a file. However, my attempts to do that would also inevitably timeout and GCS does not support a resumable option with postMultipart vs 'PUT'.


      I am looking for an explanation of this phenomenon or a better approach for uploading large image files to GCS while gracefully handling inevitable timeouts and connectivity issues.


      I am currently using lightroom version 6.5