Skip to content

pexpect.exceptions.TIMEOUT due to child.expect(pexpect.EOF, timeout=5) #1343

@tchernomax

Description

@tchernomax

Hello

We are running a lot of CI with ansible-runner and since we move to ansible_runner 2.3.5, on some of them we experience this:

  File "/usr/local/lib/python3.11/dist-packages/ansible_runner/__main__.py", line 874, in main
    res = run(**run_options)
          ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/ansible_runner/interface.py", line 210, in run
    r.run()
  File "/usr/local/lib/python3.11/dist-packages/ansible_runner/runner.py", line 348, in run
    child.expect(pexpect.EOF, timeout=5)
  File "/usr/local/lib/python3.11/dist-packages/pexpect/spawnbase.py", line 354, in expect
    return self.expect_list(compiled_pattern_list,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/pexpect/spawnbase.py", line 383, in expect_list
    return exp.expect_loop(timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/pexpect/expect.py", line 181, in expect_loop
    return self.timeout(e)
           ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/pexpect/expect.py", line 144, in timeout
    raise exc
pexpect.exceptions.TIMEOUT: <pexpect.pty_spawn.spawn object at 0x7f10538a7c90>

Some CI jobs works (with ansible_runner 2.3.5), some don't (also with ansible_runner 2.3.5), and those who don't always fail (a relaunch doesn't change anything).

I think the problem comes from the fact that child.expect(pexpect.EOF, timeout=5) never encounter pexpect.EOF in the child output.

It might be because the pexpect.spawn fails so child.expect(pexpect.EOF, timeout=5) has no output to find EOF (just guessing, I don't know much about pexpect).

Regards

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions