Repository navigation
Conversation
The update task started by win_updates runs outside of the WinRM shell and its pipe server accepts a new client, so losing the connection while polling is recoverable. The poll was only retried once, on the same connection, and only for AnsibleConnectionFailure and requests timeouts, and the cancel was not retried. The psrp and winrm connection plugins raise some connection errors as is, e.g. a WSManFault when the shell is aborted, and winrm keeps using the same shell. The task then failed, the cancel failed on the same broken connection, and the update task kept running on the host with nobody tracking it. Retry any error raised while polling or cancelling, like plugin_utils/_reboot.py does, with the same capped exponential backoff, and reset the connection before each retry so the command runs on a new shell. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fix the yaml[line-length] lint failure and mention the cancel retry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
The ansible-core devel moved the collection loader to The |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
Fixes #970
Fixes #668
#668 looks like the same root cause (connection lost while installing a network driver or a cumulative update), but the network driver case was not reproduced.
The update task started by
win_updatesruns outside of the WinRM shell, and its pipe server accepts a new client, so losing the connection while polling is recoverable. Today the poll is retried once, on the same connection, and only forAnsibleConnectionFailureandrequeststimeouts, and the cancel is not retried. Thepsrpandwinrmconnection plugins raise some connection errors as is, e.g. aWSManFaultErrorwhen the shell is aborted, andwinrmkeeps using the same shell. The task then fails, the cancel is sent on the same broken connection and fails too, and the update task keeps running on the host.plugin_utils/_reboot.pyalready does, with the same capped exponential backoff, up to 5 retries. The cancel can safely be sent more than once.The warnings and the returned values are unchanged.
ISSUE TYPE
COMPONENT NAME
win_updates
ADDITIONAL INFORMATION
test_wsman_fault_during_pollandtest_wsman_fault_during_cancel(raw exception, the run completes after a reset),test_multiple_connection_failures_during_pollupdated for the retry counts. All three fail onmain.psrpandwinrm, by killing the shell host (wsmprovhost.exe/winrshost.exe) and by restarting WinRM while polling: all four now succeed. Each logsConnection failure when polling update result - attempting to retry: ...(WSMan fault1726/995over psrp,InvalidSelectorsover winrm) or, when the shell dies after the last poll,Connection failure when cancelling update task - attempting to retry: Access is denied. .... Each then reconnects, gets the final result and cancels the update task, which exits cleanly with no pipe or process left on the host. While WinRM was restarting, one psrp retry also failed withinvalid literal for int() with base 10: ''raised from the psrp stack. That is why any error is retried rather than a list of exception types.win_updatesintegration target run against the same host overpsrpandwinrm(ansible-test windows-integration win_updates --inventory ..., Server 2022): passed.No integration test is added for the connection loss itself: breaking the shell inside the poll window is not deterministic on the CI hosts.
🤖 Generated with Claude Code
Edit : IDK what your stance is on AI Assisted coding, I just want to stress out that this was not 100% coded with Claude and heavily re-read and supervised. Not being an english native, I was lazy enough to let it write the whole issue text though, hope it's OK and not too robotic for you. Happy to correct anything :)