-
Notifications
You must be signed in to change notification settings - Fork 24k
avoid connection leaks (#80532) #80787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Conversation
In case TaskExecutor needs to open a new connection it should attempt to properly dispose existing one if any. fixes: ansible#80532
except AttributeError: | ||
pass | ||
except Exception as e: | ||
display.debug(u"error closing connection: %s" % to_text(e)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aside from missing tests and a changelog ... this might not be a good approach as other connections are reused (even if not for the current task) in the play and this would require the costly re-initialization of them.
I know the winrm connection does somethings differently but a general reaper at the end of the run might be a better solution, though many connections might accumulate during the run. Another issue is that some setups reuse the connections created by Ansible (mostly ssh) , so it would have to be a toggle or a per connection property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for valuable comment, I made this PR more like hotfix to get some guidance how to fix it properly - I am sorry if it should been discussion in Issue first... It seemed to me that task_executor always closes connection at the end of .run()
anyway and wasn't aware that connection can be retained over self._connection.close()
call there.
I think general reaper at the end might not be good option either as default WinRM quota is quite low (I think its 30 connections per user) so if playbook has a task with more than 30 loop items it will blew before reaper kicks in...
SUMMARY
In case TaskExecutor needs to open a new connection it should attempt to properly dispose existing one if any.
Fixes #80532
ISSUE TYPE
COMPONENT NAME
core