Skip to content
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

QnAMaker HttpClient disposal anti-pattern #107

Closed
drub0y opened this issue Feb 14, 2018 · 3 comments
Closed

QnAMaker HttpClient disposal anti-pattern #107

drub0y opened this issue Feb 14, 2018 · 3 comments
Assignees
Labels
bug Indicates an unexpected problem or an unintended behavior.

Comments

@drub0y
Copy link
Contributor

drub0y commented Feb 14, 2018

I've already filed #106 regarding some issues regarding the HttpClient disposal anti-pattern, but QnAMaker is a little more nuanced. The QnAMaker class at least holds onto its HttpClient instance in a field and will reuse it across calls to an instance, but should someone dispose of the QnAMaker instance it will also dispose of that underlying HttpClient. This could lead to developers to using the QnAMaker class in a non-singleton style and thus lead to the same resource starvation issues as mentioned in #106.

Recommend moving the HttpClient into a static field in the class and removing the IDisposable implementation altogether.

@cleemullins cleemullins self-assigned this Feb 14, 2018
@cleemullins cleemullins added the bug Indicates an unexpected problem or an unintended behavior. label Feb 14, 2018
@cleemullins
Copy link
Contributor

Thanks. I'll take a look at this shortly.

@cleemullins
Copy link
Contributor

The PR to fix this is pending review. I took the simple approach of just making it static to the QnA Maker component. I Need to do this same thing for other components next...

@cleemullins
Copy link
Contributor

This is closed out now.

ceciliaavila pushed a commit that referenced this issue Jun 25, 2019
* Remove unused formatter, remove duplicate response code set, remove unnecessary casts

* Add Slack login correctly done

* Fix id assignation in SendActivitiesAsync method (#107)

* Add some minor stylecop corrections
LoginWithSlack method temporarily waited to test

* Fix minor stylecop warnings, fix response sending, remove unused inclusion, start partial implementation of previously unimplemented ChannelData message assignment, add property to NewSlackMessage class

* Remove ChatPostEphemeralMessageResult and ChatPostMessageResult classes

* Fix message.ThreadTS assignment and cast. Complete message ChannelData assignent. Some stylecop corrections

* Add stylecop corrections, not taking into account parameter documentations

* Change the return type of ActivityToSlack

* Remove references to Middleware

* Remove Middleware files

* Fix thread_ts assignation

* Add PR changes

* Remove commented out lines

* Add PR changes: commented out code removed, some dynamic casts removed

* Remove all dynamics cast to slackEvent

* Add more PR changes
ceciliaavila pushed a commit that referenced this issue Jun 25, 2019
…apper (#115)

* Remove unused formatter, remove duplicate response code set, remove unnecessary casts

* Add Slack login correctly done

* Fix id assignation in SendActivitiesAsync method (#107)

* Add some minor stylecop corrections
LoginWithSlack method temporarily waited to test

* Fix minor stylecop warnings, fix response sending, remove unused inclusion, start partial implementation of previously unimplemented ChannelData message assignment, add property to NewSlackMessage class

* Remove ChatPostEphemeralMessageResult and ChatPostMessageResult classes

* Fix message.ThreadTS assignment and cast. Complete message ChannelData assignent. Some stylecop corrections

* Add stylecop corrections, not taking into account parameter documentations

* Change the return type of ActivityToSlack

* Remove references to Middleware

* Remove Middleware files

* Fix thread_ts assignation

* Add PR changes

* Remove commented out lines

* Fix stylecop on the BotKitConversationState file

* Fix stylecop on the BotKitDialogWrapper file

* Apply PR feedback

* Remove unnecessary comment

* Fix stylecop on the BotKitConversationState file

* Fix stylecop on the BotKitDialogWrapper file

* Apply PR feedback

* Remove unnecessary comment

* Add usings inside the namespace

* Fix usings and headers

* Fix comment description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or an unintended behavior.
Projects
None yet
Development

No branches or pull requests

2 participants