3

hello I'm using PyWinRM to poll a remote windows server.

s = winrm.Session('10.10.10.10', auth=('administrator', 'password'))

As there is no s.close() function available, I am worried about leaking file descriptors.

I've checked by using lsof -p <myprocess> | wc -l and my fd count is stable but my google searches show that ansible had fd leaks previously; ansible relies on pywinrm to manage remote window hosts as well

kindly advice, thanks!

laycat
  • 5,381
  • 7
  • 31
  • 46

1 Answers1

0

Actually, I had a quick look at the code of wirm (as of 20201117) and the "Session" is not an actual session in the traditional sense, but only an object holding the creds to authenticate.

Each time run_cmd or run_ps is invoked, a session in opened on the target and closed on completion of the task. So there's nothing to close, really.

PalomaLVP
  • 21
  • 5