Fixed Connection Leak for RabbitMQ - #2393
Conversation
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files@@ Coverage Diff @@
## master #2393 +/- ##
==========================================
- Coverage 66.88% 58.21% -8.68%
==========================================
Files 268 10 -258
Lines 8730 280 -8450
Branches 631 25 -606
==========================================
- Hits 5839 163 -5676
+ Misses 2723 112 -2611
+ Partials 168 5 -163
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Alirexaa
left a comment
There was a problem hiding this comment.
@HesamKashefi, can you ensure that the connection is not disposed of in the second check and the next one?
Please add a test about that.
|
Isn't this fix disposing the singleton connection (if configured as per Readme recommendations)? Is the configuration suggested in Readme not addressing the issue? I am not near my dev machine to try it, but seems OK, and makes this PR not necessary. |
|
@dotnet-policy-service agree |
This class uses a factory function to get an instance of the connection. If you take the first approach and create an instance on every call, the instances won't be disposed and the connection leak explodes the server and if you take the second approach and want to return a singleton instance, the connection MUST be created when RabbitMQ is already running and connection will be lost when RabbitMQ goes down! this is unusable! The third option is to provide a connection (which It's not possible if RabbitMQ is not running) Am I doing it wrong? I just want to make this work when the RabbitMQ is possibly not available! |
Please check the situation when RabbitMQ is not running. p.s. Registering a Singleton like this looks awful! |
|
Just to summarize:
🤔 |
Yes you are right about the fact that creating a new connection is not a good way. I think AddRabbitMQ must either get a fix or get completely removed! |
What this PR does / why we need it: The connection leak in RabbitMQ Health Checks made this library unusable
Which issue(s) this PR fixes: The connection leak in RabbitMQ
Please reference the issue this PR will close: #2364
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Please make sure you've completed the relevant tasks for this PR, out of the following list: