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

Memory leak fixes for several views #7057

Merged
merged 69 commits into from
Sep 20, 2023
Merged

Memory leak fixes for several views #7057

merged 69 commits into from
Sep 20, 2023

Conversation

shefalijoshi
Copy link
Contributor

@shefalijoshi shefalijoshi commented Sep 14, 2023

Closes #4406 #4209

Describe your changes:

  • Adds memory leak check suite to perf tests
  • Use Vue.createApp for dynamically mounting components.
  • Not registering listeners on bound <method>.bind(this...) or anonymous functions ()=>{}.
  • Remove event listeners properly (including the bullet point above)
  • Ensure objects are destroyed on unload
  • Remove references to objects between components (actionCollections, display layout toolbar)
  • Disables vue-loader's hoistStatic option which was holding onto refs

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Is this change backwards compatible? For example, developers won't need to change how they are calling the API or how they've extended core plugins such as Tables or Plots.

Author Checklist

  • Changes address original issue?
  • Tests included and/or updated with changes?
  • Command line build passes?
  • Has this been smoke tested?
  • Testing instructions included in associated issue OR is this a dependency/testcase change?

Reviewer Checklist

  • Changes appear to address issue?
  • Reviewer has tested changes by following the provided instructions?
  • Changes appear not to be breaking changes?
  • Appropriate automated tests included?
  • Code style and in-line documentation are appropriate?
  • Has associated issue been labelled unverified? (only applicable if this PR closes the issue)
  • Has associated issue been labelled bug? (only applicable if this PR is for a bug fix)

e2e/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@ozyx ozyx left a comment

Choose a reason for hiding this comment

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

The diff is not clean, I think we're reverting changes accidentally. Please rebase this onto master

@codecov
Copy link

codecov bot commented Sep 14, 2023

Codecov Report

Merging #7057 (d25be18) into master (61e7050) will increase coverage by 0.12%.
The diff coverage is 44.15%.

@@            Coverage Diff             @@
##           master    #7057      +/-   ##
==========================================
+ Coverage   55.12%   55.25%   +0.12%     
==========================================
  Files         650      649       -1     
  Lines       25972    26041      +69     
  Branches     2539     2547       +8     
==========================================
+ Hits        14318    14389      +71     
- Misses      10953    10958       +5     
+ Partials      701      694       -7     
Flag Coverage Δ *Carryforward flag
e2e-full 41.98% <ø> (+0.02%) ⬆️ Carriedforward from 81d4354
e2e-stable 57.33% <56.75%> (+4.07%) ⬆️
unit 48.68% <38.31%> (-0.47%) ⬇️

*This pull request uses carry forward flags. Click here to find out more.

Files Changed Coverage Δ
src/plugins/charts/bar/BarGraphPlot.vue 43.29% <ø> (ø)
...plugins/charts/scatter/ScatterPlotWithUnderlay.vue 2.17% <ø> (ø)
...ugins/condition/components/ConditionCollection.vue 0.00% <ø> (ø)
...ins/conditionWidget/components/ConditionWidget.vue 24.24% <0.00%> (ø)
src/plugins/displayLayout/DisplayLayoutToolbar.js 76.28% <0.00%> (+1.03%) ⬆️
src/plugins/displayLayout/components/BoxView.vue 0.00% <0.00%> (ø)
...c/plugins/displayLayout/components/EllipseView.vue 0.00% <0.00%> (ø)
src/plugins/displayLayout/components/ImageView.vue 0.00% <0.00%> (ø)
...c/plugins/displayLayout/components/LayoutFrame.vue 0.00% <ø> (ø)
...plugins/displayLayout/components/SubobjectView.vue 9.09% <0.00%> (-0.44%) ⬇️
... and 42 more

... and 34 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 61e7050...d25be18. Read the comment docs.

@deploysentinel
Copy link

deploysentinel bot commented Sep 14, 2023

Current Playwright Test Results Summary

✅ 14 Passing

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 09/20/2023 05:32:51pm UTC)

Run Details

Running Workflow e2e-couchdb on Github Actions

Commit: d25be18

Started: 09/20/2023 05:31:02pm UTC

View Detailed Build Results


Current Playwright Test Results Summary

✅ 139 Passing - ⚠️ 2 Flaky

Run may still be in progress, this comment will be updated as current testing workflow or job completes...

(Last updated on 09/20/2023 05:32:51pm UTC)

Run Details

Running Job e2e-stable on CircleCI

Commit: d25be18

Started: 09/20/2023 05:02:25pm UTC

⚠️ Flakes

📄   functional/planning/timelist.e2e.spec.js • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Time List Create a Time List, add a single Plan to it and verify all the activities are displayed with no milliseconds
Retry 1Initial Attempt
1.54% (2) 2 / 130 runs
failed over last 7 days
50% (65) 65 / 130 runs
flaked over last 7 days

📄   functional/plugins/notebook/notebookSnapshots.e2e.spec.js • 1 Flake

Test Case Results

Test Case Last 7 days Failures Last 7 days Flakes
Snapshot image tests Can drop an image onto a notebook and create a new entry
Retry 1Initial Attempt
0% (0) 0 / 41 runs
failed over last 7 days
78.05% (32) 32 / 41 runs
flaked over last 7 days

View Detailed Build Results


@ozyx ozyx added this to the Target:3.0.2 milestone Sep 14, 2023
@@ -56,7 +56,7 @@ export default {
mounted() {
this.openmct.editor.on('isEditing', this.setEditMode);
},
beforeUnmounted() {
Copy link
Contributor

Choose a reason for hiding this comment

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

HAH! oopsie 😊

@@ -81,7 +81,7 @@ export default {
this.listenToConditionSetChanges();
}
},
beforeUnmount() {
unmounted() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This works - I don't understand why.

Copy link
Contributor

@ozyx ozyx left a comment

Choose a reason for hiding this comment

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

I approve 👀

@ozyx ozyx added the pr:e2e:couchdb npm run test:e2e:couchdb label Sep 20, 2023
@github-actions github-actions bot removed the pr:e2e:couchdb npm run test:e2e:couchdb label Sep 20, 2023
@ozyx ozyx merged commit b8949db into master Sep 20, 2023
8 of 9 checks passed
@ozyx ozyx deleted the vue3-createApp-leak-fixes branch September 20, 2023 17:34
ozyx added a commit that referenced this pull request Sep 20, 2023
* Change the mount utility to use Vue's createApp and defineComponent methods

* Fix display layout memory leaks caused by `getSelectionContext`

* fix some display layout leaks due to use of slots

* Fix imagery memory leak (removed span tag). NOTE: CompassRose svg leaks memory - must test on firefox to see if this is a Chrome leak.

* Fix ActionsAPI action collection and applicable actions leak.

* Fix flexible layout memory leaks - remove listeners on unmount. NOTE: One type of overlay plot (Rover Yaw) is still leaking.

* pass in the el on mount

* e2e test config and spec changes

* Remove mounting of limit lines. Use components directly

* test: remove `.only()`

* Fix display layout memory leaks

* Enable passing tests

* e2e README and appActions should be what master has.

* lint: add word to cspell list

* lint: fixes

* lint:fix

* fix: revert `el` change

* fix: remove empty span

* fix: creating shapes in displayLayout

* fix: avoid `splice` as it loses reactivity

* test: reduce timeout time

* quick fixes

* add prod mode and convert the test config to select the correct mode

* Fix webpack prod config

* Add launch flag for exposing window.gc

* never worked

* explicit naming

* rename

* We don't need to destroy view providers

* test: increase timeout time

* test: unskip all mem tests

* fix(vue-loader): disable static hoisting

* chore: run `test:perf:memory`

* Don't destroy view providers

* Move context menu once listener to beforeUnmount instead.

* Disconnect all resize observers on unmount

* Delete Test vue component

* Use beforeUnmount and remove splice(0) in favor of [] for emptying arrays

* re-structure

* fix: unregister listener in pane.vue

* test: tweak timeouts

* chore: lint:fix

* test: unskip perf tests

* fix: unregister events properly

* fix: unregister listener

* fix: unregister listener

* fix: unregister listener

* fix: use `unmounted()`

* fix: unregister listeners

* fix: unregister listener properly

* chore: lint:fix

* test: fix imagery layer toggle test

* test: increase timeout

* Don't use anonymous functions for listeners

* Destroy objects and event listeners properly

* Delete config stores that are created by components

* Use the right unmount hook. Destroy mounted view on unmount.

* Use unmounted, not beforeUnmounted

* Lint fixes

* Fix time strip memory leak

* Undo unneeded change for memory leaks.

* chore: combine common webpack configs

---------

Co-authored-by: Jesse Mazzella <jesse.d.mazzella@nasa.gov>
Co-authored-by: John Hill <john.c.hill@nasa.gov>
ozyx added a commit that referenced this pull request Sep 20, 2023
* Change the mount utility to use Vue's createApp and defineComponent methods

* Fix display layout memory leaks caused by `getSelectionContext`

* fix some display layout leaks due to use of slots

* Fix imagery memory leak (removed span tag). NOTE: CompassRose svg leaks memory - must test on firefox to see if this is a Chrome leak.

* Fix ActionsAPI action collection and applicable actions leak.

* Fix flexible layout memory leaks - remove listeners on unmount. NOTE: One type of overlay plot (Rover Yaw) is still leaking.

* pass in the el on mount

* e2e test config and spec changes

* Remove mounting of limit lines. Use components directly

* test: remove `.only()`

* Fix display layout memory leaks

* Enable passing tests

* e2e README and appActions should be what master has.

* lint: add word to cspell list

* lint: fixes

* lint:fix

* fix: revert `el` change

* fix: remove empty span

* fix: creating shapes in displayLayout

* fix: avoid `splice` as it loses reactivity

* test: reduce timeout time

* quick fixes

* add prod mode and convert the test config to select the correct mode

* Fix webpack prod config

* Add launch flag for exposing window.gc

* never worked

* explicit naming

* rename

* We don't need to destroy view providers

* test: increase timeout time

* test: unskip all mem tests

* fix(vue-loader): disable static hoisting

* chore: run `test:perf:memory`

* Don't destroy view providers

* Move context menu once listener to beforeUnmount instead.

* Disconnect all resize observers on unmount

* Delete Test vue component

* Use beforeUnmount and remove splice(0) in favor of [] for emptying arrays

* re-structure

* fix: unregister listener in pane.vue

* test: tweak timeouts

* chore: lint:fix

* test: unskip perf tests

* fix: unregister events properly

* fix: unregister listener

* fix: unregister listener

* fix: unregister listener

* fix: use `unmounted()`

* fix: unregister listeners

* fix: unregister listener properly

* chore: lint:fix

* test: fix imagery layer toggle test

* test: increase timeout

* Don't use anonymous functions for listeners

* Destroy objects and event listeners properly

* Delete config stores that are created by components

* Use the right unmount hook. Destroy mounted view on unmount.

* Use unmounted, not beforeUnmounted

* Lint fixes

* Fix time strip memory leak

* Undo unneeded change for memory leaks.

* chore: combine common webpack configs

---------

Co-authored-by: Shefali Joshi <simplyrender@gmail.com>
Co-authored-by: John Hill <john.c.hill@nasa.gov>
@shefalijoshi shefalijoshi added the performance impacts or improves performance label Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance impacts or improves performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Performance] Check views for memory leak on navigation
4 participants