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 #1341

Closed
minhtranite opened this issue Nov 6, 2018 · 9 comments Β· Fixed by ckeditor/ckeditor5-core#155
Closed

Memory leak #1341

minhtranite opened this issue Nov 6, 2018 · 9 comments Β· Fixed by ckeditor/ckeditor5-core#155
Assignees
Labels
type:bug This issue reports a buggy (incorrect) behavior.
Milestone

Comments

@minhtranite
Copy link

Is this a bug report or feature request? (choose one)

🐞 Bug report

πŸ’» Version of CKEditor

<script src="https://cdn.ckeditor.com/ckeditor5/11.1.1/balloon/ckeditor.js"></script>

πŸ“‹ Steps to reproduce

  1. Create a editor instance
  2. Destroy it

βœ… Expected result

Memory not increment

❎ Actual result

Memory increment each time create and destroy

πŸ“ƒ Other details that might be useful

@oleq
Copy link
Member

oleq commented Nov 6, 2018

I also confirm that:

image

image

image

After the first destruction

image

After the second destruction

image

cc @Reinmar

@Reinmar
Copy link
Member

Reinmar commented Nov 6, 2018

This is a regression because we tested for that about 2 years ago and there were no leaks at all.

@Reinmar Reinmar added type:bug This issue reports a buggy (incorrect) behavior. status:confirmed labels Nov 6, 2018
@Reinmar Reinmar added this to the iteration 22 milestone Nov 6, 2018
@oleq
Copy link
Member

oleq commented Nov 15, 2018

about 2 years ago

I think that's why we should make it a part of every major release.

@Reinmar
Copy link
Member

Reinmar commented Nov 15, 2018

Yes. We should have a regression test for that. As a general rule – since we have a bug, we must have a test. Ideally – automated. AFAIR there was some API available for making snapshots and accessing such performance information. Even if it's in just one browser, let's have a test for that.

@minhtranite
Copy link
Author

minhtranite commented Nov 23, 2018

Sorry! What is iteration 22 milestone mean ? It not assign due date so I want to ask when this issue can be fixed ? I'm using it on production app so It will be good if you can fix it soon.

@jodator jodator assigned jodator and unassigned jodator Jan 4, 2019
@jodator
Copy link
Contributor

jodator commented Jan 15, 2019

@minhtranite Hi the good news is that we identified what was the problem and it will be fixed soon.

The iteration 22 is a current one so the next official release should have this fix included.

@jodator
Copy link
Contributor

jodator commented Jan 15, 2019

@Reinmar & @pomek: Some technical question about Travis integration. The tests uses Google Chrome run with additional flag in order to expose garbage collector for tests. The tests itself are generic one that runs create/destroy couple of times and compares used JS heap size after first run and after the last.

After some fiddling with them locally I've identified that 1 MB is sufficient to both minimize false positives and to actually catch a memory leaks automatically. Unfortunately memory measurements are repeatable to some extent. To minimize errors the garbage collecting step is necessary.

Also I think that running memory leak tests only for Chrome is sufficient to detect them.

The question is how to enable them on CI? Note: there will be dedicated manual test pages with instructions on how to check memory usage.

Note that memory leak tests are long running - I've added dome timeouts before crate/destroy steps in order to have everything run and allow garbage collector to work. Also as memory test aren't 100% reproducible with used memory the failed test is retried to eliminate false positives. The test itself take about 6-7 seconds to complete due to timeouts.

We can either:

ps.: The tests are skipped when the window.gc() is not available.

Edit: It looks like the window.gc() is blocking so no timeouts are needed and tests runs within normal timeout. So the test can be run with others and we can modify the default Chrome configuration.

@jodator
Copy link
Contributor

jodator commented Jan 15, 2019

After some fiddling with them locally I've identified that 1 MB is sufficient to both minimize false positives

There was one more component causing memory leaks. Probably we're going to be safe with 0 as a test there.

@minhtranite
Copy link
Author

Thank you guys!

pomek added a commit to ckeditor/ckeditor5-dev that referenced this issue Jan 16, 2019
Other: Added the `'--js-flags="--expose-gc"'` flag to Karma Chrome launcher configuration. See ckeditor/ckeditor5#1341.
oleq added a commit to ckeditor/ckeditor5-core that referenced this issue Jan 22, 2019
Fix: There should be no memory leaks when the editor is created and destroyed. Created helpers for testing memory usage. Closes ckeditor/ckeditor5#1341.
oleq added a commit to ckeditor/ckeditor5-widget that referenced this issue Jan 22, 2019
Fix: There should be no memory leaks when the editor is created and destroyed (see ckeditor/ckeditor5#1341).
oleq added a commit to ckeditor/ckeditor5-utils that referenced this issue Jan 22, 2019
Fix: There should be no memory leaks when the editor is created and destroyed (see ckeditor/ckeditor5#1341).
oleq added a commit to ckeditor/ckeditor5-ui that referenced this issue Jan 22, 2019
Fix: There should be no memory leaks when the editor is created and destroyed (see ckeditor/ckeditor5#1341).
oleq added a commit to ckeditor/ckeditor5-link that referenced this issue Jan 22, 2019
Fix: There should be no memory leaks when the editor is created and destroyed (see ckeditor/ckeditor5#1341).
oleq added a commit to ckeditor/ckeditor5-image that referenced this issue Jan 22, 2019
Fix: There should be no memory leaks when the editor is created and destroyed (see ckeditor/ckeditor5#1341).
oleq added a commit to ckeditor/ckeditor5-engine that referenced this issue Jan 22, 2019
Fix: There should be no memory leaks when the editor is created and destroyed (see ckeditor/ckeditor5#1341).
oleq added a commit to ckeditor/ckeditor5-editor-inline that referenced this issue Jan 22, 2019
Fix: There should be no memory leaks when the editor is created and destroyed (see ckeditor/ckeditor5#1341).
oleq added a commit to ckeditor/ckeditor5-editor-decoupled that referenced this issue Jan 22, 2019
Fix: There should be no memory leaks when the editor is created and destroyed (see ckeditor/ckeditor5#1341).
oleq added a commit to ckeditor/ckeditor5-editor-classic that referenced this issue Jan 22, 2019
Fix: There should be no memory leaks when the editor is created and destroyed (see ckeditor/ckeditor5#1341).
oleq added a commit to ckeditor/ckeditor5-editor-balloon that referenced this issue Jan 22, 2019
Fix: There should be no memory leaks when the editor is created and destroyed (see ckeditor/ckeditor5#1341).
oleq added a commit to ckeditor/ckeditor5-build-classic that referenced this issue Jan 22, 2019
Tests: Added a test checking memory leaks when the editor is created and destroyed (see ckeditor/ckeditor5#1341).
oleq added a commit to ckeditor/ckeditor5-build-balloon that referenced this issue Jan 22, 2019
Tests: Added a test checking memory leaks when the editor is created and destroyed (see ckeditor/ckeditor5#1341).
oleq added a commit to ckeditor/ckeditor5-build-decoupled-document that referenced this issue Jan 22, 2019
Tests: Added a test checking memory leaks when the editor is created and destroyed (see ckeditor/ckeditor5#1341).
oleq added a commit to ckeditor/ckeditor5-build-inline that referenced this issue Jan 22, 2019
Tests: Added a test checking memory leaks when the editor is created and destroyed (see ckeditor/ckeditor5#1341).
JDinABox pushed a commit to JDinABox/ckeditor5-build-markdown that referenced this issue Sep 6, 2021
Tests: Added a test checking memory leaks when the editor is created and destroyed (see ckeditor/ckeditor5#1341).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants