-
Notifications
You must be signed in to change notification settings - Fork 361
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.builtin.shell
invocations through ansible-runner sometimes do not return documented return values
#1381
Comments
I've got my suspicions where the problem lies, but would it be possible for you to |
I will do that and let you know what it looks like the next time the issue reoccurs. |
The issue has reoccured, and the |
Please let me know if you need any further information |
Hmm, not what I would've expected, but at least narrows it down- that means the issue is likely ansible-core... I don't suppose you have a repro that we'd be able to try here? |
I do not currently have a small repro, but I will try to get one for you. |
We were chatting about this one today when @s-hertel pointed out an interesting possibility: the |
Interesting... I will investigate to see if that is a potential cause. It's possible the script we are running has a large amount of output in some cases, and that would also explain why it always happens to the same machines... If that is the case, I assume that's not a bug so much as user error on our part? |
Arguably a little of both? From our end, I don't think that setting is documented, nor does it do a very good job, since in most cases there will be at least two more copies of the same data in the payload that aren't omitted. #1386 would at least allow someone to know that their task result payload was elided, and in the future we should have a facility for the callback to emit a job-level warning that it occurred as well. |
Can the |
We have confirmed that the root cause of the issue was our script logging too much during an error handling event that only ever occurred on certain machines. By reducing this logging (and also by increasing |
We are observing that when we invoke the
ansible.builtin.shell
module viaansible_runner.run
, theres
field ofrunner_on_ok
events is sometimes an empty dict, despite the documentation for theansible.builtin.shell
module claiming that it always returns certain values. We are usingansible-core
version 2.16.6 andansible-runner
version 2.3.6.We use
ansible-runner
to invokeansible.builtin.shell
to run a script on 15 machines simultaneously. When we do this, we usually have no problems, the script succeeds on every machine, and we see that the theres
dict of therunner_on_ok
events contain the fields documented inansible.builtin.shell
. On occasion (maybe 1/4 of the time?) we will see that theres
dict of therunner_on_ok
events for some machines is empty, while is is populated for the rest of the machines. Each time this happens, it is the same two machines that have emptyres
dicts. When we examine the logs, it is clear that the script has also run successfully on those machines, which is consistent with the fact we get arunner_on_ok
event from them as well.This is extremely confusing as the scripts are running correctly and we are getting a
runner_on_ok
event, but it is missing the fields that the module is documented to always return. This means that we don't get the return code, stdout, or stderr, which we need later.We know that the underlying issue is the event having an empty
res
dict as we log theres
of every terminal event (runner_on_unreachable
,runner_on_failed
,runner_on_ok
) and we see that for these machines there is sometimes an emptyres
dict ({}
) while for all the other machines there is a correctly populatedres
dict like:The text was updated successfully, but these errors were encountered: