Most WinRM operations can fail on low timeout
See original GitHub issuePywinrm 0.2.0 lowered the default operation timeouts from 60s to 20s (and the read timeout to 30s) to allow for faster failures on dead hosts, etc. This generally isn’t a problem, but for newly-created (and possibly for heavily-loaded) instances on AWS, the lower timeout can expire before the initial shell gets created (and possibly in other places).
Rather than lowering the timeout, we could add polling for it to other places known to run long (starting with open_shell) similar to what we do during receive.
The failure manifests as a 500, eg:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/ansible/plugins/connection/winrm.py", line 151, in _winrm_connect
self.shell_id = protocol.open_shell(codepage=65001) # UTF-8
File "/usr/local/lib/python2.7/dist-packages/winrm/protocol.py", line 132, in open_shell
res = self.send_message(xmltodict.unparse(req))
File "/usr/local/lib/python2.7/dist-packages/winrm/protocol.py", line 207, in send_message
return self.transport.send_message(message)
File "/usr/local/lib/python2.7/dist-packages/winrm/transport.py", line 191, in send_message
raise WinRMTransportError('http', error_message)
WinRMTransportError: (u'http', u'Bad HTTP response returned from server. Code 500')
See https://github.com/ansible/ansible/issues/16873 for original issue.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:9
Top Results From Across the Web
Powershell Error The client got a timeout from the network ...
Hi. I have strange issue with powershell, I am ps-session with remote hosts using powershell however when it doing first attempt is failing...
Read more >I am getting a timeout error with WinRM. Please can someone ...
in my case is was a firewall issue. port "5986" is blocked on firewall. Make sure you can telnet WinRM port from your...
Read more >Configuring Windows Server for Monitoring via WinRM – Zenoss
About This article will describe how to prepare Windows servers for monitoring using the Microsoft Windows ZenPack using two methods,...
Read more >Troubleshooting - Puppet
If your task targets a Windows OS that has only PowerShell 2.0 installed, the task will fail. In 2017, Microsoft deprecated PowerShell 2.0....
Read more >Acronis Cyber Protect: Backup fails with "Windows error ...
Symptoms Activity fails with one of the following errors: Windows ... How to increase timeout for VSS operations; Run backup during low I/O ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was struggling with exception WinRMTransportError before, especially send WinRM command to the machine just bootup. After digging into the real error message that WinRM sent back. I list down every error happened in my environment and if it happened, I will retry again.
Illegal operation attempted on a registry key that has been marked for deletion.
similar issue also report here: https://github.com/test-kitchen/winrm-transport/issues/18
Class not registered
dont know the root cause till now
socket read timeout
I guess the windows machine is busy and not able to response in a short given timeout
OperationTimeout
This error is handled by pywinrm itself here. however, sometime this error may only contains the error code 2150858793 but without the string _http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Receive_ So I will use error code to capture this error and retry again
Also, I was getting the error above intermittently after startup. Turns out a process on the Windows server was pegging the CPU and as a result the call was hanging (and if it didn’t get the error on first connection, every command would take a really long time). Just throwing this up here in case the intrepid Googler stumbles upon this.