Issue 1:
ISSUE TYPE: Bug Report

COMPONENT NAME: win_copy module

ANSIBLE VERSION

ansible 2.2.0.0

config file = /etc/ansible/ansible.cfg

configured module search path = Default w/o overrides

CONFIGURATION

No changes

OS / ENVIRONMENT

Ubuntu 16.04 with ansible/ansible PPA

SUMMARY

When copying a large file from local to a remote host, ansible crashed. Looks like a regression from fix #16392. Proposed fix worked in 2.1, however when updating to 2.2 the bug resurfaced despite having the fix merged.

STEPS TO REPRODUCE

- name: Copy large file
win_copy:
src: largeinstallerfile2GB.zip
dest: 'c:\install'

ACTUAL RESULTS

TASK [windows : Copy largeinstallerfile2GB.zip] ***

task path: /root/ansible-test/roles/windows/tasks/install.yml:6

An exception occurred during task execution. The full traceback is:

Traceback (most recent call last):

File "/usr/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 119, in run

res = self._execute()

File "/usr/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 490, in _execute

result = self._handler.run(task_vars=variables)

File "/usr/lib/python2.7/dist-packages/ansible/plugins/action/copy.py", line 153, in run

source_full = self._loader.get_real_file(source_full)

File "/usr/lib/python2.7/dist-packages/ansible/parsing/dataloader.py", line 402, in get_real_file

if is_encrypted_file(f):

File "/usr/lib/python2.7/dist-packages/ansible/parsing/vault/init.py", line 158, in is_encrypted_file

b_vaulttext = to_bytes(to_text(vaulttext, encoding='ascii', errors='strict'), encoding='ascii', errors='strict')

File "/usr/lib/python2.7/dist-packages/ansible/module_utils/_text.py", line 177, in to_text

return obj.decode(encoding, errors)

MemoryError

fatal: [ago-win1]: FAILED! => {

"failed": true,

"msg": "Unexpected failure during module execution.",

"stdout": ""

}

Issue 2:
ISSUE TYPE

Bug Report

ANSIBLE VERSION

ansible 2.1.0.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides

CONFIGURATION

OS / ENVIRONMENT

Ubuntu 14.04.4 LTS

SUMMARY

Got MemoryError when copy huge local file to remote.

STEPS TO REPRODUCE

$ cat huge_copy.yml

---
- hosts: all
become: yes

tasks:
- name: Copy huge file
copy: src=5gb dest=dst

$ dd if=/dev/zero of=5gb bs=1G count=5
5+0 records in
5+0 records out
5368709120 bytes (5.4 GB) copied, 206.341 s, 26.0 MB/s

$ ansible-playbook -i hosts huge_copy.yml

EXPECTED RESULTS

Copied successfully.

ACTUAL RESULTS

$ ansible-playbook -i hosts huge_copy.yml -vvv
Using /etc/ansible/ansible.cfg as config file

PLAYBOOK: huge_copy.yml ********************************************************
1 plays in huge_copy.yml

PLAY [all] *********************************************************************

TASK [setup] *******************************************************************
<192.168.80.129> ESTABLISH SSH CONNECTION FOR USER: ansible
<192.168.80.129> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 -o ControlPath=/home/y/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.80.129 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1466567672.43-71840509019686 `" && echo ansible-tmp-1466567672.43-71840509019686="` echo $HOME/.ansible/tmp/ansible-tmp-1466567672.43-71840509019686 `" ) && sleep 0'"'"''
<192.168.80.129> PUT /tmp/tmp3Bk56k TO /home/ansible/.ansible/tmp/ansible-tmp-1466567672.43-71840509019686/setup
<192.168.80.129> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 -o ControlPath=/home/y/.ansible/cp/ansible-ssh-%h-%p-%r '[192.168.80.129]'
<192.168.80.129> ESTABLISH SSH CONNECTION FOR USER: ansible
<192.168.80.129> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 -o ControlPath=/home/y/.ansible/cp/ansible-ssh-%h-%p-%r -tt 192.168.80.129 '/bin/sh -c '"'"'sudo -H -S -n -u root /bin/sh -c '"'"'"'"'"'"'"'"'echo BECOME-SUCCESS-rmwgnaejatjdbjwnltokljxsdjjlhagx; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1466567672.43-71840509019686/setup; rm -rf "/home/ansible/.ansible/tmp/ansible-tmp-1466567672.43-71840509019686/" > /dev/null 2>&1'"'"'"'"'"'"'"'"' && sleep 0'"'"''
ok: [192.168.80.129]

TASK [Copy huge file] **********************************************************
task path: /home/y/nfvdv4-single/huge_copy.yml:6
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 124, in run
res = self._execute()
File "/usr/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 446, in _execute
result = self._handler.run(task_vars=variables)
File "/usr/lib/python2.7/dist-packages/ansible/plugins/action/copy.py", line 156, in run
source_full = self._loader.get_real_file(source_full)
File "/usr/lib/python2.7/dist-packages/ansible/parsing/dataloader.py", line 334, in get_real_file
data = f.read()
MemoryError

fatal: [192.168.80.129]: FAILED! => {"failed": true, "msg": "Unexpected failure during module execution.", "stdout": ""}

NO MORE HOSTS LEFT *************************************************************
to retry, use: --limit @huge_copy.retry

PLAY RECAP *********************************************************************
192.168.80.129 : ok=1 changed=0 unreachable=0 failed=1