vlang / vls

V language server. (Old V language server - see v-analyzer)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

High cpu and ram consumption

AndreMenew opened this issue · comments

System Information

V doctor

OS: windows,  v
Processor: 8 cpus, 64bit, little endian, Error: exec failed (CreateProcess) with code 2: O sistema não pode encontrar o arquivo especificado.
 cmd: wmic cpu get name /format:table
CC version: Error: exec failed (CreateProcess) with code 2: O sistema não pode encontrar o arquivo especificado.
 cmd: cc --version

getwd: C:\v\vls\bin
vmodules: C:\Users\AndreLuiz\.vmodules
vroot: C:\v
vexe: C:\v\v.exe
vexe mtime: 2022-07-02 03:33:15
is vroot writable: true
is vmodules writable: true
V full version: V 0.3.0 5b97ad1

Git version: git version 2.36.0.windows.1
Git vroot status: weekly.2022.26-28-g5b97ad15
.git/config present: true
thirdparty/tcc status: thirdparty-windows-amd64 125e21e2

VLS info

vls version 0.0.1.f764ed3

Problem Description

The system is consuming too much memory and power.

Expected Output

Low resource consumption.

Actual Output

vls.log

vls

Steps to Reproduce

Last Recorded LSP Requests

I'm also seeing this in Windows with the CI-built vls executable.

image

I get no auto-completion and vls.log doesn't contain anything (it's 0 length) while VSCode runs. After VSCode exits, vls.log is written to with the following contents:

{"kind":"send-response","message":{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"VLS Version: 0.0.1.607138c, OS: windows 64"}},"timestamp":1656889674}
{"kind":"send-response","message":{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"VLS executable path: D:\\dev\\vls\\vls_windows_x64.exe"}},"timestamp":1656889674}
{"kind":"send-response","message":{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"VLS build with V 5b97ad1"}},"timestamp":1656889674}
{"kind":"send-response","message":{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Client / Editor: Visual Studio Code - Insiders 1.69.0-insider (PID: 16344)"}},"timestamp":1656889674}
{"kind":"send-response","message":{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Using V path (VROOT): c:\\dev\\projects-open-source\\v"}},"timestamp":1656889674}
{"kind":"send-response","message":{"jsonrpc":"2.0","id":0,"result":{"capabilities":{"textDocumentSync":2,"hoverProvider":true,"completionProvider":{"resolveProvider":false,"triggerCharacters":["=",".",":","{",",","("," "]},"signatureHelpProvider":{"triggerCharacters":["("],"retriggerCharacters":[","," "]},"definitionProvider":true,"typeDefinitionProvider":false,"implementationProvider":true,"referencesProvider":false,"documentHightlightProvider":false,"documentSymbolProvider":true,"workspaceSymbolProvider":true,"codeActionProvider":false,"codeLensProvider":{"resolveProvider":false},"documentFormattingProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"","moreTriggerCharacter":[]},"renameProvider":false,"documentLinkProvider":false,"colorProvider":false,"declarationProvider":false,"executeCommandProvider":"","foldingRangeProvider":true,"experimental":{}}}},"timestamp":1656889674}
{"kind":"send-response","message":{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///d%3A/dev/projects/_v/abc/first.v","diagnostics":[]}},"timestamp":1656889674}
{"kind":"send-response","message":{"jsonrpc":"2.0","id":null,"result":null},"timestamp":1656890235}

The VSCode extension's output doesn't provide any info.

image

I remember that with earlier versions of the extension, vls.log used to have content while VSCode is running. Could it be that the high "I/O total rate" that I'm seeing for the vls process is due to some problem properly writing to the log file?

Some additional info:

When I enable/disable the language server debug mode there's an error notification.

image

This happens despite the language server running (see the extension's output, above).

commented

i just installed the Windows Performance Recorder on my windows vm which i can confirm. will try to resolve this issue immediately

image

commented

Result after d5db5b7 (little improvements so far...)

Screenshot 2022-07-05 142205 after d5db5b7

commented

However, when I tried executing VLS in "child" mode (without crash reporting and etc), this is the result:
Screenshot 2022-07-05 142532 on child

CPU utilization is 0% on standby and up to 6% if there's activity.

Which leads me to the conclusion that this might be a problem on the crash reporting / parent process. The screenshot below confirms this:
Screenshot 2022-07-05 143359 with parent process on powershell

Hopefully this should lead us to the right path in fixing this issue 🤞

commented

@asampal Just a follow-up regarding your issue, this might have been fixed in 7610a0a please confirm.

If not, please create a separate issue so that we can track it properly. Thanks :)

Thanks, @nedpals - this has resolved the problem wrt to high CPU and I/O for me as well.