Sarrus1 / sourcepawn-studio

VSCode extension for SourcePawn scripting
https://sarrus1.github.io/sourcepawn-studio/
MIT License
147 stars 23 forks source link

CPU and RAM maximum load #63

Closed BRU7U5 closed 3 years ago

BRU7U5 commented 3 years ago

Basic info

Further Information

After starting working with .sp files, VS Code starts running many SourcePawn Compiler processes (spcomp.exe), which leads to a CPU load of up to 100% and almost completely consumes RAM.

CPU: Intel Core i7 7700 RAM: 16GB

SourceMod 1.10

issue

Sarrus1 commented 3 years ago

Hi, thanks for reporting this.

I suspect that this comes from the linter, which never closes when the compile fails.

Are you working with many .sp files opened at the same time? Do you have MainPath set? And if not, are you compiling with the green arrow or vscode tasks?

BRU7U5 commented 3 years ago

Hello!

I suspect that this comes from the linter, which never closes when the compile fails.

I tried to disable linter and after starting of compiling and receiving compilation error, the process "spcomp.exe" doesn't have been closed. It led to a high CPU and RAM load.

Are you working with many .sp files opened at the same time? Do you have MainPath set? And if not, are you compiling with the green arrow or vscode tasks?

I working with single and many .sp files. In all cases it led to "hanging" a process and spam other "spcomp.exe" processes. I have MainPath set. I compiling it by calling context menu (Right Click) and clicking "SM Compile file".

P.S. I noticed that the reason for this bug is precisely the erroneous compilation of the plugin. After a compilation error, the process spcomp.exe doesn't close. And during the subsequent compilation, it is created again. In some cases that are still unknown to me, it is created again. Because with 3-4 compilation attempts, there were already more than 10 non-closed processes in the processes list (as in the screenshot). But now I have found a temporary way to fix this problem - it is necessary to click the button with the image of a garbage can in the plugin compilation terminal (the lower VS Code window), which shuts down the terminal. But I'm not sure that this method helps 100% of the time.

But, it seems to me that this is not so much a problem of your extension, as of the spcomp.exe. I tried to run it manually for the test with erroneous or unsuccessful compilations, which also led to the process hanging.

UPDATE

I think I found another reason that creates so many processes and does not close them. I just ran a test in which I switched between different tabs in the project (switched between .sp files). Each such switch created a new process spcomp.exe it's as if when switching tabs, automatic compilation occurs, although I don't do anything.

Sarrus1 commented 3 years ago

The processes appearing when switching tabs are probably the linter.

I'm 99% sure spcomp should close itself after it was ran, whether or not the compile was successful. Are you using a stable version of spcomp? Maybe try to upgrade/switch to a stable version.

I don't have a windows PC with me atm so I won't be able to test this myself.

BRU7U5 commented 3 years ago

The processes appearing when switching tabs are probably the linter.

I'm 99% sure spcomp should close itself after it was ran, whether or not the compile was successful. Are you using a stable version of spcomp? Maybe try to upgrade/switch to a stable version.

I don't have a windows PC with me atm so I won't be able to test this myself.

Im using a stable build of SourceMod 1.10 git-6510

Sarrus1 commented 3 years ago

Alright, in that case, can you try compiling by hand in a regular windows shell? To see if the process closes or not

BRU7U5 commented 3 years ago

Alright, in that case, can you try compiling by hand in a regular windows shell? To see if the process closes or not

Hm, tried to change SourceMod version to 1.10 git-6488 and its works fine. It seems that this was the problem. Sorry for bothering you.

Sarrus1 commented 3 years ago

No problem, glad you figured it out 👍