jborean93 / pypsrp

PowerShell Remoting Protocol for Python
MIT License
324 stars 49 forks source link

Failed to create connection via pypsrp.client : urllib3.connection.HTTPConnection : Failed to establish a new connection: [Errno 110] Connection timed out')) #171

Open dimag25 opened 1 year ago

dimag25 commented 1 year ago

Package Name: pypsrp Package Version: 0.8.0

Operating System: Linux Python Version: 3.8

Describe the bug We have E2E Tests run via Jenkins - during tests process we create windows10 Vm Machines via Azure SDK, and use pypsrp to run powershell command remotely on created azure vm from our Jenkins linux vm.

During last month we have issues sometimes to perform first command on created vm via pypsrp:

2023-04-23 11:38:40,787 pypsrp.client: <INFO> Executing PowerShell script 'Get-ChildItem "C:\Windows\Temp" | Select Name '
2023-04-23 11:38:40,787 pypsrp.powershell: <INFO> Initialising RunspacePool object for configuration Microsoft.PowerShell
2023-04-23 11:38:40,787 pypsrp.powershell: <INFO> Opening a new Runspace Pool on remote host
2023-04-23 11:40:50,826 Azuri.WinClient.WinClient: <ERROR> [requests.ConnectionError]: CLI command failed . Retrying
2023-04-23 11:40:50,826 Azuri.WinClient.WinClient: <WARNING> HTTPConnectionPool(host='172.176.179.145', port=5985): Max retries exceeded with url: /wsman (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f1183cdb7f0>: Failed to establish a new connection: [Errno 110] Connection timed out')), retrying in 2 seconds...

this error not stable - so if we try to rerun the powerhsell command on new created vm machine it can success in 2nd or 3rd retry.

please advice what can be the issue?