-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Fix 66568: Prevent unclosed TCP channels and avoid additional errors #68277
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: 3007.x
Are you sure you want to change the base?
Conversation
|
Turns out I had tuned some logging and forgotten about it. We still have this issue: I'll have to work on this some more. |
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.
There are some pre-commit failures that need to be addressed.
@twangboy, I added some additional checks to existing TCP transport tests |
|
@twangboy, any further recommendations for this PR? |
| yield self.send_id(self.token, self._reconnected) | ||
| self.connected = True | ||
| self.event.fire_event({"master": self.opts["master"]}, "__master_connected") | ||
| if self.event: |
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.
When won't there be an event? Is this something that came up in the test suite only?
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.
@dwoz, I'm not sure exactly what triggered it, but we would see an error about self.event being None when running salt-call commands pretty reliably. This prevents the error, but I'm not sure how to even reproduce this in a test to be honest without having it be very contrived.
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.
There won't be an event if the channel is already closed.
def close(self):
"""
Close the channel
"""
self.transport.close()
if self.event is not None:
self.event.destroy()
self.event = None
Is it possible this could get called after the channel is already closed?
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.
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.
I was asking @dwoz, trying to address his question of a way that there might not be an event. It seems appropriate to handle the case of there not being event here in case reconnect is called on when it was already closed.
What does this PR do?
Properly close TCP transports to prevent unclosed transport errors as well as task is destroyed but is still pending warnings/errors. I also changed a log line to debug from error to match the same error throughout the file.
What issues does this PR fix or reference?
Fixes #66568. I'm not 100% sure this fixes all issues with the TCP transport, but it at least gets us a lot closer and prevents tons of errors in Salt 3007.6 for us.
Previous Behavior
See #66568 for errors.
New Behavior
Clean highstates with no errors.
Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Commits signed with GPG?
No