streetsidesoftware / vscode-spell-checker

A simple source code spell checker for code
https://streetsidesoftware.github.io/vscode-spell-checker/
Other
1.45k stars 131 forks source link

100% CPU on 2 cores #265

Closed bheimbaugh closed 5 years ago

bheimbaugh commented 6 years ago
bheimbaugh commented 6 years ago

Even after disabling & uninstalling the extension, closing all vscode windows and quitting vscode, 1 of the processes is still running.

USER               PID  %CPU %MEM      VSZ    RSS   TT  STAT STARTED      TIME COMMAND
brookh           13613 100.0  0.6  5156564  97332   ??  R    12:46PM 195:53.28 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Users/brookh/.vscode/extensions/streetsidesoftware.code-spell-checker-1.6.10/node_modules/vscode-languageclient/lib/utils/electronForkStart /Users/brookh/.vscode/extensions/streetsidesoftware.code-spell-checker-1.6.10/server/src/server.js --node-ipc --clientProcessId=13609
Jason3S commented 6 years ago

It can be very annoying when this happens. It can happen when VS Code updates. For some reason, it occasionally leaves the extension running. The best thing is to just kill the process and restart VS Code.

serkanyersen commented 6 years ago

@Jason3S When dealing with large files, this happens everytime. I've put some details here https://github.com/Microsoft/vscode/issues/58671

Closing vscode leaves the Code Helper behind. Can spell checker disable itself on large files?

Jason3S commented 6 years ago

Thank you. It already has a limit set for large files, but it might not be working as expected.

abridgett commented 5 years ago

Some more data points here as I think I'm hitting the same issue. I'd love to help figure out what's going on (e.g. get a stack trace or something) but not sure how to do that with this.

I've hit this several times this week. No large files, no upgrades of vscode whilst running. I've mostly been editing ZSH and readmes. The fact that code helper is left behind when vscode is closed is probably because it's unresponsive (I presume it's being sent a signal/request to quit but it's stuck in a loop or something).

VScode: Version 1.34.0 (1.34.0) code-spell-checker: 1.7.12

"pstree" before quitting:

 |-+= 87648 abridgett /Applications/Visual Studio Code.app/Contents/MacOS/Electron
 | |--- 87649 abridgett /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --type=gpu-process --no-sandbox --gpu-preferences=KAAAAAAAAACAAAAAA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AAAAFAAAAEgAAABAAAAAAAAAABQAAABMAAAAQAAAAAAAAAAYAAAAFAAAAEAAAAAAAAAAGAAAACwAAABAAAAAAAAAABgAAAA0AAAAQAAAAAAAAAAYAAAAPAAAAEAAAAAAAAAAGAAAAEAAAABAAAAAAAAAABgAAABIAAAAQAAAAAAAAAAYAAAATAAAA --service-request-channel-token=5CED03BCD2945BCEE5D78459D6D0FA6F
 | |-+- 87650 abridgett /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --type=renderer --no-sandbox --service-pipe-token=9CBFE2A74C67B2FCC0A2D4AABC374229 --lang=en-US --app-path=/Applications/Visual Studio Code.app/Contents/Resources/app --node-integration=true --webview-tag=true --no-sandbox --background-color=#171717 --num-raster-threads=4 --enable-zero-copy --enable-gpu-memory-buffer-compositor-resources --enable-main-frame-before-activation --enable-compositor-image-animations --service-request-channel-token=9CBFE2A74C67B2FCC0A2D4AABC374229 --renderer-client-id=4
 | | |-+- 87700 abridgett /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --nolazy --inspect=9655 /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-fork --type=extensionHost
 | | | |--- 87707 abridgett /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Users/abridgett/.vscode/extensions/mtxr.sqltools-0.19.3/languageserver.js --node-ipc --clientProcessId=87700
 | | | \--- 87712 abridgett /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Users/abridgett/.vscode/extensions/streetsidesoftware.code-spell-checker-1.7.12/server/server.js --node-ipc --clientProcessId=87700
 | | \--- 87701 abridgett /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-fork --type=watcherService
 | \--- 87702 abridgett /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --type=renderer --no-sandbox --service-pipe-token=B3D28A8CBF20814752D4D584910B2F71 --lang=en-US --app-path=/Applications/Visual Studio Code.app/Contents/Resources/app --node-integration=true --webview-tag=true --no-sandbox --background-color=#171717 --disable-blink-features=Auxclick --num-raster-threads=4 --enable-zero-copy --enable-gpu-memory-buffer-compositor-resources --enable-main-frame-before-activation --enable-compositor-image-animations --service-request-channel-token=B3D28A8CBF20814752D4D584910B2F71 --renderer-client-id=6
 |--- 87699 abridgett /Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Resources/crashpad_handler --no-rate-limit --no-upload-gzip --database=/var/folders/kk/7ff3lrmn065b90wc3n843mrr0000gn/T/VSCode Crashes --metrics-dir=/var/folders/kk/7ff3lrmn065b90wc3n843mrr0000gn/T/VSCode Crashes --url=https://rink.hockeyapp.net/api/2/apps/21a48a66799e47fea4f52c0ff81e803d/crashes/upload --handshake-fd=64
 |--- 87755 abridgett /Users/abridgett/.vscode/extensions/ms-vsliveshare.vsliveshare-1.0.311/dotnet_modules/vsls-agent --autoexit --enableRpcInitialize --pipe vscode.6ebe0c70f0d09c590ded4a101a43b37c --service https://prod.liveshare.vsengsaas.visualstudio.com/

after closing just the spell checker is left:

87712 abridgett /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Users/abridgett/.vscode/extensions/streetsidesoftware.code-spell-checker-1.7.12/server/server.js --node-ipc --clientProcessId=87700
abridgett commented 5 years ago

I've found a four line test case that reliably triggers this. I wonder if it is some form of pathological backtracking. The test case is trimmed as much as I can - it's very sensitive now - anything I've tried to remove stops the test case from causing problems. Hopefully this will help to find the cause.

The extension is using 1m43 (ish) of CPU time to parse this file (after which time CPU load drops off and the extension quits when I quit VScode). If I quit vscode pretty much immediately then the extension keeps running but quits after about 48 secs. I wonder if the stuck processes early were just worse pathological cases.

NB: the file is detected as plain text (i.e. it's not a "shell script" type issue).

f2.txt

Jason3S commented 5 years ago

Thank you. I found the issue.

Jason3S commented 5 years ago

@abridgett Thank you for the example. It is what I had needed.

Until I publish a new version, Please add this to your user settings:

    "cSpell.patterns": [
        { "name": "RsaCert", "pattern": "/BEGIN\\s+(CERTIFICATE|RSA\\s+(?:PRIVATE|PUBLIC)\\s+KEY)(?:[\\w=+\\-\\/]*\\r?\\n)+?-*END\\s+\\1/g" }
    ],

It redefines the pattern used to exclude RSA Certificates from being checked.

abridgett commented 5 years ago

wonderful! That was super speedy :) Happy to confirm with the cSpell.patterns tweak the original (much larger) file has no issue.

Jason3S commented 5 years ago

I'm closing this issue as fixed, but I am not sure if the original issue was fixed. But since there isn't enough information to go on, I'm going to close it.

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.