jborean93 / pypsrp

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

‘Read timed out.’ after Set-NetAdapterAdvancedProperty JumboPacket change on Windows Host #178

Closed pjstam closed 11 months ago

pjstam commented 1 year ago

Hello, After changing the JumboPacket size from e.g. 1514 to 9014 (or back) on a Windows host with a PowerShell command (ansible.windows.win_shell , ansible.windows.win_dsc or ansible.windows.win_powershell makes no difference) the connection is lost to the destination host and a ‘Read timed out.’ occurs. I tried a lot of different values for the parameters:

For some reason the connection is not re-established. I’m aware that changing the packet size can create a small drop but a continuous ping from the controller shows that during the change just one ping is lost and moreover no ping is lost to the destination host. A simple ansible.windows.win_reboot between tasks is causing no issues.

What am I missing here?

Regards, Peter

During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 165, in run res = self._execute() File "/usr/local/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 660, in _execute result = self._handler.run(task_vars=vars_copy) File "/usr/local/lib/python3.9/site-packages/ansible/plugins/action/normal.py", line 39, in run result = merge_hash(result, self._execute_module(task_vars=task_vars, wrap_async=wrap_async)) File "/usr/local/lib/python3.9/site-packages/ansible/plugins/action/init.py", line 1179, in _execute_module res = self._low_level_execute_command(cmd, sudoable=sudoable, in_data=in_data) File "/usr/local/lib/python3.9/site-packages/ansible/plugins/action/init.py", line 1344, in _low_level_execute_command rc, stdout, stderr = self._connection.exec_command(cmd, in_data=in_data, sudoable=sudoable) File "/usr/local/lib/python3.9/site-packages/ansible/plugins/connection/psrp.py", line 463, in exec_command rc, stdout, stderr = self._exec_psrp_script(script, in_data) File "/usr/local/lib/python3.9/site-packages/ansible/plugins/connection/psrp.py", line 820, in _exec_psrp_script ps.invoke(input=input_data) File "/usr/local/lib/python3.9/site-packages/pypsrp/powershell.py", line 1218, in invoke return self.end_invoke() File "/usr/local/lib/python3.9/site-packages/pypsrp/powershell.py", line 1190, in end_invoke self.poll_invoke() File "/usr/local/lib/python3.9/site-packages/pypsrp/powershell.py", line 1391, in poll_invoke responses = self.runspace_pool._receive(self.id, timeout=timeout) File "/usr/local/lib/python3.9/site-packages/pypsrp/powershell.py", line 682, in _receive response = self.shell.receive("stdout", command_id=command_id, timeout=timeout)[2]["stdout"] File "/usr/local/lib/python3.9/site-packages/pypsrp/shell.py", line 243, in receive response = self.wsman.receive( File "/usr/local/lib/python3.9/site-packages/pypsrp/wsman.py", line 367, in receive res = self.invoke(WSManAction.RECEIVE, resource_uri, resource, option_set, selector_set, timeout) File "/usr/local/lib/python3.9/site-packages/pypsrp/wsman.py", line 470, in invoke response = self.transport.send(xml) File "/usr/local/lib/python3.9/site-packages/pypsrp/wsman.py", line 837, in send return self._send_request(prep_request) File "/usr/local/lib/python3.9/site-packages/pypsrp/wsman.py", line 840, in _send_request response = self.session.send(request, timeout=(self.connection_timeout, self.read_timeout)) # type: ignore[union-attr] # This should not happen File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, **kwargs) File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 532, in send raise ReadTimeout(e, request=request) requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='192.168.1.199', port=5986): Read timed out. (read timeout=300) fatal: [testhost]: FAILED! => { "msg": "Unexpected failure during module execution: HTTPSConnectionPool(host='192.168.1.199', port=5986): Read timed out. (read timeout=300)", "stdout": "" }

pjstam commented 11 months ago

fixed it with async: and poll: on the Ansible task.