-
Notifications
You must be signed in to change notification settings - Fork 491
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
Amqp connections are not getting disposed #1771
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -548,17 +548,12 @@ protected override void Dispose(bool disposing) | |
{ | ||
base.Dispose(disposing); | ||
|
||
if (_disposed) | ||
{ | ||
return; | ||
} | ||
|
||
Logging.Info(this, $"{nameof(disposing)}"); | ||
|
||
if (disposing) | ||
{ | ||
_closed = true; | ||
AmqpUnitManager.GetInstance().RemoveAmqpUnit(_amqpUnit); | ||
AmqpUnitManager.GetInstance()?.RemoveAmqpUnit(_amqpUnit); | ||
_disposed = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we never use the _disposed field, we should just remove it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nvm. Talked to James offline and he explained it to me. |
||
} | ||
} | ||
|
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.
Why is this a problem?
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.
+1. We seem to set _disposed to true only after removing the amqp unit, so it shouldn't cause leaks, right?
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.
@abhipsaMisra - Are you not OOF :D Take rest!
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.
_disposed is a protected field from the base class. That's what's throwing us all off
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 we call base.Dispose(), the _disposed is getting set to false, then we bail out prematurely.
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 moved the dispose to below the if statement to match the pattern of the other handlers.