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

Perf + Resource Utilization: Ensure proper dispose of disposable members #4832

Merged
merged 1 commit into from
Oct 21, 2020

Conversation

carlosscastro
Copy link
Member

@carlosscastro carlosscastro commented Oct 21, 2020

One more round of improvements around disposable patterns that should have a substantial impact in bots that have medium to large scale, in terms of resource utilization, including connections (clients), memory (dead references) and CPU (because of the GC having to do heavy passes in large size chunks)

@carlosscastro carlosscastro merged commit eb194c8 into main Oct 21, 2020
@carlosscastro carlosscastro deleted the ccastro/disposable-improvements branch October 21, 2020 19:44
munozemilio added a commit that referenced this pull request Oct 23, 2020
…4846)

* Change to delegate for inspector.

* updated reference version of Microsoft.BotFramework.Orchestrator

* added nuget.config

* updated version dependency to Microsoft.BotFramework.Orchestrator

* Update ci-build-steps.yml

use nuget.config

* Adding mappings between components and intellisense options (#4704)

* Disable build warning CS8002 in Microsoft.Bot.Builder.FunctionalTests (#4668)

The following third party libraries that do not have strong names:
NAudio
Twilio
Thrzn41.WebexTeams

* Reset retries on new generation events.

* Make inspector be optional.
Add description to memory assertions.
Redo retries tests to work with new retries model.

* Update schemas

* fix DefaultValueResponce can't access DialogContext.State  (#4691)

* fix DafaultValueResponce can't access dc.state

* add adaptive test for NumberInput default response

* fix BindAsync wrong signature in OAuthInput

* defense explicitly cancellationToken in BindAsync

* add cancellationToken in EndDialogAsync

* Let ADO define triggers (#4706)

* add a default user agent for httpRequest (#4693)

* Add obsolete tag to AzureBlob classes (#4735)

Co-authored-by: Santiago Grangetto <santiago.grangetto@southworks.com>

* Enable overriding AttachmentInput dialog (#4726)

* Enable custom AttachmentInput dialogs.

* Add positive and negative tests for custom AttachmentInput

* Make missing test environment vars cause a functional test build to fail (#4719)

* Add AUTOMATEDBUILD precompiler directive, change Assert.Inconclusive() to Assert.Fail

* Fix DefineConstants in Microsoft.Bot.Builder.FunctionalTests.csproj

* Fix environment vars for dotnet test

* Set twilio env vars

* Fix linux yaml

* Fix DialogStateMamager TryGetValue method  throwing FormatException (#4604)

* fix DSM tryGetValue

* add more tests

* resolve conflicts

* Send context.Activity if none provided in BeginSkill (#4705)

* Adds CreateMessageFromActivity method to facebook adapter.  (#4746)

* Refactored FacebookAdapter to add a virtual metho for FB message creation that allows the devs to manipulate the FB message instanc before it gets sent to Facebook.
Added FacebookAdapterWithTag adapter to FB test bot so we can add the "ACCOUNT_UPDATE" tag as defined in https://developers.facebook.com/docs/messenger-platform/send-messages/message-tags#sending

* Fixed errors in DialogStateManagerTests

* Added missing MessagingType property.

* Add remark (#4751)

* Enable LG debuggability (#3791)

* init LG debugger

* change LGEvent to Custom

* fix ci error

* fix ci error

* [LG] Redo the default fallback of namespace (#4724)

* redo the default fallback of namespace

* fix issue

* make inject function case sensitive

* Update BotFrameworkAdapter, Fixes : #4710 (#4711)

* Update BotFrameworkAdapter to fix Fixes: #4710

Fixes #4710 by using Convert.Int32 instead of (int) , to avoid cast exception System.InvalidCastException - Unable to cast object of type ‘System.Int64’ to type ‘System.Int32

* Updated for culture sensitive method calls

Include reference to System.Globalization.CultureInfo.InvariantCulture in method call.

* Allow API Compatibility Validation to be disabled (#4761)

* Add check for DisableApiCompatibityValidation

* Add quotes to "true"

* Add comment

* Change Assert.Inconclusive() to Assert.Fail() in tests (#4754)

* Change Assert.Inconclusive() to Assert.Fail()

* Add #if !AUTOMATEDBUILD

* Add var TESTAPPID

* Move env vars to dotnet test task

* Change env var name to TestPassword

* Add TestAppId: $(LinuxTestBotAppId)

* Refactor of Microsoft.Bot.Builder.Azure.Queues. (#4692)

* Refactor of Microsoft.Bot.Builder.Azure.Queues.

* Moving QueueStorage to TurnState.

* Add visibility timeout.

* Changes requested by peer review.

* Remove references to Dialogs.Declarative.

* updated reference to Microsoft.BotFramework.Orchestrator (#4767)

* fix the default behavior when cloud environments are configured (#4764)

* fix the default behavior when cloud environments are configured

* code review feedback

* code review feedback (comment)

* Update tests.schema with changes to Microsoft.ContinueConversationLater. (#4769)

* Prefer default operation (#4760)

* Initial check-in of default op improvements.  Need to write tests.

* Clean-up logic and prefer default operations.

* Add tests for default operation preference.

* use wildcard reference for Microsoft.BotFramework.Orchestrator (#4771)

* updated reference to Microsoft.BotFramework.Orchestrator

* use wildcard reference

* Update README  (#4445)

* Add missing packages, new feed information

* Remove Azure Artifacts badge

* Remove Release build badges for preview packages.

* Change vmImage: setting (#4766)

* Add 'state' to MessagingExtensionAction (#4718)

* Add 'state' to MessagingExtensionAction

* Remove new constructor parameter

* [Expression]Add reverse prebuilt function (#4781)

* add reverse function

* refine code

* fix typo

* retrigger

* Make languagepolicy in Recognizer align with the policy in UseLanguagePolicy (#4784)

* [LG & Expression] Switch Antlr.Runtime to Antlr.Runtime.Standard (#4777)

* convert Antlr.Runtime to Antlr.Runtime.Standard

* fix ci error

* add readme

* Add unit tests to generated dialogs (#4723)

* add unit tests

* fix dialog error

* recover tests.uischema

* Update tests.uischema

Co-authored-by: Zongyang Ma <zoma@microsoft.com>

* [#4366] [TestBot] Consolidate duplicate Test project and test code (#4736)

* Add TestBot.Shared project

* Move duplicated code into TestBot.Shared project

* Combine TestBot.Tests and TestBot.NetCore21.Tests

Co-authored-by: Joel Mut <joel.mut@southworks.com>

* Add AssertNoActivity (#4785)

* Initial check-in of default op improvements.  Need to write tests.

* Clean-up logic and prefer default operations.

* Add tests for default operation preference.

* Add description to memory assetion error.
For Chris

* Add AssertNoActivity.

* Remove timeout from schema.

* Fix bug in testscript.

* Adds support for skills without AppId and password in emulator. (#4757)

* Adds support for skills without AppId and password in emulator.
Updated ChannelServiceHanlder to add an anonymous skill AppId claim when auth is disabled.
Updated AppCredentials.ShouldSetToken() logic to avoid sending a token when the AppId is not set or when it is set to the anonymous skill appId.
Update SkillValidation.IsSkillClaim to return true for anonymous skills.
Added AuthenticationConstants.AnonymousSkillAppId constant.
Added unit tests for new logic.

* Updated comment

* Added constant for AuthenticationConstants.AnonymousAuthType (set to "anonymous") and replaced usages

* Introduced new skill constant in RoleTypes.
Updated BotFrameworkHttpClient to set the role of the recipient of the outgoing activity clone to RoletTypes.Skill
Updated JwtTokenValidation to check for the Role if the incoming activity instead of checking for RelatesTo
Updated tests

* Reverted changes to schemas

* Update RoleTypes.cs

Touched the file to force a new build

* Fixed file format

* Ported changes from JwtTokenValidation to ParameterizedBotFrameworkAuthentication

* Added a SkillValidation.CreateAnonymousSkillClaim)( method to centralized logic to create the anonoymous claims and updated related code.

* Touched to trigger another build

* Adds support for handling Updating and Deleting activities from skills. (#4786)

* Adds support for handling Updating and Deleting activities from skills.
Implemented SkillHandler.OnUpdateActivityAsync and SkillHandler.OnDeleteActivityAsync.
Added some logging messages for errors in SkillHandler.
Added unit tests for new operations and refactored SkillHandlerTests to be more narrow and more acurate.

* Reverted changes to tests.schema (we need to fix this!!!)

* More reverts!!!!

* Set PR filters to include the host .yml file (#4792)

* Set PR filters to include the host .yml file

* No-op change to test trigger

* Delete nuget.config (#4798)

* Delete nuget.config

* Update ci-build-steps.yml

Removed use of nuget.config.

* consolidate some implementation (#4800)

* Teams: Meeting notification (#4763)

* Teams: Meeting notification

* noop change to trigger the build

* Enable build to pass restrictive binary compat rules

* Add CacheInfo for Teams invoke responses (#4548)

* Add CacheInfo for Teams invoke responses

* Fix code style rules.

* Remove constructor paramters

* Updating schema titles to sentence case. (#4799)

* Changing schema titles to sentence case.

* Address PR comments.

* Second round of PR comments

* Add logging, fix syntax error

* Correct Assert

* Drop the use of IsBuildServer (#4791)

* Teams GetParticipant (#4770)

* Teams GetParticipant

* GetParticipantAsync to GetMeetingParticipantAsync

* Add GetMeetingParticipant action

* Add GetMeetingParticipant to TeamsComponentRegistration

* build errors

* remove meeting parameter from TeamsChannelData

* address Tom's feedback

* Add inMeeting to TeamsParticipantChannelAccount

* Add tests for GetMeetingParticipant. (also update TestUtils to enable a custom HttpMessageHandler for connector client call results)

* tests.schema file

* some cleanup

* Feedback and some cleanup

* Thread dialogcontext/activity through LuisRecognizer so it can be passed to ExternalEntityRecognizer (#4811)

* Recognizers in Adaptive use DialogContext and Activity (to allow reevaluation of activities after amiguity resolution.)  To adapt to that LuisAdaptiveRecognizer would create a temp turncontext to have the activity in it. The right way to do this is to actually thread the DialogContext/activity through to the luisrecognizer class...

For ExternalEntityRecognizer to work it needs the dc/activity to pass to the external recognizer, so it was time to replace the legacy code with code that threads the dc/activity down to the luis recognizer.

Unit tests for adaptive already go through this path, so no new unit tests are required.

* change to activity?.text as per rest of code.

* add tests.sschema back in

* generated by running all tests local

* change batch file to trigger new build

* Throw exception when circular reference is detected in LG imports (#4779)

* throw exception when occurs loop reference

* refine error code

* rename

* rename

* Add InnerParseResource

* ignore the null or empty result of the OutputFormat (#4814)

* Adds check to TranscriptLoggerMiddleware doesn't log continue conversation event activities (#4797)

* Adds check to TranscriptLoggerMiddleware doesn't log contine conversation event activities.

Changes include:
- Added check in TranscriptLoggerMiddleware to filter incoming ContinueConversation events.
- Introduced EventActivityNames class with constant strings for ContinueConversation so we don't have those strings hardcoded.
- Added also CreateConversation to the EventActivityNames helper (not related to this issue but saw it and decided to add it since it is better to have constants).
- Refactored ConversationReferenceEx to use the new constant (and use more straightforward code to create the event).
- Added tests for new logic in TranscriptLoggerMiddleware.
- Updated Skills testing projects to use the new constant

* Renamed EventActivityNames to ActivityEventNames

* Updated a couple of files that I missed after the rename.

* update resource explorer load to use GetComponentRegistration instead of static loaded components (#4745) (#4815)

Co-authored-by: sbacha <sabacha@microsoft.com>

* Adding UI schema to handle form dialogs (#4818)

* Remove extra skill dialog trace activities (#4819)

* additional issuers in emulator validation (#4828)

* Add StreamingRequestHandler.Audience for Streaming + Skills (#4805)

* Add StreamingRequestHandler.Audience for Streaming + Skills

* refactor private helpers in BFHttpAdapter

* add additional ctors for audience, refactor original ctors, update tests

* CODEOWNERS update
* add Microsoft.Bot.Streaming.Tests owner
* use @microsoft/bb-core
* force review pings for Adaptive codebase

* add or update copywrite headers in Microsoft.Bot.Builder

* fix StreamingRequestHandler WebSocket+Audience ctor
* add & refactor unit tests for new SRH ctors
* revert WebSocketTransportTests changes

* apply PR feedback

* ResourceExplorer: Pass original exception as inner exception to improve debuggability. (#4812)

* Make languagePolicy configurable in TestScript (#4794)

* change the appsetting parse logic

* typo

* refine

* add test

* add more tests

* add more comments

* refine code

* retrigger

* retrigger

* Make languagePolicy a property

* revert

* update schema

* update schema

* update schema

* update schema

* update schema

* update schema

* Perf: significant resource optimization around garbage collection, memory and connection utilization (#4727)

* Perf: significant resource improvements around garbage collection, memory and connection utilization

* Perf: significant resource improvements around garbage collection, memory and connection utilization

* Cloud adapter: remove ported memory leaks and GC perf issues

* ConnectorClient: Add special constructor to avoid disposing of custom HttpClient when provided

* ConnectorClient: Override base uri after initialize so it's not overriden

* Streaming: ResponseExtensions - add async version of read as string

* Remove unused dispose

* Connectorclient: remove unnecessary customHttpClient assignment

* Teams Meeting Participant api updates (#4826)

* Teams Meeting Participant api updates

* Update teams declarative get participant mocked results

* Write unit tests for BeginSkill (#4816)

* Adds BeginSkill dialog test plus required middleware

* Add BeginSkillEndDialog test

* Add copyright and fix spacing

* Minor fixes and add allowInterruptions false

* Renaming

* Omit dialogs from test

* Rearrange note

Co-authored-by: Ian Luca Scaltritti <ian.scaltritti@southworks.com>
Co-authored-by: Santiago Grangetto <santiago.grangetto@southworks.com>
Co-authored-by: Denise Scollo <dens.scollo@gmail.com>

* Perf + Resource Utilization: Ensure proper dispose of disposable members (#4832)

* Update tests.schema and tests.uischema (#4834)

* Declarative Debugging: Breakpoint to instance mapping from 'first wins' to 'last wins' (#4824)

* Debugging: Move from first win to last wins, interface converter now has a non-concurrent dictionary and default source map is nullsourcemap

* Undo source map change

* Declarative: Remove JToken cloning due to JSOn.NET bug

* remove trusted service url check in appcredentials (#4827)

* remove trusted service url check in appcredentials

* cr feedback

* cr feedback

* Removes Skills functional tests projects (#4840)

Removed the skills functional tests, I was the only one using them and decided to remove them to avoid clutter.
New versions of these test projects will be eventually in https://github.com/microsoft/BotFramework-FunctionalTests
For the time being, these projects can be found in this fork if anyone needs them: https://github.com/gabogorg/botbuilder-dotnet

* Adding tests at Section level

* Fixing docs

* Create README.md

Co-authored-by: Chris McConnell <chrimc@microsoft.com>
Co-authored-by: Tien Suwandy <tiens@microsoft.com>
Co-authored-by: LouisEugeneMSFT <66701106+LouisEugeneMSFT@users.noreply.github.com>
Co-authored-by: Monica Rivera <44449640+mrivera-ms@users.noreply.github.com>
Co-authored-by: Shuai Wang <shuwan@microsoft.com>
Co-authored-by: BruceHaley <v-bruhal@microsoft.com>
Co-authored-by: Denise Scollo <dens.scollo@gmail.com>
Co-authored-by: Santiago Grangetto <santiago.grangetto@southworks.com>
Co-authored-by: Eric Dahlvang <EricDahlvang@gmail.com>
Co-authored-by: Gabo Gilabert <gabog@users.noreply.github.com>
Co-authored-by: Hongyang Du (hond) <hond@microsoft.com>
Co-authored-by: Godwin Paul <godwin3737@users.noreply.github.com>
Co-authored-by: johnataylor <johtaylo@microsoft.com>
Co-authored-by: Eric Dahlvang <erdahlva@microsoft.com>
Co-authored-by: coldplaying42 <mzyone@gmail.com>
Co-authored-by: Zongyang Ma <zoma@microsoft.com>
Co-authored-by: Joel Mut <joel.mut@southworks.com>
Co-authored-by: Tom Laird-McConnell <tomlm@microsoft.com>
Co-authored-by: sbacha <sabacha@microsoft.com>
Co-authored-by: Geoff Cox (Microsoft) <gcox@microsoft.com>
Co-authored-by: Steven Gum <14935595+stevengum@users.noreply.github.com>
Co-authored-by: Carlos Castro <carlosscastro@users.noreply.github.com>
Co-authored-by: Cecilia Avila <44245136+ceciliaavila@users.noreply.github.com>
Co-authored-by: Ian Luca Scaltritti <ian.scaltritti@southworks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants