How to simulate the condition that causes "Resetting dropped connection"

17 views Asked by At

I am trying to understand the cause of this log message with debug enabled:

"connectionpool","292","Resetting dropped connection: someserver.com"

The short version is that I am occasionally seeing this when using pywinrm on Linux to execute PowerShell commands on Windows devices. But only occasionally. I can;t see anything in any Windows logs to expain what is causing this, but I would like to capture the condition and see if re-authenticating and connecting again will fix it. But this is only happening in a customer environment, so I want to simulate the problem in a dev environment to be sure of the fix.

Long version is that the process is to establish a connection using kerberos to a Windows server. Then execute a number of PowerShell commands one after the other using the established connection. pywinrm is establishing the connection and handling the execution of each command - and pywinrm is using urllib3. So the process is...

  1. connect using kerberos
  2. for each command, create a shell and then issue the command "powershell [command]", then read the response
  3. After all commands have executed, close the connection

The "Resetting dropped connection" happens in step 2 - and when it happens, it is always after the first command executes with no issue. Since this process repeats every 5 minutes and the issue happens maybe 2 times in any given hour, the problem is difficut to track down.

I have tried adding a delay between commands and then causing the network to "go down" (ie disable the NIC on the Windows device) before the 2nd command. But whilst that generates an error, it isn't the "Resetting dropped connection" error.

Also - I am not seeing the connection re-established in urllib3 when this happens... I see no debug log from _new_conn. What I do see is errors from kerberos:

connectionpool","546","http://someserver.com:5985 "POST /wsman HTTP/1.1" 400 0"
"kerberos_","294","authenticate_user(): returning <Response [400]>"

But again - nothing seems to show up on the Windows side to show why the 400 error is being generated at this time (when everything works most of the time)...

So - how can I simulate the condition leading to "Resetting dropped connection"?

0

There are 0 answers