Skip to content

UnexpectedExit Exit code: None from invoke.run #695

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

Closed
jdonnelly-apixio opened this issue Jan 29, 2020 · 3 comments
Closed

UnexpectedExit Exit code: None from invoke.run #695

jdonnelly-apixio opened this issue Jan 29, 2020 · 3 comments

Comments

@jdonnelly-apixio
Copy link

Hey,

I am using centos 7, python3.6.8, invoke 1.4.0 and I am getting a weird intermittent UnexpectedExit error when using run from invoke. I've tried digging through an strace, but I couldn't find any pattern with the ones that fail or anything else interesting. For the process that was said to have returned an exit code of None, I confirmed it exits with 0 in the strace output.
Is there any other info that would be useful?

To reproduce, I just run:

import traceback
import time
import datetime
from invoke import run
error_count = 0
for i in range(0,10000):
    time.sleep(0.15)
    print(str(datetime.datetime.now()) + " - " + str(time.time()) + " - on attempt: " + str(i))
    try:
        result = run("rm -f /tmp/idfkidfk")
        if result.return_code != 0:
            raise Exception("WTF!!!!")
    except Exception as e:
        print(str(datetime.datetime.now()) + " - " + str(time.time()) + " - Hit exception:\n" + traceback.format_exc())
        error_count += 1

And it seems to throw one of these every few hundred attempts or so:

2020-01-28 18:20:11.132695 - 1580264411.1327217 - on attempt: 307
2020-01-28 18:20:11.307360 - 1580264411.3073883 - on attempt: 308
2020-01-28 18:20:11.483637 - 1580264411.4836638 - on attempt: 309
2020-01-28 18:20:11.497629 - 1580264411.4976513 - Hit exception:
Traceback (most recent call last):
  File "idfk.py", line 10, in <module>
    result = run("rm -f /tmp/idfkidfk")
  File "/root/.pyenv/versions/3.6.8/lib/python3.6/site-packages/invoke/__init__.py", line 48, in run
    return Context().run(command, **kwargs)
  File "/root/.pyenv/versions/3.6.8/lib/python3.6/site-packages/invoke/context.py", line 94, in run
    return self._run(runner, command, **kwargs)
  File "/root/.pyenv/versions/3.6.8/lib/python3.6/site-packages/invoke/context.py", line 101, in _run
    return runner.run(command, **kwargs)
  File "/root/.pyenv/versions/3.6.8/lib/python3.6/site-packages/invoke/runners.py", line 363, in run
    return self._run_body(command, **kwargs)
  File "/root/.pyenv/versions/3.6.8/lib/python3.6/site-packages/invoke/runners.py", line 422, in _run_body
    return self.make_promise() if self._asynchronous else self._finish()
  File "/root/.pyenv/versions/3.6.8/lib/python3.6/site-packages/invoke/runners.py", line 489, in _finish
    raise UnexpectedExit(result)
invoke.exceptions.UnexpectedExit: Encountered a bad command exit code!

Command: 'rm -f /tmp/idfkidfk'

Exit code: None

Stdout: already printed

Stderr: already printed

2020-01-28 18:20:11.648929 - 1580264411.6489484 - on attempt: 310
2020-01-28 18:20:11.823539 - 1580264411.8235662 - on attempt: 311

Thanks,
Jon

@florisla
Copy link
Contributor

This seems to be the same error as #683 and #660 .

This is fixed in master and will be part of the next release. It affects released versions 1.3.0 and 1.4.0 .

You can revert to version 1.2.0 to check.

pip install "invoke !=1.3.0 , !=1.4.0"

@bitprophet
Copy link
Member

@florisla is correct, this is about to get a bugfix release, please watch #660. Thanks!

@jdonnelly-apixio
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants