Skip to content

Fix not unsubscribing in trace detail on navigation#6666

Merged
JamesNK merged 3 commits intomainfrom
jamesnk/tracedetails-dispose-subscriptions
Nov 21, 2024
Merged

Fix not unsubscribing in trace detail on navigation#6666
JamesNK merged 3 commits intomainfrom
jamesnk/tracedetails-dispose-subscriptions

Conversation

@JamesNK
Copy link
Copy Markdown
Member

@JamesNK JamesNK commented Nov 14, 2024

Description

The trace detail page isn't unsubscribing from repository updates when navigating away. That causes a memory leak by holding onto the TraceDetail page instance from the singleton TelemetryRepository instance.

Changes:

  • TraceDetail didn't implement dispose. That means navigating away from the page never cleaned up subscriptions.
  • UpdateDetailViewData created a subscription, but the subscription callback also called UpdateDetailViewData. In the right circumstances two subscriptions are created but only one is disposed.
  • Added TraceDetail page tests

Profiler showing data leak when repeatedly navigating to and from trace details page:

image

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?
Microsoft Reviewers: Open in CodeFlow

@JamesNK JamesNK merged commit d3764d1 into main Nov 21, 2024
@JamesNK JamesNK deleted the jamesnk/tracedetails-dispose-subscriptions branch November 21, 2024 23:54
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants