Aws-cli: aws s3 cp hangs on download more than 500MB on content

Created on 5 Feb 2016  ·  37Comments  ·  Source: aws/aws-cli

Hello,

I am just doing daily backups from s3 files. Bassically I copy from a s3 bucket files to local disk to zip them and copy after to another s3 bucket the zipped contain.

The issue is the aws s3 get stuck in any moment and doesn't download, I mean, the download starts but is interrupted in an specific moment in an specific file. This file can be accessed via web or any s3 explorer. the files are not big.

My aws cli is:

aws-cli/1.9.18 Python/2.7.10 Linux/4.1.13-19.31.amzn1.x86_64 botocore/1.3.18

OK I will change the issue, aws s3 cp is hanging when is downloading a lot of files. I checked with 2 s3 buckets with no long content and it downloads well but not the same when the bucket has a lot of files:

S3 bucket content between 200 and 500MB on storage are downloaded without problems but not the same when content is beyond 500MB.

Regards

s3

Most helpful comment

I am having the same trouble copying a single large binary file (10.9gb) from my s3 storage to my ec2 instance. Plenty of disk space on my ubuntu instance.

command was simplest form possible :
$aws s3 cp s3://folder-name/binary-filename ./local-dir-on-ec2/

It downloads like lightning until it reads something like "10.9gb of 10.9gb copied with 1 file remaining." and then the command is hung. No change. I waited 15 min. Restarted the same command about 8 times. Looked up this thread. Then went back after about 10 minutes, and did the same thing again. And this time, it completed the copy without hanging. !-??

Same thing happened with a second ~10gb binary file. Transfer appeared to go lightning fast and then hung up with appearance that all data had been copied. "10.4 gb of 10.4 gb copied with 1 file remaining." I tried three more times with exactly same command, and finally got the copy to work.

Amazon needs to fix this issue or s3 is of no real use to ec2 customers.

All 37 comments

We'll need more information to help you troubleshoot. Can you tell us:

  • The exact AWS commands you're running? If you can give us a script/set of commands to run that demonstrate the issue, that will help in getting this resolved.
  • When the command hangs is there any network activity? i.e does the download speed drastically drop or does it completely stop transferring data entirely?
  • Can you provide --debug logs? We're specifically looking for anything with ERROR that will indicate any errors that occurred during transfer. This will give us an idea of where to start looking.

Hello, I run a simple command:
aws s3 cp s3://my-bucket/ my-local-directory/ --recursive

I attach the log file. the last one line shows that has downloaded 372 parts and yes, it stop totally any data transfer and no shows any network activity after that.

In the images at 15:30 UTC begun the data transfer and 1 minute after it were totally stopped:

instantanea19
instantanea20

60anios.log.zip

Hello, I have found some interesting. If in my config file I put
s3 = multipart_chunksize = XXMB
it causes the s3 cp hanging. But according with aws documentation the multipart chunksize is only used if each file size is greater than default/configured multipart threshold value what is by default 8MB and no many files that I'm downloading have that size. In general are JPG files with no more than 1MB and the hanging occurs for the log file sent in a file with 520KB.

I'm having the same problem with both cp --recursive and sync, with this version:
aws-cli/1.10.8 Python/2.7.6 Linux/3.16.0-41-generic botocore/1.3.30
I also tried the ubuntu package version, and the same problem :
aws-cli/1.2.9 Python/3.4.3 Linux/3.16.0-41-generic

It always hangs towards the end, not at the beginning, which makes it more annoying. For example this is the last message I see :
Completed 6343 of 6349 part(s) with 6 file(s) remaining

I run a very basic command :
aws s3 sync s3://bucketname/dir /tmp/localdestination
or
aws s3 cp --recursive s3://bucketname/dir /tmp/localdestination

This happens too when the content has as few as 100 files, each of size 2MB.
When I try to interrupt the script with CTRL+C, the "Cleaning up. Please wait..." phase also takes a long time, so I hit CTRL+C a second time to exit.

+1
I have the same issue.
The files are usually very small but the number of files is very high (complete ubuntu repository).
I tried multiple versions with the same result. Process simply hangs forever.

I personally use the aws s3 sync with no special settings.

+1
Same issue on ubuntu with the same setup.

It would be helpful to get --debug logs for anyone running into these issues.

I've been running tests in a loop that downloads ~400k files (500MB+) and I'm not seeing s3 cp hang.

For anyone that's able to generate a --debug log of this issue, it'd be helpful to search for Traceback and see any errors that are occurring. The only thing I can think of is there's some error being generated that the CLI is not handling. But I'd need --debug logs to confirm this.

I was able to reproduce the issue 10+ times by trying to sync the ubuntu trusty apt repository.
To reproduce, first:

  • sync the mirror with apr-mirror command
  • try to upload to a bucket using aws s3 sync command

We are having the same issue so sync'ing between 2 S3 buckets. The sync runs for around 3 hours 15 mins then hangs for 9 hours then resumes and finishes successfully an hour later.

The logs file don't show any errors but you can see where the sync has got stuck due to the timestamps.

We are using the Ubuntu package version:
aws --version
aws-cli/1.2.9 Python/3.4.3 Linux/3.13.0-29-generic

Same issue for me with aws s3 sync and a 1GB zip file. Looks like it grabs about 800MB of it on download, then crashes with no network activity. It was on an ec2 ubuntu instance so eventually I couldnt ssh to it.

aws-cli/1.10.1 Python/3.5Linux ip-10-9-10-192 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 Ubuntu 16.04 LTS 18:33:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux.1+ Linux/4.4.0-21-generic botocore/1.3.23

Command was:
$ aws s3 sync s3://testbucket--ap-southeast-2-1111111 /root/s3 --delete --debug

see attached logs

awss3sync-debug.zip

thanks

Are there any updates on this issue?

Hope this keeps the issue open, since it still happens for me.

$> aws --version
aws-cli/1.10.18 Python/2.7.6 Linux/3.13.0-93-generic botocore/1.4.9

$> aws s3 sync s3://eu ./local --delete --exact-timestamps --profile=eu
... [sic] 296 files downloaded

$> aws s3 sync ./local/  s3://beijing --profile=china
... [sic] lots of files uploading ..
Completed 295 of 296 part(s) with 1 file(s) remaining

I've never been patient enough to wait it out, but I have let it go on for an hour or so. I always ctrl-c out of it and relaunch. Sometimes it shows more files synced, other times not.

Its not _consistently_ doing it, it feels a little more random

We are experiencing exactly the same problem.

:+1: I am also experiencing this.

Me too, on around 280K files

I am like 99% sure I am bumping into this as well.

We were able wo work around this bug by zipping all files before uploading them

I am trying to copy a large file (1.5GB) from s3 to an ec2 instance and it seems like it kills the network during the copy. I lose ssh connection and have to restart the instance in order to get back in. The copy doesn't finish either even if it is running nohup (because network is not working). The files seem to get backed up fine to s3 from an instance in us-east-1a but I am trying to copy the files back to an instance in us-east-1d and it isn't working.

I am attaching a zip with debug from two copies with different versions of the aws cli (including 1.11.0). The command I am running is at the top of each log file.

restorefaildebug.zip

UPDATE: I was able to get mine working by running fewer concurrent requests:

aws configure set default.s3.max_concurrent_requests 4

The default is 10 and apparently that was too much for my micro instance.

@hdeadman : From what you describe, doesn't seems like the same issue. Maybe you want to open another Github issue with your problem

I have this same issue trying to sync a range of files from small to 1.5TB in size, and from 1 to 55 million in quantity.

I removed the ~/.aws/config

And it seems to have fixed it, by resetting back to defaults.

I'm also getting this issue when using sync (local to S3) on a Windows 8 machine using CLI 1.11.2, it also happened on 1.10.41. This has been happening with as little as 300 files that are only ~5mb in size total. It takes about 15 minutes to do the upload, says "Completed X parts with ... file(s) remaining", and then finishes after some random amount of time. Sometimes it finishes instantly (no problem), other times I have let it run for 16+ hours and it still hasn't exited. However the file upload part does seem to finish in about 15 minutes consistently since I can see the network traffic drop, but the process doesn't end after that.

This is a major roadblock for us since this is supposed to run every few hours and we can't guarantee that it will ever complete.

[image: Inline images 1]
Blue = aws s3 sync
Yellow = cloudberry 4 jobs x 100 threads upload

setup
*aws s3 sync *
instance :m4.10xlarge
disk system NTFS-3G volume on a 6TB gp2 ssd

_cloudberry_
instance: m4.4xlarge
disk 4 x sc1 5TB

after a full yum update on a fresh system aws s3 sync is working well. Even
though NTFS-3G is extremely slow.

I would use a new fresh AWS AMI connect volume to it and try another push,
make sure your source disk is fast and your instance is large, it uses alot
of memory to sync.
if pushing to s3 from a network source put them inside the same resource
group, and make sure both instances support 10gig network.

On 13 October 2016 at 03:18, Jason Kaczmarsky [email protected]
wrote:

I'm also getting this issue when using sync on a Windows 8 machine using
CLI 1.11.2, it also happened on 1.10.41. This has been happening with as
little as 300 files that are only ~5mb in size total. It takes about 15
minutes to do the upload, says "Completed X parts with ... file(s)
remaining", and then finishes after some random amount of time. Sometimes
it finishes instantly (no problem), other times I have let it run for 15
hours and it still hasn't exited. This is a major roadblock for us since
this is supposed to run every few hours.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/aws/aws-cli/issues/1775#issuecomment-253261743, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AIF_lEDx7CF4seTjCUoIfD_Bjom_9kTeks5qzQhHgaJpZM4HUd2G
.

_Chris Prangnell_
_Sydney_
_+61449247557_

This may be related to the OP which was about downloading from s3 to local. My issue was the other direction (sending from local to S3).

I have been plagued with the issue trying to sync a set of files from a build directory to a remote S3 bucket. In logs, I would see a lot of output about my source files being successfully synched file by file, but would observe a very long (often 15-20 minutes) lag in output before it resumed again. I assumed the script was hung or that I was being rate limited, because it would pick back up and resume to completion after this odd pause.

When i ran the sync command with --debug I found that during the time where I believed the script was hung it was actually doing several ListObjects in the destination (my s3 bucket) that my source directory did not contain. The destination s3 remote bucket has several years worth of historical files in it that the source does not have.

Since I was not using sync to delete any files, but rather as a way to hopefully not send files that hadn't changed, going through the items in the destination is extra work that does not need to be done. The source directory's file size and object count were not of concern, so changing to use cp achieved the same desired end result in a fraction of the time (25 minutes using sync vs 40s using cp --recursive)

tl;dr

The size of your sync destination impacts the length of time a sync command takes. I changed my script to cp --recursive instead of sync and cut the time down signficantly.

I had the same issue. In my case this was caused by not enough space in destination directory.

I also faced this issue. The aws s3 cp command would hang before completion for a few minutes with files 100MB+ . I increased the multipart_threshold and multipart_chunksize as well which seems to have alleviated the problem.

aws-cli/1.11.56 Python/2.7.8 Windows/8 botocore/1.5.19

have same problem. aws s3 cp just hangs.
Use case is very simple - im copying single file 10GB in size from s3 to ec2.
Very disappointing

My bad. My issue was simple. Ive ran command without enough permissions. Still the problem that if file is big, and you dont have permissions it will just hang. No error message.
Have to be fixed.

aws-cli 1.11.13 on Ubuntu (aws-cli/1.11.13 Python/3.5.2 Linux/4.4.0-72-generic botocore/1.4.70)... having this issue intermittently trying to read a 300MB file from a bucket. I do have full permissions on the bucket (and occasionally the transfer completes successfully).

Debug log shows that the transfer is spread out over numerous threads, then suddenly something catches and I'll get a network timeout, which crashes the program:

requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='mybucket.s3.amazonaws.com', port=443): Read timed out.

Have same issue, it happened with both cp and sync command for a 300MB file, the output shows the transfer hangs, and after a few seconds, the read timedout error is returned.

aws version:
aws-cli/1.11.13 Python/3.5.2 Linux/4.4.0-97-generic botocore/1.4.70

command used:

aws s3 cp s3://***-dumps/Tue/abc.dump.gz .
aws --cli-read-timeout=0 --cli-connect-timeout=0 s3 cp 3://***-dumps/Tue/abc.dump.gz .

PS: I can download the file from s3 console in chrome browser.

There's some debug logs for this command:
aws s3 sync s3://***-dumps/Tue/ . --exclude "*" --include "abc.dump.gz" --debug

2018-01-16 11:45:15,310 - Thread-3 - s3transfer.utils - DEBUG - Releasing acquire 0/None
2018-01-16 11:45:15,310 - Thread-3 - s3transfer.tasks - DEBUG - GetObjectTask(transfer_id=0, {'bucket': '***-dumps', 'extra_args': {'Range': 'bytes=301989888-'}, 'key': 'Tue/abc.dump.gz'}) about to wait for the following futures []
2018-01-16 11:45:15,311 - Thread-3 - s3transfer.tasks - DEBUG - GetObjectTask(transfer_id=0, {'bucket': '***-dumps', 'extra_args': {'Range': 'bytes=301989888-'}, 'key': 'Tue/abc.dump.gz'}) done waiting for dependent futures
2018-01-16 11:45:15,311 - Thread-3 - s3transfer.utils - DEBUG - Releasing acquire 0/None
2018-01-16 11:45:15,385 - Thread-4 - s3transfer.utils - DEBUG - Releasing acquire 0/None
2018-01-16 11:45:15,580 - Thread-10 - s3transfer.utils - DEBUG - Releasing acquire 0/None
2018-01-16 11:45:15,886 - Thread-9 - s3transfer.utils - DEBUG - Releasing acquire 0/None
2018-01-16 11:45:22,682 - Thread-12 - s3transfer.tasks - DEBUG - Exception raised.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 226, in _error_catcher
    yield
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 301, in read
    data = self._fp.read(amt)
  File "/usr/lib/python3.5/http/client.py", line 448, in read
    n = self.readinto(b)
  File "/usr/lib/python3.5/http/client.py", line 488, in readinto
    n = self.fp.readinto(b)
  File "/usr/lib/python3.5/socket.py", line 575, in readinto
    return self._sock.recv_into(b)
  File "/usr/lib/python3.5/ssl.py", line 929, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/lib/python3.5/ssl.py", line 791, in read
    return self._sslobj.read(len, buffer)
  File "/usr/lib/python3.5/ssl.py", line 575, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/s3transfer/tasks.py", line 126, in __call__
    return self._execute_main(kwargs)
  File "/usr/lib/python3/dist-packages/s3transfer/tasks.py", line 150, in _execute_main
    return_value = self._main(**kwargs)
  File "/usr/lib/python3/dist-packages/s3transfer/download.py", line 518, in _main
    for chunk in chunks:
  File "/usr/lib/python3/dist-packages/s3transfer/download.py", line 646, in __next__
    chunk = self._body.read(self._chunksize)
  File "/usr/lib/python3/dist-packages/s3transfer/utils.py", line 491, in read
    value = self._stream.read(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/botocore/response.py", line 74, in read
    chunk = self._raw_stream.read(amt)
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 311, in read
    flush_decoder = True
  File "/usr/lib/python3.5/contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 231, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='***-dumps.s3.amazonaws.com', port=443): Read timed out.
2018-01-16 11:45:22,686 - Thread-12 - s3transfer.utils - DEBUG - Releasing acquire 0/None
2018-01-16 11:45:24,079 - Thread-6 - s3transfer.utils - DEBUG - Releasing acquire 0/None
2018-01-16 11:45:31,511 - Thread-11 - s3transfer.tasks - DEBUG - Exception raised.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 226, in _error_catcher
    yield
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 301, in read
    data = self._fp.read(amt)
  File "/usr/lib/python3.5/http/client.py", line 448, in read
    n = self.readinto(b)
  File "/usr/lib/python3.5/http/client.py", line 488, in readinto
    n = self.fp.readinto(b)
  File "/usr/lib/python3.5/socket.py", line 575, in readinto
    return self._sock.recv_into(b)
  File "/usr/lib/python3.5/ssl.py", line 929, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/lib/python3.5/ssl.py", line 791, in read
    return self._sslobj.read(len, buffer)
  File "/usr/lib/python3.5/ssl.py", line 575, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/s3transfer/tasks.py", line 126, in __call__
    return self._execute_main(kwargs)
  File "/usr/lib/python3/dist-packages/s3transfer/tasks.py", line 150, in _execute_main
    return_value = self._main(**kwargs)
  File "/usr/lib/python3/dist-packages/s3transfer/download.py", line 518, in _main
    for chunk in chunks:
  File "/usr/lib/python3/dist-packages/s3transfer/download.py", line 646, in __next__
    chunk = self._body.read(self._chunksize)
  File "/usr/lib/python3/dist-packages/s3transfer/utils.py", line 491, in read
    value = self._stream.read(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/botocore/response.py", line 74, in read
    chunk = self._raw_stream.read(amt)
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 311, in read
    flush_decoder = True
  File "/usr/lib/python3.5/contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 231, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='***-dumps.s3.amazonaws.com', port=443): Read timed out.
2018-01-16 11:45:31,515 - Thread-11 - s3transfer.utils - DEBUG - Releasing acquire 0/None
2018-01-16 11:45:41,054 - Thread-8 - s3transfer.tasks - DEBUG - Exception raised.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 226, in _error_catcher
    yield
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 301, in read
    data = self._fp.read(amt)
  File "/usr/lib/python3.5/http/client.py", line 448, in read
    n = self.readinto(b)
  File "/usr/lib/python3.5/http/client.py", line 488, in readinto
    n = self.fp.readinto(b)
  File "/usr/lib/python3.5/socket.py", line 575, in readinto
    return self._sock.recv_into(b)
  File "/usr/lib/python3.5/ssl.py", line 929, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/lib/python3.5/ssl.py", line 791, in read
    return self._sslobj.read(len, buffer)
  File "/usr/lib/python3.5/ssl.py", line 575, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/s3transfer/tasks.py", line 126, in __call__
    return self._execute_main(kwargs)
  File "/usr/lib/python3/dist-packages/s3transfer/tasks.py", line 150, in _execute_main
    return_value = self._main(**kwargs)
  File "/usr/lib/python3/dist-packages/s3transfer/download.py", line 518, in _main
    for chunk in chunks:
  File "/usr/lib/python3/dist-packages/s3transfer/download.py", line 646, in __next__
    chunk = self._body.read(self._chunksize)
  File "/usr/lib/python3/dist-packages/s3transfer/utils.py", line 491, in read
    value = self._stream.read(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/botocore/response.py", line 74, in read
    chunk = self._raw_stream.read(amt)
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 311, in read
    flush_decoder = True
  File "/usr/lib/python3.5/contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 231, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='***-dumps.s3.amazonaws.com', port=443): Read timed out.
2018-01-16 11:45:41,058 - Thread-8 - s3transfer.utils - DEBUG - Releasing acquire 0/None
2018-01-16 11:45:43,633 - Thread-7 - s3transfer.tasks - DEBUG - Exception raised.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 226, in _error_catcher
    yield
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 301, in read
    data = self._fp.read(amt)
  File "/usr/lib/python3.5/http/client.py", line 448, in read
    n = self.readinto(b)
  File "/usr/lib/python3.5/http/client.py", line 488, in readinto
    n = self.fp.readinto(b)
  File "/usr/lib/python3.5/socket.py", line 575, in readinto
    return self._sock.recv_into(b)
  File "/usr/lib/python3.5/ssl.py", line 929, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/lib/python3.5/ssl.py", line 791, in read
    return self._sslobj.read(len, buffer)
  File "/usr/lib/python3.5/ssl.py", line 575, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/s3transfer/tasks.py", line 126, in __call__
    return self._execute_main(kwargs)
  File "/usr/lib/python3/dist-packages/s3transfer/tasks.py", line 150, in _execute_main
    return_value = self._main(**kwargs)
  File "/usr/lib/python3/dist-packages/s3transfer/download.py", line 518, in _main
    for chunk in chunks:
  File "/usr/lib/python3/dist-packages/s3transfer/download.py", line 646, in __next__
    chunk = self._body.read(self._chunksize)
  File "/usr/lib/python3/dist-packages/s3transfer/utils.py", line 491, in read
    value = self._stream.read(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/botocore/response.py", line 74, in read
    chunk = self._raw_stream.read(amt)
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 311, in read
    flush_decoder = True
  File "/usr/lib/python3.5/contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 231, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='***-dumps.s3.amazonaws.com', port=443): Read timed out.
2018-01-16 11:45:43,637 - Thread-7 - s3transfer.utils - DEBUG - Releasing acquire 0/None
2018-01-16 11:46:25,317 - Thread-5 - s3transfer.tasks - DEBUG - Exception raised.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 226, in _error_catcher
    yield
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 301, in read
    data = self._fp.read(amt)
  File "/usr/lib/python3.5/http/client.py", line 448, in read
    n = self.readinto(b)
  File "/usr/lib/python3.5/http/client.py", line 488, in readinto
    n = self.fp.readinto(b)
  File "/usr/lib/python3.5/socket.py", line 575, in readinto
    return self._sock.recv_into(b)
  File "/usr/lib/python3.5/ssl.py", line 929, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/lib/python3.5/ssl.py", line 791, in read
    return self._sslobj.read(len, buffer)
  File "/usr/lib/python3.5/ssl.py", line 575, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/s3transfer/tasks.py", line 126, in __call__
    return self._execute_main(kwargs)
  File "/usr/lib/python3/dist-packages/s3transfer/tasks.py", line 150, in _execute_main
    return_value = self._main(**kwargs)
  File "/usr/lib/python3/dist-packages/s3transfer/download.py", line 518, in _main
    for chunk in chunks:
  File "/usr/lib/python3/dist-packages/s3transfer/download.py", line 646, in __next__
    chunk = self._body.read(self._chunksize)
  File "/usr/lib/python3/dist-packages/s3transfer/utils.py", line 491, in read
    value = self._stream.read(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/botocore/response.py", line 74, in read
    chunk = self._raw_stream.read(amt)
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 311, in read
    flush_decoder = True
  File "/usr/lib/python3.5/contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/lib/python3/dist-packages/urllib3/response.py", line 231, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='***-dumps.s3.amazonaws.com', port=443): Read timed out.
2018-01-16 11:46:25,321 - Thread-5 - s3transfer.futures - DEBUG - Submitting task IORenameFileTask(transfer_id=0, {'final_filename': '/home/test/abc.dump.gz'}) to executor <s3transfer.futures.BoundedExecutor object at 0x7f5e3d175208> for transfer request: 0.
2018-01-16 11:46:25,321 - Thread-5 - s3transfer.utils - DEBUG - Acquiring 0
2018-01-16 11:46:25,322 - Thread-5 - s3transfer.utils - DEBUG - Releasing acquire 0/None
2018-01-16 11:46:25,322 - Thread-13 - s3transfer.tasks - DEBUG - IORenameFileTask(transfer_id=0, {'final_filename': '/home/test/abc.dump.gz'}) about to wait for the following futures []
2018-01-16 11:46:25,322 - Thread-13 - s3transfer.tasks - DEBUG - IORenameFileTask(transfer_id=0, {'final_filename': '/home/test/abc.dump.gz'}) done waiting for dependent futures
2018-01-16 11:46:25,330 - Thread-13 - s3transfer.utils - DEBUG - Releasing acquire 0/None
download failed: s3://***-dumps/Tue/abc.dump.gz to ./abc.dump.gz HTTPSConnectionPool(host='***-dumps.s3.amazonaws.com', port=443): Read timed out.
2018-01-16 11:46:25,332 - Thread-1 - awscli.customizations.s3.results - DEBUG - Shutdown request received in result processing thread, shutting down result thread.

I too am having this problem with 1GB files (copying from s3 to local storage).

aws-cli/1.11.13 Python/3.5.2 Linux/4.4.0-72-generic botocore/1.4.70, using the us-east (N. Virginia) datacentre.

When I use s3 cp to copy a 1GB file from a bucket to local storage, the transfer occurs and at the very end (1013MiB transferred) things just stall and time out. I do not get the file. This is entirely repeatable, and playing with the multipart thresholds/chunksize and number of concurrent transfers doesn't do much, although I can get it to hang much earlier (anywhere from 130MB to 800MB) in the process with enough playing around.

I've also played with --cli-read-timeout but it seems the transfer has completed; it doesn't seem to be waiting for any more data.

Originally I was trying to restore a file from S3 through duplicity, but it was timing out. My testing and some help from the duplicity team led me to try the aws CLI, and here I am.

I am having the same trouble copying a single large binary file (10.9gb) from my s3 storage to my ec2 instance. Plenty of disk space on my ubuntu instance.

command was simplest form possible :
$aws s3 cp s3://folder-name/binary-filename ./local-dir-on-ec2/

It downloads like lightning until it reads something like "10.9gb of 10.9gb copied with 1 file remaining." and then the command is hung. No change. I waited 15 min. Restarted the same command about 8 times. Looked up this thread. Then went back after about 10 minutes, and did the same thing again. And this time, it completed the copy without hanging. !-??

Same thing happened with a second ~10gb binary file. Transfer appeared to go lightning fast and then hung up with appearance that all data had been copied. "10.4 gb of 10.4 gb copied with 1 file remaining." I tried three more times with exactly same command, and finally got the copy to work.

Amazon needs to fix this issue or s3 is of no real use to ec2 customers.

I have the same experience @tchrisboles describes.

I've also tried streaming the file: aws s3 cp s3://x/y -

This hangs usually after 3.8GB but it can be as little as 1.2GB and produces no output. My file has ~50GB in total.

Using lsof -i tcp:443, I can see 5 connections in state CLOSE_WAIT and one ESTABLISHED.

I have the same issue here, just try to download a big file from s3 to ec2 instance
progress looks fast at begin but close to end it hangs
debug log

utex(0x1494c10, FUTEX_WAKE_PRIVATE, 1) = 1
2018-11-02 22:54:16,168 - ThreadPoolExecutor-0_1 - s3transfer.futures - DEBUG - Submitting task IOWriteTask(transfer_id=0, {'offset': 2355363840}) to executor <s3transfer.futures.BoundedExecutor object at 0x7f18d1751c50> for transfer request: 0.
2018-11-02 22:54:16,168 - ThreadPoolExecutor-0_1 - s3transfer.utils - DEBUG - Acquiring 0
2018-11-02 22:54:16,168 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - IOWriteTask(transfer_id=0, {'offset': 2355363840}) about to wait for the following futures []
2018-11-02 22:54:16,168 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - IOWriteTask(transfer_id=0, {'offset': 2355363840}) done waiting for dependent futures
2018-11-02 22:54:16,169 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - Executing task IOWriteTask(transfer_id=0, {'offset': 2355363840}) with kwargs {'fileobj': <s3transfer.utils.DeferredOpenFile object at 0x7f18d0f03e50>, 'offset': 2355363840}
2018-11-02 22:54:16,169 - ThreadPoolExecutor-2_0 - s3transfer.utils - DEBUG - Releasing acquire 0/None
2018-11-02 22:54:16,170 - ThreadPoolExecutor-0_1 - s3transfer.futures - DEBUG - Submitting task IOWriteTask(transfer_id=0, {'offset': 2355625984}) to executor <s3transfer.futures.BoundedExecutor object at 0x7f18d1751c50> for transfer request: 0.
2018-11-02 22:54:16,170 - ThreadPoolExecutor-0_1 - s3transfer.utils - DEBUG - Acquiring 0
2018-11-02 22:54:16,170 - ThreadPoolExecutor-0_1 - s3transfer.futures - DEBUG - Submitting task IOWriteTask(transfer_id=0, {'offset': 2355888128}) to executor <s3transfer.futures.BoundedExecutor object at 0x7f18d1751c50> for transfer request: 0.
2018-11-02 22:54:16,171 - ThreadPoolExecutor-0_1 - s3transfer.utils - DEBUG - Acquiring 0
2018-11-02 22:54:16,171 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - IOWriteTask(transfer_id=0, {'offset': 2355625984}) about to wait for the following futures []
2018-11-02 22:54:16,171 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - IOWriteTask(transfer_id=0, {'offset': 2355625984}) done waiting for dependent futures
2018-11-02 22:54:16,172 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - Executing task IOWriteTask(transfer_id=0, {'offset': 2355625984}) with kwargs {'fileobj': <s3transfer.utils.DeferredOpenFile object at 0x7f18d0f03e50>, 'offset': 2355625984}
2018-11-02 22:54:16,172 - ThreadPoolExecutor-2_0 - s3transfer.utils - DEBUG - Releasing acquire 0/None
2018-11-02 22:54:16,172 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - IOWriteTask(transfer_id=0, {'offset': 2355888128}) about to wait for the following futures []
2018-11-02 22:54:16,172 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - IOWriteTask(transfer_id=0, {'offset': 2355888128}) done waiting for dependent futures
2018-11-02 22:54:16,172 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - Executing task IOWriteTask(transfer_id=0, {'offset': 2355888128}) with kwargs {'fileobj': <s3transfer.utils.DeferredOpenFile object at 0x7f18d0f03e50>, 'offset': 2355888128}
2018-11-02 22:54:16,173 - ThreadPoolExecutor-2_0 - s3transfer.utils - DEBUG - Releasing acquire 0/None
2018-11-02 22:54:16,173 - ThreadPoolExecutor-0_1 - s3transfer.futures - DEBUG - Submitting task IOWriteTask(transfer_id=0, {'offset': 2356150272}) to executor <s3transfer.futures.BoundedExecutor object at 0x7f18d1751c50> for transfer request: 0.
2018-11-02 22:54:16,173 - ThreadPoolExecutor-0_1 - s3transfer.utils - DEBUG - Acquiring 0
2018-11-02 22:54:16,174 - ThreadPoolExecutor-0_1 - s3transfer.futures - DEBUG - Submitting task IOWriteTask(transfer_id=0, {'offset': 2356412416}) to executor <s3transfer.futures.BoundedExecutor object at 0x7f18d1751c50> for transfer request: 0.
2018-11-02 22:54:16,174 - ThreadPoolExecutor-0_1 - s3transfer.utils - DEBUG - Acquiring 0
2018-11-02 22:54:16,174 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - IOWriteTask(transfer_id=0, {'offset': 2356150272}) about to wait for the following futures []
2018-11-02 22:54:16,174 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - IOWriteTask(transfer_id=0, {'offset': 2356150272}) done waiting for dependent futures
2018-11-02 22:54:16,175 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - Executing task IOWriteTask(transfer_id=0, {'offset': 2356150272}) with kwargs {'fileobj': <s3transfer.utils.DeferredOpenFile object at 0x7f18d0f03e50>, 'offset': 2356150272}
2018-11-02 22:54:16,175 - ThreadPoolExecutor-2_0 - s3transfer.utils - DEBUG - Releasing acquire 0/None
2018-11-02 22:54:16,175 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - IOWriteTask(transfer_id=0, {'offset': 2356412416}) about to wait for the following futures []
2018-11-02 22:54:16,175 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - IOWriteTask(transfer_id=0, {'offset': 2356412416}) done waiting for dependent futures
2018-11-02 22:54:16,175 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - Executing task IOWriteTask(transfer_id=0, {'offset': 2356412416}) with kwargs {'fileobj': <s3transfer.utils.DeferredOpenFile object at 0x7f18d0f03e50>, 'offset': 2356412416}
2018-11-02 22:54:16,176 - ThreadPoolExecutor-2_0 - s3transfer.utils - DEBUG - Releasing acquire 0/None
) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}2018-11-02 22:55:08,281 - ThreadPoolExecutor-0_1 - s3transfer.futures - DEBUG - Submitting task IOWriteTask(transfer_id=0, {'offset': 2356674560}) to executor <s3transfer.futures.BoundedExecutor object at 0x7f18d1751c50>
 for transfer request: 0.
2018-11-02 22:55:08,281 - ThreadPoolExecutor-0_1 - s3transfer.utils - DEBUG - Acquiring 0
2018-11-02 22:55:08,282 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - IOWriteTask(transfer_id=0, {'offset': 2356674560}) about to wait for the following futures []
2018-11-02 22:55:08,282 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - IOWriteTask(transfer_id=0, {'offset': 2356674560}) done waiting for dependent futures
2018-11-02 22:55:08,282 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - Executing task IOWriteTask(transfer_id=0, {'offset': 2356674560}) with kwargs {'fileobj': <s3transfer.utils.DeferredOpenFile object at 0x7f18d0f03e50>, 'offset': 2356674560}
2018-11-02 22:55:08,283 - ThreadPoolExecutor-2_0 - s3transfer.utils - DEBUG - Releasing acquire 0/None
) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}2018-11-02 22:55:22,374 - ThreadPoolExecutor-0_7 - s3transfer.futures - DEBUG - Submitting task IOWriteTask(transfer_id=0, {'offset': 2306080768}) to executor <s3transfer.futures.BoundedExecutor object at 0x7f18d1751c50>
 for transfer request: 0.
2018-11-02 22:55:22,375 - ThreadPoolExecutor-0_7 - s3transfer.utils - DEBUG - Acquiring 0
2018-11-02 22:55:22,375 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - IOWriteTask(transfer_id=0, {'offset': 2306080768}) about to wait for the following futures []
2018-11-02 22:55:22,375 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - IOWriteTask(transfer_id=0, {'offset': 2306080768}) done waiting for dependent futures
2018-11-02 22:55:22,375 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - Executing task IOWriteTask(transfer_id=0, {'offset': 2306080768}) with kwargs {'fileobj': <s3transfer.utils.DeferredOpenFile object at 0x7f18d0f03e50>, 'offset': 2306080768}
2018-11-02 22:55:22,376 - ThreadPoolExecutor-2_0 - s3transfer.utils - DEBUG - Releasing acquire 0/None
) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
select(0, NULL, NULL, NULL, {0, 50000}) = 0 (Timeout)
lsof -i tcp:443
COMMAND  PID     USER   FD   TYPE    DEVICE SIZE/OFF NODE NAME
aws     8731 user    3u  IPv4 123763459      0t0  TCP container1:39776->s3-1-w.amazonaws.com:https (CLOSE_WAIT)
aws     8731 user    4u  IPv4 123763461      0t0  TCP container1:33106->s3-1-w.amazonaws.com:https (ESTABLISHED)
aws     8731 user    5u  IPv4 123763468      0t0  TCP container1:59644->s3-1-w.amazonaws.com:https (ESTABLISHED)
aws     8731 user   11u  IPv4 123763466      0t0  TCP container1:32926->s3-1-w.amazonaws.com:https (ESTABLISHED)
aws     8731 user   13u  IPv4 123763467      0t0  TCP container1:36094->s3-1-w.amazonaws.com:https (ESTABLISHED)
aws     8731 user   16u  IPv4 123762563      0t0  TCP container1:58426->s3-1-w.amazonaws.com:https (ESTABLISHED)

also downloaded file size on filesystem is different from size shown in terminal by cli
aws show thad was downloaded almost whole file 4.0Gb of 4.1Gb but the size of part on disk is less(often about 2-3Gb and slow increasing)

Same experience with downloading a large (3.1GB) file to an EC2 instance.

aws --version
aws-cli/1.15.71 Python/2.7.15rc1 Linux/4.15.0-1023-aws botocore/1.10.70

Doing --debug on my aws s3 cp command to download a single file to local folder (where I have permissions _and_ enough space) hangs and very slowly repeats this chunk at the end:

2018-11-12 21:43:16,180 - ThreadPoolExecutor-0_3 - s3transfer.futures - DEBUG - Submitting task IOWriteTask(transfer_id=0, {'offset': 1529610240}) to executor <s3transfer.futures.BoundedExecutor object at 0x7f0df3fcfc90> for transfer request: 0.
2018-11-12 21:43:16,181 - ThreadPoolExecutor-0_3 - s3transfer.utils - DEBUG - Acquiring 0
2018-11-12 21:43:16,181 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - IOWriteTask(transfer_id=0, {'offset': 1529610240}) about to wait for the following futures []
2018-11-12 21:43:16,181 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - IOWriteTask(transfer_id=0, {'offset': 1529610240}) done waiting for dependent futures
2018-11-12 21:43:16,181 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - Executing task IOWriteTask(transfer_id=0, {'offset': 1529610240}) with kwargs {'fileobj': <s3transfer.utils.DeferredOpenFile object at 0x7f0df4009490>, 'offset': 1529610240}
2018-11-12 21:43:16,182 - ThreadPoolExecutor-2_0 - s3transfer.utils - DEBUG - Releasing acquire 0/None
2018-11-12 21:43:22,678 - ThreadPoolExecutor-0_4 - s3transfer.futures - DEBUG - Submitting task IOWriteTask(transfer_id=0, {'offset': 1491337216}) to executor <s3transfer.futures.BoundedExecutor object at 0x7f0df3fcfc90> for transfer request: 0.
2018-11-12 21:43:22,678 - ThreadPoolExecutor-0_4 - s3transfer.utils - DEBUG - Acquiring 0
2018-11-12 21:43:22,679 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - IOWriteTask(transfer_id=0, {'offset': 1491337216}) about to wait for the following futures []
2018-11-12 21:43:22,679 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - IOWriteTask(transfer_id=0, {'offset': 1491337216}) done waiting for dependent futures
2018-11-12 21:43:22,679 - ThreadPoolExecutor-2_0 - s3transfer.tasks - DEBUG - Executing task IOWriteTask(transfer_id=0, {'offset': 1491337216}) with kwargs {'fileobj': <s3transfer.utils.DeferredOpenFile object at 0x7f0df4009490>, 'offset': 1491337216}
2018-11-12 21:43:22,679 - ThreadPoolExecutor-2_0 - s3transfer.utils - DEBUG - Releasing acquire 0/None

From what I can tell, the file is downloaded completely, but the command never finishes, cleans up, and properly renames the file.

One of aws support staff said

S3 sync should be a suitable alternative to rsync's --partial, because S3 sync is able to pick up the copy from where it left off, without having to recopy all the previous data.

But in my case, the unfinished file was deleted by the aws command, so sync doesn't restart the copy from where the error happened.

Then another support staff gave us a work around, it might help:

You could use "get-object" with —range option to achieve a functionality similar to rsync with “—partial” option. You can use — range object to downloads the specified range bytes of an object.

https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html

Suppose, your object is of 100 bytes, then, you can download the first 50 bytes using the following command,

aws s3api get-object --bucket --key --range bytes=0-49 a_1

Then you can download the last 50 bytes using the following command.

aws s3api get-object --bucket --key --range bytes=50-99 a_2

You can then use linux cat command in the following way to merge both the chunks ‘a_1' and ‘a_2' to get “merged_file” file:

cat a_1 a_2 > merged_file.extension

Sometimes it appears to hang, but doing a single CTRL+C will refresh the window and show progress,

I am trying to copy file from on premise to S3 using AWS S3 sync or cp. If the file size is small the files get uploaded quickly on S3 bucket. But if the file size is from 900MB 9GB it is stuckying nearly 15% file upload and upload process stopping with error. I tried two difference computers in the network but the same issue. Unable to to resolve this issue. I uploaded the AWS version. but no success at all.

Was this page helpful?
0 / 5 - 0 ratings