SanderRonde / phpstan-vscode

PHPStan plugin for VSCode
https://marketplace.visualstudio.com/items?itemName=SanderRonde.phpstan-vscode
MIT License
40 stars 9 forks source link

When previous check is killed, following check fails #18

Closed driskell closed 1 year ago

driskell commented 1 year ago

When you trigger two checks quickly, for example by opening a file, entering a space (which seems to trigger an instance check) and then saving immediately (triggering another), it kills the first check, but then the new check also fails due to the output from Phpstan about the previous one failing.

[file-watcher] Document changed, checking
[check:10] Check started for file:///x.php
[check:10] Spawning PHPStan with the following configuration:  {"binCmd":"x/vendor/bin/phpstan","args":["analyse","-c","x/phpstan.neon","--error-format=raw","--no-interaction","--memory-limit=1G","--no-progress","x.php","-a","tmpx/autoload.php","-c","tmpx/config.neon"]}
[file-watcher] Document changed, checking
[check:11] Check started for file:///x.php
[check:10] Check completed for file:///x.php errors= {}
[file-watcher] Document changed, checking
[file-manager] Not checking file "file:///x.php", file check is pending (checkId=11)
[file-watcher] Document saved, checking
[file-manager] Not checking file "file:///x.php", file check is pending (checkId=11)
[file-watcher] Document active, checking
[file-manager] Not checking file "file:///x.php", file check is pending (checkId=11)
[check:11] Spawning PHPStan with the following configuration:  {"binCmd":"x/vendor/bin/phpstan","args":["analyse","-c","x/phpstan.neon","--error-format=raw","--no-interaction","--memory-limit=1G","--no-progress","x.php","-a","tmpx/autoload.php","-c","tmpx/config.neon"]}
[check:11] PHPStan process exited with error  filteredErr=PHPStan crashed in the previous run probably because of excessive memory consumption.
It consumed around 57 MB of memory.
To avoid this issue, allow to use more memory with the --memory-limit option.  rawErr=PHPStan crashed in the previous run probably because of excessive memory consumption.
It consumed around 57 MB of memory.

To avoid this issue, allow to use more memory with the --memory-limit option.
  data=
[check:11] Check completed for file:///x.php errors= {}
SanderRonde commented 1 year ago

Ah good find. Will fix this as soon as I get the chance. Thanks for the detailed report!

SanderRonde commented 1 year ago

I'm having a bit of a hard time reproducing it but I'm pretty sure I've got a good fix for it. Could you try out the attached .vsix file? Because github does not allow uploading of .vsix files I've renamed it to .zip. Just rename it and drop it into VSCode. Thanks! phpstan-vscode-2.2.14.zip

SanderRonde commented 1 year ago

I'll be publishing the fix (even though it's untested) because I'd rather potentially fix it than wait for a response. Please let me know if you get around to testing it again to verify that it worked.