Skip to content
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

Mitogen eats stderr on async tasks #540

Closed
jbscare opened this Issue Feb 13, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@jbscare
Copy link

commented Feb 13, 2019

This playbook:

- hosts: localhost
  tasks: 

    - command: ls -Fla /file/not/found
      register: ls_result 
      failed_when: False 

    - debug: var=ls_result 
 
    - command: ls -Fla /file/not/found 
      async: 3600 
      poll: 1 
      register: ls_result 
      failed_when: False 

    - debug: var=ls_result 

With Mitogen (master as of earlier today, 5c5e9fb I believe):

TASK [command] *****************************************************************
changed: [localhost]

TASK [debug] *******************************************************************
ok: [localhost] => {
    "ls_result": {
        "changed": true, 
        "cmd": [
            "ls", 
            "-Fla", 
            "/file/not/found"
        ], 
        "delta": "0:00:00.003293", 
        "end": "2019-02-12 21:50:35.381540", 
        "failed": false, 
        "failed_when_result": false, 
        "msg": "non-zero return code", 
        "rc": 2, 
        "start": "2019-02-12 21:50:35.378247", 
        "stderr": "ls: cannot access /file/not/found: No such file or directory", 
        "stderr_lines": [
            "ls: cannot access /file/not/found: No such file or directory"
        ], 
        "stdout": "", 
        "stdout_lines": []
    }
}

TASK [command] *****************************************************************
changed: [localhost]

TASK [debug] *******************************************************************
ok: [localhost] => {
    "ls_result": {
        "ansible_job_id": "b445f6d9bb68bfc5", 
        "changed": true, 
        "cmd": [
            "ls", 
            "-Fla", 
            "/file/not/found"
        ], 
        "data": "", 
        "delta": "0:00:00.003631", 
        "end": "2019-02-12 21:50:35.519720", 
        "failed": false, 
        "failed_when_result": false, 
        "finished": 1, 
        "msg": "non-zero return code", 
        "rc": 2, 
        "start": "2019-02-12 21:50:35.516089", 
        "stderr": "", 
        "stderr_lines": [], 
        "stdout": "", 
        "stdout_lines": [], 
        "warnings": []
    }
}

Note that the stderr and stderr_lines parameters are empty for the second task, identical to the first except for async.

With the default linear strategy:

TASK [command] *****************************************************************
changed: [localhost]

TASK [debug] *******************************************************************
ok: [localhost] => {
    "ls_result": {
        "changed": true, 
        "cmd": [
            "ls", 
            "-Fla", 
            "/file/not/found"
        ], 
        "delta": "0:00:00.004674", 
        "end": "2019-02-12 21:51:46.849912", 
        "failed": false, 
        "failed_when_result": false, 
        "msg": "non-zero return code", 
        "rc": 2, 
        "start": "2019-02-12 21:51:46.845238", 
        "stderr": "ls: cannot access /file/not/found: No such file or directory", 
        "stderr_lines": [
            "ls: cannot access /file/not/found: No such file or directory"
        ], 
        "stdout": "", 
        "stdout_lines": []
    }
}

TASK [command] *****************************************************************
changed: [localhost]

TASK [debug] *******************************************************************
ok: [localhost] => {
    "ls_result": {
        "ansible_job_id": "655299817323.34046", 
        "changed": true, 
        "cmd": [
            "ls", 
            "-Fla", 
            "/file/not/found"
        ], 
        "delta": "0:00:00.004541", 
        "end": "2019-02-12 21:51:47.121374", 
        "failed": false, 
        "failed_when_result": false, 
        "finished": 1, 
        "msg": "non-zero return code", 
        "rc": 2, 
        "start": "2019-02-12 21:51:47.116833", 
        "stderr": "ls: cannot access /file/not/found: No such file or directory", 
        "stderr_lines": [
            "ls: cannot access /file/not/found: No such file or directory"
        ], 
        "stdout": "", 
        "stdout_lines": []
    }
}

Note identical (except for datestamps, pedantic people) output for both.

@dw

This comment has been minimized.

Copy link
Owner

commented Feb 13, 2019

This is definitely #497. I'll see if there's more the extension can do here

@dw

This comment has been minimized.

Copy link
Owner

commented Feb 13, 2019

Thanks for reporting!

@dw dw closed this in 1c955a9 Feb 13, 2019

dw added a commit that referenced this issue Feb 13, 2019

Merge commit '1c955a98768c07de68bb6705f8f4dc1c5afeea86'
* commit '1c955a98768c07de68bb6705f8f4dc1c5afeea86':
  ansible: capture stderr stream of async tasks. Closes #540.

dw added a commit that referenced this issue Feb 14, 2019

Merge remote-tracking branch 'origin/dmw' into stable
* origin/dmw:
  issue #537: disable just the trivial LinuxPolicyTest on Travis.
  docs: update Changelog; closes #537.
  ansible: refactor affinity class and add abstract tests.
  Bump version for release.
  docs: update Changelog.
  core: serialize calls to _service_stub_main().
  docs: update Changelog; closes #532.
  issue #532: PushFileService race.
  docs: more concise Changelog.
  issue #541: changelog typos.
  ansible: quiesce boto logger; closes #541.
  docs: update Changelog.
  tests/ansible: Spec.port() test & mitogen_via= fix.
  Update copyright year everywhere.
  tests/ansible: Spec.become_pass() test.
  docs: remove top "Table of Contents" link
  docs: remove a little more top margin wastage
  tests/ansible: Spec.become_user() test.
  docs: update Changelog; closes #539.
  issue #539: disable logger propagation.
  ansible: capture stderr stream of async tasks. Closes #540.
  docs: update Changelog.
  issue #536: rework how 2.3-compatible simplejson is served
  .github: add some more questions to issue template
  docs: duplicate word
  docs: update Changelog.
  tests/ansible: Spec.become_method() test & mitogen_via= fix.
  setup.py: include LICENSE; closes #538.
  tests/ansible: Spec.become() test
  tests/ansible: Spec.password() test, document interactive pw limitation.
  tests/ansible: Spec.remote_user() test & mitogen_via= fix.
  tests/ansible: Spec.remote_addr() test & mitogen_via= fix.
  tests/ansible: Spec.transport() test.
  docs: lighter pink
  docs: add 'Fixes' heading
  docs: more margin tweaks for changelog
  docs: tighter <p> margins, even less shouting, red headings
  docs: tidy up footer and GitHub link
  docs: enable fixed_sidebar
  docs: sans-serif fonts, reduce shouty headings
  issue #536: add mitogen_via= tests too.
  ansible: fix a crash on 2.3 when mitogen_via= host is missing.
  tests: for 2.3 compatibility, disable gcloud.py for now
  docs: update Changelog; closes #511, closes #536.
  docs: update Changelog release date.
  issue #536: disable transport_config tests on vanilla
  issue #536: restore correct Python interpreter selection behaviour.
  issue #536: connection_delegation/ tests were erroneously broken
  tests: define MITOGEN_INVENTORY_FILE even if -i unspecified.
  issue #536: add tests for each ansible_python_interpreter case.
  issue #536: stop defining explicit localhost in inventory.
  tests: allow running Ansible tests locally without -udmw again.
  stable: fix preamble_size on stable docs.
  issue #481: add test.
@dw

This comment has been minimized.

Copy link
Owner

commented Feb 14, 2019

0.2.5 is on PyPI now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.