cwtools / cwtools-vscode

A VS Code extension providing language server support for paradox script files using cwtools
Other
88 stars 12 forks source link

Massive memory spike requiring restart #8

Closed lamancha212 closed 4 years ago

lamancha212 commented 4 years ago

Several times since the latest update something is causing cwtools to use a massive amount of memory (10 gb+) and a great deal of processor usage as well.

This last occurred when I was trying to search inside a file. I have two windows open with the extension running and files (including the same file) in each if that might help pinpoint the issue.

I had never encountered this before the last update.

Also possibly unrelated (as I also updated vscode), but I used to be able to edit the same file in multiple windows and it would share the edits across them simultaneously (I could make sure they were in sync due to the edit dot). Now it requires I save to update the changes across windows. This probably isn't related to your extension but in case it was and you might know of a fix I thought I'd bring it up.

tboby commented 4 years ago

Hi! I would expect high peak memory usage when you first open VS Code and cwtools "activates". This should peak around 2GB, but should drop to below 1GB once loaded. It'll drop even further if memory pressure is applied.

10GB sounds very high, unless you have something on the order of 60-70k script files (which is 4-5x bigger than any total conversion I've seen).

Is this something you can reproduce? If so, it would be very helpful if you could do the following:

  1. Enable logging: "File", "Preferences", "Settings", then search for cwtools and set cwtools.trace.server to "Messages".
  2. Close VS Code
  3. Reproduce the problem (opening multiple windows if you need to).
  4. For each window, get the logs, "View", "Output" then in the panel that opened select "Paradox language server" in the dropdown on the right.
  5. Copy those logs into files and drop them here. You might want to redact your username.

Re your syncing problem: check the setting files.autoSave. and files.autoSaveDelay I've never tried opening two copies of cwtools on the same files, but it should be fine (although they'll do twice as much work for the shared files as they don't share). Have you considered using workspaces? They might help in your situation.

lamancha212 commented 4 years ago

I have only 111 "script files" (not including pictures) that are only 30 mb total, the largest being under 5 mb. I had multiple script files open more than once, and several game files but nothing that I think would be huge like a mod with 70k files.

I turned on logging and then couldn't reproduce it, but somehow in the process I also managed to turn off error reporting from the extension which explains why the memory usage never even got above 500 mb.

I thought maybe the extension was maybe just recognizing customizable localizations and eventtarget scopes in the localization files without flagging them but I can't get any error to show up now. I'll try reinstalling and see if it happens once I get that to work again. Thanks for your reply, it is probably something on my end.

After reinstall I had some issues with my firewall blocking it I think, once I fixed it in my firewall and moved my mod folder to the mod folder (it was in a different directory before) as that is the only place where vscode will run cwtools for some reason now I got it to recognize errors, and no memory spikes it is staying right around 1.25-2 GB.

But now it is giving a ton of new weird errors it never did before like every has_country_flag or triggered picture entries are all giving errors. I must have had some different settings before or it was only half working or something (due to firewall) because none of this was an issue before.

Is it possible that somehow I could have set it to stellaris syntax or another game instead of EUIV? I don't see anything like that. I put it in a named workspace, and so it is isolated again to just my mod but it still takes a long time for the files to show up in CWTOOLS LOADED FILES and it seems to stop after a certain number are loaded no matter how many I open or preview with the window open could this be why I am getting so many errors like "Expected defined value of has_country_flag"?

lamancha212 commented 4 years ago

I'm not able to reproduce this since reinstalling vscode and the extension, it was something on my end probably. Highest it has gotten is 4.5 GB for a short time which is fine.