google-code-export / gdata-python-client

Automatically exported from code.google.com/p/gdata-python-client
1 stars 0 forks source link

ResumableUpload - Always error 503 on second chunk #470

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Try to upload a file bigger than the chunk size with resumable upload
2.The first chunk is uploaded correctly and a 308 result is received indicating 
that the upload should continue to iterate over the filehandle bytes.
3.The second chunk is sent, but always return 503 error. 

What is the expected output? What do you see instead?
The expected result is a 308 return value, i'll get a 503 error.

What version of the product are you using?
Latest version fo the GData Python API, 2.0.12

Please provide any additional information below.
The python version of ResumableUpload is not working as I see it. Of course it 
could be us who is doing something wrong, but we succeed in uploading the first 
chunk and we get a 308 answer back which indicates that the uploading should 
continue. On the second chunk it always fail, no matter the size of the chunk. 
If the file fits in the first chunk , and the first chunk is less than the file 
- upload limitation of 1 Mb , the upload succeeds. 

I assume that we then have a correct authorization and also that we call the 
init-resumable upload in the correct way. I have sniffed the HTTP packages and 
they look exactly the same for the first chunk and the second except for the 
content-range header and the authentication headers. 

What shall we do? It looks like this issue is on Google Docs service side. We 
have tried to change all upload parameters back and forth without any luck, 
always "Service Unavailable - 503" on the second chunk...

We have also tried to run the python sample code for resumable upload with the 
same result "Service Unavailable - 503". 

We have found a couple of discussions related to this , but no one seem to have 
a solution for us: 

Error on last chunk:
http://www.google.com/support/forum/p/apps-apis/thread?tid=55096dccbc810ae3&hl=e
n

Error on secound chunk:
http://www.google.com/support/forum/p/apps-apis/thread?tid=4ad3bdf7978f2aea&hl=e
n

App Engine Defect Report:
http://code.google.com/p/googleappengine/issues/detail?id=4045&q=resumable%20upl
oad&colspec=ID%20Type%20Status%20Priority%20Stars%20Owner%20Summary%20Log%20Comp
onent%20Language

Please help us! We are in a really bud situation with our customer , if we 
don't solve this!

See the http-sniff attached.

Regards
/Jens

Original issue reported on code.google.com by j...@cloudspot.se on 21 Nov 2010 at 9:27

Attachments:

GoogleCodeExporter commented 9 years ago
I have attached the code which we use to get the error described.

Original comment by j...@cloudspot.se on 6 Dec 2010 at 2:26

Attachments:

GoogleCodeExporter commented 9 years ago
Errormessage returned
############# Error - message in debug-mode: #########################
ERROR    2010-12-06 11:45:46,063 __init__.py:395] Server responded with: 503, 
Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 517, in __call__
    handler.post(*groups)
  File "C:\Users\Jens\Documents\04_My Projects\Forcebridgeserver\DocsHandler.py", line 124, in post
    uploader.UploadFile('/feeds/upload/create-session/default/private/full',entry=gdata.docs.data.DocsEntry(title=atom.data.Title(text=file_name)))
  File "C:\Users\Jens\Documents\04_My Projects\Forcebridgeserver\gdata\client.py", line 1028, in upload_file
    start_byte, self.file_handle.read(self.chunk_size))
  File "C:\Users\Jens\Documents\04_My Projects\Forcebridgeserver\gdata\client.py", line 988, in upload_chunk
    raise error
RequestError: Server responded with: 503, 

Original comment by j...@cloudspot.se on 6 Dec 2010 at 2:30

GoogleCodeExporter commented 9 years ago
********* INIT SESSION *******************
POST 
/feeds/upload/create-session/default/private/full?convert=false&xoauth_requestor
_id=mail%40mail.se HTTP/1.1
Gdata-Version: 3.0
Content-Length: 128
Accept-Encoding: gzip
User-Agent: gdata-py/2.0.13 AppEngine-Google; 
(+http://code.google.com/appengine)
X-Upload-Content-Length: 410459
Host: docs.google.com
X-Upload-Content-Type: application/pdf
Content-Type: application/atom+xml
Authorization: OAuth oauth_nonce="", oauth_timestamp="", oauth_consumer_key="", 
oauth_signature_method="HMAC-SHA1", oauth_version="1.0", oauth_signature=""

<ns0:entry 
xmlns:ns0="http://www.w3.org/2005/Atom"><ns0:title>filename.pdf</ns0:title></ns0
:entry>

******** INIT SESSION RESPONSE ***********
HTTP/1.1 200 OK
Server: Upload Server Built on Nov 29 2010 12:24:14 (1291062254)
Location: 
http://docs.google.com/feeds/upload/create-session/default/private/full?convert=
false&xoauth_requestor_id=mail%40mail.se&upload_id=AEnB2Upr-yB-Mhh26XqdZAJZmVUDD
LUkxlMBmHw6UxZGBwrb_5s27ZUTCoesn5jXcX-7koH3ELotrOFLlcK8COLBMNIPRsWqXg
Date: Mon, 06 Dec 2010 10:01:26 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 0
Content-Type: text/html

********* FIRST CHUNK *******************
POST 
/feeds/upload/create-session/default/private/full?convert=false&xoauth_requestor
_id=mail%40mail.se&upload_id=AEnB2Upr-yB-Mhh26XqdZAJZmVUDDLUkxlMBmHw6UxZGBwrb_5s
27ZUTCoesn5jXcX-7koH3ELotrOFLlcK8COLBMNIPRsWqXg HTTP/1.1
Gdata-Version: 3.0
Content-Length: 50000
Accept-Encoding: gzip
Content-Range: bytes 0-49999/410459
User-Agent: gdata-py/2.0.13 AppEngine-Google; 
(+http://code.google.com/appengine)
Host: docs.google.com
Content-Type: application/pdf
Authorization: OAuth oauth_nonce="", oauth_timestamp="", oauth_consumer_key="", 
oauth_signature_method="HMAC-SHA1", oauth_version="1.0", oauth_signature=""

%PDF-1.7%
<TRUNCATED BODY>

********* FIRST CHUNK RESPONSE *******************

HTTP/1.1 308 Resume Incomplete
Server: Upload Server Built on Nov 29 2010 12:24:14 (1291062254)
Date: Mon, 06 Dec 2010 10:01:27 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 0
Content-Type: text/html

********* SECOND CHUNK *******************

POST 
/feeds/upload/create-session/default/private/full?convert=false&xoauth_requestor
_id=mail%40mail.se&upload_id=AEnB2Upr-yB-Mhh26XqdZAJZmVUDDLUkxlMBmHw6UxZGBwrb_5s
27ZUTCoesn5jXcX-7koH3ELotrOFLlcK8COLBMNIPRsWqXg HTTP/1.1
Gdata-Version: 3.0
Content-Length: 50000
Accept-Encoding: gzip
Content-Range: bytes 50000-99999/410459
User-Agent: gdata-py/2.0.13 AppEngine-Google; 
(+http://code.google.com/appengine)
Host: docs.google.com
Content-Type: application/pdf
Authorization: OAuth oauth_nonce="", oauth_timestamp="", oauth_consumer_key="", 
oauth_signature_method="HMAC-SHA1", oauth_version="1.0", oauth_signature=""

<TRUNCATED BODY>

********* SECOND CHUNK RESPONSE *******************
HTTP/1.1 503 Service Unavailable
Server: Upload Server Built on Nov 29 2010 12:24:14 (1291062254)
Date: Mon, 06 Dec 2010 10:01:28 GMT
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, no-store, must-revalidate
Content-Length: 0
Content-Type: text/html

Original comment by j...@cloudspot.se on 6 Dec 2010 at 2:31

GoogleCodeExporter commented 9 years ago
Questions:
Why does the second chunk fail? 
I see some small issues which could relate problem I have:
1. To start with - all communication after the INIT-SESSION is HTTP POST, but 
in the protocol-description 
(http://code.google.com/apis/gdata/docs/resumable_upload.html) it says PUT.
2. All communication after the INIT-SESSION still uses the create session uri: 
/feeds/upload/create-session/default/private/full - shouldn't it be using 
something like http://docs.google.com/feeds/upload/upload-file/ instead? This 
is a return-param from the INIT-SESSION so I can not do anything about this.
3. I had an idea that we get a LOCATION (new url to post the second chunk to, 
in the response from the first chunk) which isn't handled by the GData 
Resumable Upload - code, but it doesn't look like that when I look at the 
http-traffic. 
4. I also tried the sample code which is distributed with the Gdata API from 
the command-line with two authentication methods, (1) client login and (3) 
token from a webbrowser. Both if these fails but this time with a HTTP 400. 
When I look at the HTTP-traffic from the sample I see that the content-range 
header is totally messed up so the chunk-byte range is outside the 
content-file-size. This means that the sample code doesn't work at all. 

Original comment by j...@cloudspot.se on 6 Dec 2010 at 2:32

GoogleCodeExporter commented 9 years ago
http://code.google.com/apis/documents/forum.html?place=topic%2Fgoogle-documents-
list-api%2F2QLi1RADEu4%2Fdiscussion

Original comment by vicfry...@google.com on 14 Dec 2010 at 8:13