-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
monaco-graphql: workers not cleaned up -> memory leak #1706
Comments
probably an issue with the WorkerManager which should be doing that garbage collection. maybe you can open a PR? |
Is there someone I can talk to to get a good understanding of the architecture? There are a lot of moving parts, language server and workers are new to me. If someone could bring me up to speed I'd be happy to submit a PR and fix it. |
Hopefully i can get a chance in the coming weeks! i'm the person who wrote most of it. @cshaver knows a lot about it as well! |
how to get get started to wok on this issue about where to head to find this issue |
use this example |
@sachin746 make sure to follow the readme instructions for the monaco example, you need to yarn and yarn build in a few different places first. @jensneuse this bug is entirely in the PR to fix this would only involve changes to that one file. you can see the WorkerManager that monaco-json or monaco-yaml or other monaco modes use as an example, almost exactly the same behavior. I would set up a call if I had time, but alas I do not currently :( |
@acao thanks for the hints. I'll have a look probably next week. |
prioritizing this for the 2.0 effort, added to the roadmap! |
@jensneuse are you able to provide a codesandbox or some such to reproduce this bug by chance? |
I think the behaviour of the monaco language workers leads to memory leaks.
I'm using an extension of the monaco-graphql webpack example with a React application.
I initialize an editor and model on component mount and dispose both on component unmount.
On first mount, looking at the Memory tab of the Chrome devtools I can see 3 workers.
One editor.worker.js and two instances of graphql.worker.js, which seems to be fine.
On first unmount, the editor.worker.js disappears while the two graphql.worker.js stay active.
On second mount I can see a new editor.worker.js instance appear.
On the graphql.worker.js part, I now have 3 active instances.
On the second unmount, the editor.worker.js disappears again, while the 3 graphql.worker.js instances stay.
If I keep re-mounting the component I see the numbers of graphql.worker.js piling up.
It's the same behaviour in Firefox.
I'm just thinking, why do you keep the worker around?
The editor worker disappears immediately once you dismount the editor & model.
There should be no reason to keep them running, does it?
Even if there is a reason to keep instances running, unused instances should still be garbage collected I think?
The text was updated successfully, but these errors were encountered: