# Read timeout when using WinRM to apply Windows patches on Azure

**URL:** <https://forum.ansible.com/t/read-timeout-when-using-winrm-to-apply-windows-patches-on-azure/31529>\
**Category:** Ansible Project\
**Tags:** azure, windows, aws\
**Created:** [October 23, 2019, 2:37pm UTC](https://forum.ansible.com/t/read-timeout-when-using-winrm-to-apply-windows-patches-on-azure/31529 "2019-10-23T14:37:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Angel\_Rengifo\_Cancin](https://avatars.discourse-cdn.com/v4/letter/a/9e8a1a/32.png) [@Angel\_Rengifo\_Cancin](https://forum.ansible.com/u/Angel_Rengifo_Cancin)\
**Post date:** [October 23, 2019, 2:37pm UTC](https://forum.ansible.com/t/read-timeout-when-using-winrm-to-apply-windows-patches-on-azure/31529/1 "2019-10-23T14:37:56Z")

</div>

Hello guys:

I’m currently working with Ansible 2.8.5 to apply Windows patches through WinRM connections. This is a portion of my code:

- name: Instalar actualizaciones 1  
win\_updates:  
category\_names: “{{ windows\_update\_categories }}”  
register: updates  
vars:  
ansible\_winrm\_operation\_timeout\_sec: 120  
ansible\_winrm\_read\_timeout\_sec: 150  
failed\_when:  
updates.failed\_update\_count is defined and  
updates.failed\_update\_count \> 0 and  
1 == 2

I’m attempting to patch my Windows 2012 R2 as part of an Image creation using packer. This is the list of WinRM variables I use for connecting to Windows VM:

ansible\_user: packer  
ansible\_connection: winrm  
ansible\_winrm\_server\_cert\_validation: ignore  
ansible\_port: 5986  
ansible\_winrm\_connection\_timeout: 1800  
ansible\_winrm\_operation\_timeout\_sec: 1800  
ansible\_winrm\_read\_timeout\_sec: 1800  
ansible\_winrm\_transport: ntlm

Those “_timeout_” variables were recently added as a way to deal with the following error message I’m constantly getting at this same task:

azure-arm: TASK [canvia.os-update : Instalar actualizaciones 1] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
azure-arm: fatal: [13.92.97.72]: UNREACHABLE! =\> {“changed”: false, “msg”: “winrm connection error: HTTPSConnectionPool(host=‘13.92.97.72’, port=5986): Read timed out. (read timeout=1801)”, “unreachable”: true}

I don’t have any issues when running this same playbook on Windows 2019 on Azure or any Windows version (2012, 2016, 2019) on AWS. I’m only experiencing this issue with Windows 2012 and 2016 on Azure.

Have somebody experienced anything similar before? I hope someone can give me any ideas about this.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [October 23, 2019, 4:37pm UTC](https://forum.ansible.com/t/read-timeout-when-using-winrm-to-apply-windows-patches-on-azure/31529/2 "2019-10-23T16:37:49Z")

</div>

I have had issues with single core machines when windows updates include an upgrade to the dot net version. What happens is ngen recompiles all the dot net code it can find and ties up an entire core until has finished recompiling, which leaves no cpu time for winrm. Dual core boxes aren't as badly affected as ngen only ties up one core.

Even if it is not ngen, perhaps it would be worth trying to find out what the vms are doing at the moment your connection fails.

Hope this helps,

Jon

---

<div class="post-metadata">

**Author:** ![Angel\_Rengifo\_Cancin](https://avatars.discourse-cdn.com/v4/letter/a/9e8a1a/32.png) [@Angel\_Rengifo\_Cancin](https://forum.ansible.com/u/Angel_Rengifo_Cancin)\
**Post date:** [October 23, 2019, 4:59pm UTC](https://forum.ansible.com/t/read-timeout-when-using-winrm-to-apply-windows-patches-on-azure/31529/3 "2019-10-23T16:59:37Z")

</div>

Thank you so much buddy. Actually, I’m working with Standard B2ms VMs (2 vCPUs, 8 GB RAM), but this time I’ll try with a larger machine.

What seemed strange is the fact that CPU utilization was really low (almost 0%) during several minutes before Ansible failure appears. I got this info from Azure metrics for this VM.

I’ll share my results once I try again

---

<div class="post-metadata">

**Author:** ![Angel\_Rengifo\_Cancin](https://avatars.discourse-cdn.com/v4/letter/a/9e8a1a/32.png) [@Angel\_Rengifo\_Cancin](https://forum.ansible.com/u/Angel_Rengifo_Cancin)\
**Post date:** [October 24, 2019, 4:20pm UTC](https://forum.ansible.com/t/read-timeout-when-using-winrm-to-apply-windows-patches-on-azure/31529/4 "2019-10-24T16:20:02Z")

</div>

I give up: even with a DS3\_v2 (4 cores, 14 GB memory) VM, it fails with the same error message. I believe this has no relation with system resources, but maybe a Windows and/or Azure specific bug, 'cause it doesn’t happen on AWS.
