-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
source= directive on 4000 LOC drains 64GB RAM and trigger OOM #3177
Comments
Comments and "white" space, I'd add to that script, for starters...
…On Fri, Mar 28, 2025, 15:16 dezza ***@***.***> wrote:
I had this snippet in my bashrc.
#!/bin/bashexport NVM_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/nvm"
# shellcheck source=/home/dza/.local/config/nvm/nvm.sh
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
With 64GB DDR5 in less than a minute;
mar 28 23:04:20 ocelot kernel: Out of memory: Killed process 41299 (shellcheck) total-vm:1073848180kB, anon-rss:1512428kB, file-rss:680kB, shmem-rss:0kB, UID:1000 pgtables:70180kB oom_score_adj:200
The LSP client in vim then restarted shellcheck and the same thing
happened over and over.
I believe the 4000 LOC of nvm.sh
https://github.com/nvm-sh/nvm/blob/master/nvm.sh
Might be the trigger.
—
Reply to this email directly, view it on GitHub
<#3177>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AUF2F2Z4N3WMJKV7PPWP3YL2WW32PAVCNFSM6AAAAAB2ARFPAOVHI2DSMVQWIX3LMV43ASLTON2WKOZSHE2TOMZXGM4TENY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
[image: dezza]*dezza* created an issue (koalaman/shellcheck#3177)
<#3177>
I had this snippet in my bashrc.
#!/bin/bashexport NVM_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/nvm"
# shellcheck source=/home/dza/.local/config/nvm/nvm.sh
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
With 64GB DDR5 in less than a minute;
mar 28 23:04:20 ocelot kernel: Out of memory: Killed process 41299 (shellcheck) total-vm:1073848180kB, anon-rss:1512428kB, file-rss:680kB, shmem-rss:0kB, UID:1000 pgtables:70180kB oom_score_adj:200
The LSP client in vim then restarted shellcheck and the same thing
happened over and over.
I believe the 4000 LOC of nvm.sh
https://github.com/nvm-sh/nvm/blob/master/nvm.sh
Might be the trigger.
—
Reply to this email directly, view it on GitHub
<#3177>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AUF2F2Z4N3WMJKV7PPWP3YL2WW32PAVCNFSM6AAAAAB2ARFPAOVHI2DSMVQWIX3LMV43ASLTON2WKOZSHE2TOMZXGM4TENY>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Oof. The process is listed as using 1.5G (VIRT usage is 1T but that's lazily initialized), but I do see it spending 20 seconds and using 3G, and that would especially be a problem with some kind of LSP that invokes it repeatedly. ShellCheck defaults to a whole-program iterative data flow analysis which in this case causes a very unfortunate memory explosion in in a file you don't even care about. To unblock this, you can add |
@koalaman is this something that can be mitigated or handled properly differently? Like a timeout for completion, memory limit. |
@dezza The There is a handful of checks that depends on this functionality and subsequently won't trigger, such as SC2317 "Command appears unreachable", SC2319 "$? refers to a condition", SC2324 "var+=1 will append, not increment" (the common denominator being that they require tracing the control flow of the script), but it beats the behavior as described. I considered auto-disabling the functionality for especially large or cyclomatically complex scripts, but that runs into the issue of warnings suddenly vanishing when crossing the threshold. |
@koalaman heh, I just tried to get I'm hoping there is a timeout in shellcheck, a sensible upper limit/timeout that can trigger an exit status that language servers can act on and relay to the lsp client itself. It doesn't seem like If I run I'm guessing the lsp clients kills it themselves because they have an upper limit. Maybe it would be an idea to enable such long processing explicitly with another argument or a repeated |
I had this snippet in my bashrc.
With 64GB DDR5 in less than a minute;
The LSP client in vim then restarted shellcheck and the same thing happened over and over.
I believe the 4000 LOC of nvm.sh
https://github.com/nvm-sh/nvm/blob/master/nvm.sh
Might be the trigger.
The text was updated successfully, but these errors were encountered: