Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-7901

Upload times out and fails with 400 error sometimes - Android

    XMLWordPrintableJSON

Details

    Description

      Using:

      • Cordova 4.0.0
      • org.apache.cordova.file-transfer 0.4.7 "File Transfer"
      • Android 4.4.4 (Moto X)

      I am uploading image files from my phone to AWS S3 (via https) using the File Transfer plugin. When using Wifi, this seems to work with no issues - I have not been able to get it to fail. I have setup a progress callback to log to the console and the "win" callback is called almost immediately after the last progress event.

      When using the cell network (with 1-2 out of 5 bars), on the other hand, it fails intermittently. The progress events seem to indicate that the file is almost done uploading, then there is a long delay, and then the fail callback is called.

      File size doesn't have any effect.

      I am attaching logcats of both successes and failures. The successes show a 204 response from the AWS server shortly after the last progress event. The failures show a long delay after the last progress event, and then a 400 response from the AWS server with the following message "Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed."

      Google searching on this phrase reveals that the most common cause is the Content-Length being set to more than the number of bytes actually sent. Given that this only happens on slower connections, I'm not sure if that's relevant in this case.

      Attachments

        1. success2.txt
          6 kB
          Rajat Paharia
        2. success1.txt
          5 kB
          Rajat Paharia
        3. failure2.txt
          52 kB
          Rajat Paharia
        4. failure1.txt
          23 kB
          Rajat Paharia

        Activity

          People

            Unassigned Unassigned
            rajatrocks Rajat Paharia
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: