You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On a fresh Windows VM, (with a fresh user profile specifically), running pwsh.exe for the first time takes 20-30s to complete. The above timeout causes a win_powershell task with executable: pwsh.exe set to fail several times with the exception noted below before eventually succeeding.
Odd issue as this only happens on the very first invocation of a pwsh task on a VM. Subsequent runs, even after rebooting, do not exhibit the failure. The actual content of the task doesn't seem to matter.
I did confirm the issue by changing the timeout up to 60s, which eliminated the problem. I can put in a PR for that if it makes sense. As far as I've seen, that timeout causes the task to fail so increasing it would only have a performance penalty when the task was going to fail anyways. I don't know why such a relatively short timeout was used originally.
Ansible running under AWX on Centos Stream 9
Target machines are Windows Server 2022
All are AWS EC2 instances
STEPS TO REPRODUCE
Any win_powershell task with executable: pwsh.exe set. BUT please note it only happens the first time it's run on a fresh VM/fresh user profile and very likely depends on the target machine's performance characteristics.
Thanks for the in depth issue and for covering all the bases here. I think adjusting the timeout to 60 seconds should be ok, anything beyond that would probably need to be looked into further as we don't want a failed process to block a task for a longer time.
A potential alternative would be to see if the process has exited and fail before the 60 seconds but that might be a bit more complex to achieve.
SUMMARY
There's a 5s timeout when using the
executable
parameter in awin_powershell
task:ansible.windows/plugins/modules/win_powershell.ps1
Line 616 in 0ca5d92
On a fresh Windows VM, (with a fresh user profile specifically), running pwsh.exe for the first time takes 20-30s to complete. The above timeout causes a
win_powershell
task withexecutable: pwsh.exe
set to fail several times with the exception noted below before eventually succeeding.Odd issue as this only happens on the very first invocation of a pwsh task on a VM. Subsequent runs, even after rebooting, do not exhibit the failure. The actual content of the task doesn't seem to matter.
I did confirm the issue by changing the timeout up to 60s, which eliminated the problem. I can put in a PR for that if it makes sense. As far as I've seen, that timeout causes the task to fail so increasing it would only have a performance penalty when the task was going to fail anyways. I don't know why such a relatively short timeout was used originally.
ISSUE TYPE
COMPONENT NAME
win_powershell
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
Ansible running under AWX on Centos Stream 9
Target machines are Windows Server 2022
All are AWS EC2 instances
STEPS TO REPRODUCE
Any
win_powershell
task withexecutable: pwsh.exe
set. BUT please note it only happens the first time it's run on a fresh VM/fresh user profile and very likely depends on the target machine's performance characteristics.EXPECTED RESULTS
The task should complete successfully
ACTUAL RESULTS
The task fails with this exception, usually 5-6 times (with
retries
set), before eventually succeeding.The text was updated successfully, but these errors were encountered: