uskudnik / amazon-glacier-cmd-interface

Command line interface for Amazon Glacier
MIT License
375 stars 103 forks source link

Timeout Issue #156

Open brianfm opened 10 years ago

brianfm commented 10 years ago

Trying to load a 27GB file to Glacier. After about an hour, I get this message. I have seen previous questions about timeout errors, but wanted to add this to the mix. Thank you.

Traceback (most recent call last): 391.91 KB/s, average 381.33 KB/s, ETA File "/usr/local/bin/glacier-cmd", line 9, in load_entry_point('glacier==0.2dev', 'console_scripts', 'glacier-cmd')() File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/glacier.py", line 929, in main args.func(args) File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/glacier.py", line 156, in wrapper return fn(_args, _kwargs) File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/glacier.py", line 309, in upload args.name, args.partsize, args.uploadid, args.resume) File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 65, in wrapper ret = fn(_args, _kwargs) File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 231, in glacier_connect_wrap return func(_args, _kwargs) File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 65, in wrapper ret = fn(_args, _kwargs) File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 252, in sdb_connect_wrap return func(_args, _kwargs) File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 65, in wrapper ret = fn(_args, _kwargs) File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 1156, in upload writer.write(part) File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/glaciercorecalls.py", line 129, in write data) File "/usr/local/lib/python2.7/dist-packages/boto-2.20.1-py2.7.egg/boto/glacier/layer1.py", line 637, in upload_part response_headers=response_headers) File "/usr/local/lib/python2.7/dist-packages/boto-2.20.1-py2.7.egg/boto/glacier/layer1.py", line 84, in make_request raise UnexpectedHTTPResponseError(ok_responses, response) boto.glacier.exceptions.UnexpectedHTTPResponseError: Expected 204, got (408, code=RequestTimeoutException, message=Request timed out.)

peterskurt commented 10 years ago

Same here: Probably 20-30% of my uploaded files have received that error. I haven't been able to check yet if they actually made it there or not, yet. I kept all my files below 200 MB. I didn't do a part setting. SHOULD I be setting the part size?

Processing musicbackup0014.tar.bz2 Traceback (most recent call last):Rate 656.85 KB/s, average 649.58 KB/s, ETA 18:04:21.
File "/usr/local/bin/glacier-cmd", line 9, in load_entry_point('glacier==0.2dev', 'console_scripts', 'glacier-cmd')() File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/glacier.py", line 929, in main args.func(args) File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/glacier.py", line 156, in wrapper return fn(_args, _kwargs) File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/glacier.py", line 309, in upload args.name, args.partsize, args.uploadid, args.resume) File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 65, in wrapper ret = fn(_args, _kwargs) File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 232, in glacier_connect_wrap return func(_args, _kwargs) File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 65, in wrapper ret = fn(_args, _kwargs) File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 253, in sdb_connect_wrap return func(_args, _kwargs) File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 65, in wrapper ret = fn(_args, _kwargs) File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/GlacierWrapper.py", line 1157, in upload writer.write(part) File "/usr/local/lib/python2.7/dist-packages/glacier-0.2dev-py2.7.egg/glacier/glaciercorecalls.py", line 129, in write data) File "/usr/local/lib/python2.7/dist-packages/boto-2.26.0-py2.7.egg/boto/glacier/layer1.py", line 1278, in upload_part response_headers=response_headers) File "/usr/local/lib/python2.7/dist-packages/boto-2.26.0-py2.7.egg/boto/glacier/layer1.py", line 118, in make_request raise UnexpectedHTTPResponseError(ok_responses, response) boto.glacier.exceptions.UnexpectedHTTPResponseError: Expected 204, got (408, code=RequestTimeoutException, message=Request timed out.)

xiam commented 9 years ago

I located a bit of code in glacier/glaciercorecalls.py that seems to try to upload again in case of a timeout, but it's commented out:

##        retries = 0
##        while True:
##            response = self.connection.make_request(
##                "PUT",
##                self.upload_url,
##                headers,
##                data)
##
##            # Success.
##            if response.status == 204:
##                break
##
##            # Time-out recieved: sleep for 5 minutes and try again.
##            # Do not try more than five times; after that it's over.
##            elif response.status == 408:
##                if retries >= 5:
##                    resp = json.loads(response.read())
##                    raise ResonseException(
##                        resp['message'],
##                        cause='Timeout',
##                        code=resp['code'])
##
##                if self.logger:
##                    logger.warning(resp['message'])
##                    logger.warning('sleeping 300 seconds (5 minutes) before retrying.')
##
##                retries += 1
##                time.sleep(300)
##
##            else:
##                raise ResponseException(
##                    "Multipart upload part expected response status 204 (got %s):\n%s"\
##                        % (response.status, response.read()),
##                    cause=resp['message'],
##                    code=resp['code'])

##        response.read()

I suppose it's commented because it's incomplete, it would be great to know what are the detected problems in this code so we could figure out a solution.

gaige commented 9 years ago

I'm seeing something similar where erratically it's failing to upload due to timing out on a part. My files are huge (multi-gigabyte), but I'm restricting the parts to 128MB right now, but it is still failing at least once a day.

xiam commented 9 years ago

In order to finish my upload (~200GB), I had to put it in a loop:

while true; do
  glacier-cmd upload my-vault /foo/bar.tar.gpg --description="FOO BAR" --uploadid=MY_UPLOAD_ID;
  sleep 600;
done

Got the uploadid with glacier-cmd listmultiparts.

After timing out it takes A LOT of time to check the part's hashes, so this is not a proper solution at all but it allows me to continue working.

I'll try with a smaller part size to see if the failing rate drops a bit.

peterskurt commented 9 years ago

I ended up using the part setting -- setting it higher and it fixed my problem.