New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ansible MemoryError when using shell module in playbook #49610

Open
nvaklinov opened this Issue Dec 6, 2018 · 5 comments

Comments

Projects
None yet
3 participants
@nvaklinov

nvaklinov commented Dec 6, 2018

Ansible MemoryError when using shell module in playbook

Ansible MemoryError when using shell module in playbook to import mongodb json collection. I do have 16 GB of ram and in htop whenever I run the playbook on the target machine i see the ram going up to 4 GB but there are more than 10GB free.

I changed the python interpeter as well as combined and mixed modules but still does not work. An exception occurred during task execution. To see the full traceback, use -vvv. The error was: MemoryError

Issue happened as this file json got 1.2 GB a week ago was 500MB and it worked not it doesn't. When I run it manually it imports it but trough python it can't, in the -vvv option I see that the documents were imported but ansible exits with this error...

ansible version 2.7.4 python tried 2.7 and 3.6 the target machine is Ubuntu 18.04

MongoDB 3.2

Thank you

COMPONENT NAME

shell

OS / ENVIRONMENT

CentOS 7 master -> Ubuntu 18.04 target

@ansibot

This comment has been minimized.

Contributor

ansibot commented Dec 6, 2018

@nvaklinov: Greetings! Thanks for taking the time to open this issue. In order for the community to handle your issue effectively, we need a bit more information.

Here are the items we could not find in your description:

  • component name

Please set the description of this issue with this template:
https://raw.githubusercontent.com/ansible/ansible/devel/.github/ISSUE_TEMPLATE.md

click here for bot help

@nvaklinov

This comment has been minimized.

nvaklinov commented Dec 6, 2018

Thank you for helping me!

Here below I posted the part that fails in my playbook.

Again, thank you very much for your priceless time!

- hosts: MongoDB
  tasks:
     - name: copy file from local to MongoDB
       synchronize:
               src: /home/temp/events.json
               dest: /home/ubuntu/mongo/
               mode: push

     - name: import the events into the DB
       shell: mongoimport --db parties --collection events --file /home/ubuntu/mongo/events.json && rm -rf /home/ubuntu/mongo/events.json
       register: bash_result
       become: yes
       become_method: sudo
@jctanner

This comment has been minimized.

Member

jctanner commented Dec 6, 2018

@nvaklinov no error is in the description. Please add the full -vvvv output.

needs_info

@jctanner jctanner added performance and removed needs_triage labels Dec 6, 2018

@ansibot ansibot added module and removed needs_template labels Dec 6, 2018

@nvaklinov

This comment has been minimized.

nvaklinov commented Dec 6, 2018

Actually this is the error message: An exception occurred during task execution. To see the full traceback, use -vvv. The error was: MemoryError

If I put -vvv the output become ambiguous due to the fact that Mongo produces simply the output of the data insertion however the error is the above.

@ansibot ansibot removed the needs_info label Dec 6, 2018

@nvaklinov

This comment has been minimized.

nvaklinov commented Dec 7, 2018

The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 139, in run
    res = self._execute()
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 603, in _execute
    result = self._handler.run(task_vars=variables)
  File "/usr/lib/python2.7/site-packages/ansible/plugins/action/shell.py", line 27, in run
    result = command_action.run(task_vars=task_vars)
  File "/usr/lib/python2.7/site-packages/ansible/plugins/action/command.py", line 24, in run
    results = merge_hash(results, self._execute_module(task_vars=task_vars, wrap_async=wrap_async))
  File "/usr/lib/python2.7/site-packages/ansible/plugins/action/__init__.py", line 842, in _execute_module
    data = self._parse_returned_data(res)
  File "/usr/lib/python2.7/site-packages/ansible/plugins/action/__init__.py", line 879, in _parse_returned_data
    data = json.loads(filtered_output)
  File "/usr/lib64/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python2.7/json/decoder.py", line 382, in raw_decode
    obj, end = self.scan_once(s, idx)
MemoryError

fatal: [52.58.171.82]: FAILED! => {
    "msg": "Unexpected failure during module execution.",
    "stdout": ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment