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

[release/8.0-preview5] Ensure ComponentState is always disposed #48410

Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented May 24, 2023

Backport of #48406 to release/8.0-preview5

/cc @SteveSandersonMS

Ensure ComponentState is always disposed

Updates the component disposal logic to ensure that ComponentState is always disposed, and hence ArrayBuilder instances are always disposed, and hence we always return the underlying buffers to the pool.

Description

Without this, the pooling of ArrayBuilder-held arrays becomes ineffective because the pools become full, and then the behavior switches over to transient instances, reverting to regular GC behavior.

Fixes #48411

Customer Impact

This fix will significantly reduce GC pressure because the RenderTreeFrame[] instances are large. In one test, after 20 requests, we had allocated 57MB of RenderTreeFrame[] instances. This is not a leak, but it does cause the GC to work harder because more memory is being allocated quickly and hence collections must occur more frequently.

The fix causes pooling to work correctly so that even though the same amount of RenderTreeFrame[] storage is needed, it will be able to reuse the same storage across requests so in most cases it won't trigger any GC pressure.

Regression?

  • Yes
  • No

The issue has been present since 2019.

Risk

  • High
  • Medium
  • Low

Low because this is a 8.0 preview release, we have tests, and several people have reviewed this code.

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

@github-actions github-actions bot requested a review from a team as a code owner May 24, 2023 16:05
@ghost ghost added the area-blazor Includes: Blazor, Razor Components label May 24, 2023
@mkArtakMSFT mkArtakMSFT added the Servicing-consider Shiproom approval is required for the issue label May 24, 2023
@ghost
Copy link

ghost commented May 24, 2023

Hi @github-actions[bot]. Please make sure you've updated the PR description to use the Shiproom Template. Also, make sure this PR is not marked as a draft and is ready-to-merge.

To learn more about how to prepare a servicing PR click here.

@mkArtakMSFT mkArtakMSFT added Servicing-approved Shiproom has approved the issue and removed Servicing-consider Shiproom approval is required for the issue labels May 24, 2023
@ghost
Copy link

ghost commented May 24, 2023

Hi @github-actions[bot]. This PR was just approved to be included in the upcoming servicing release. Somebody from the @dotnet/aspnet-build team will get it merged when the branches are open. Until then, please make sure all the CI checks pass and the PR is reviewed.

Copy link
Member

@mkArtakMSFT mkArtakMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving as this is just a backport and the original PR was approved already.

Copy link
Member

@mkArtakMSFT mkArtakMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving as this is just a backport and the original PR was approved already.

@wtgodbe wtgodbe merged commit 5b70c6e into release/8.0-preview5 May 24, 2023
@wtgodbe wtgodbe deleted the backport/pr-48406-to-release/8.0-preview5 branch May 24, 2023 20:44
@ghost ghost added this to the 8.0-preview5 milestone May 24, 2023
@ghost ghost added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework Servicing-approved Shiproom has approved the issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants