kenkangxgwe / lsp-wl

A Wolfram Language Server
MIT License
214 stars 22 forks source link

Server constantly eats 30% of cpu core #42

Open p-pavel opened 3 years ago

p-pavel commented 3 years ago

macOS/MMA 12.2/12.3pre, VSCode. 'development' branch.

This behaviour persist even when VSCode is not visible and nothing happens.

Any hints on how to diagnose this further are welcome.

kenkangxgwe commented 3 years ago

VSCode is not visible and nothing happens

Could you explain why is VSCode not visible? Did you install the vscode extension?

p-pavel commented 3 years ago

VSCode is not visible and nothing happens

Could you explain why is VSCode not visible? Did you install the vscode extension?

I meant I minimised it to make sure there's no user (mine) activity so the server should probably be idle.

kenkangxgwe commented 3 years ago

image

I am not sure how you can monitor the sub-processes on Mac, but could you confirm that it is the wolfram kernel (highlighted in the above screenshot) that consumes 30% CPU, or the other sub-processes of VSCode?

p-pavel commented 3 years ago
image
p-pavel commented 3 years ago

This is the WolframKernel started by VSCode extension and running lsp

kenkangxgwe commented 3 years ago

Did you start the wolfram executable from some place liek /Applications/Mathematica.app/Contents/MacOS/wolfram? Just wonder why it is shown as WolframKernel instead, but that may not related to the issue.

Again, after a short while of high CPU usage, could you attach the wlserver.log? That will help the investigation. Thanks

p-pavel commented 3 years ago

Did you start the wolfram executable from some place liek /Applications/Mathematica.app/Contents/MacOS/wolfram? Just wonder why it is shown as WolframKernel instead, but that may not related to the issue.

every executable of this kind (wolfram/wolframscript) ends up running WolframKernel under macOS, they're just a thin wrappers. In this case wolfram executable was started.

Again, after a short while of high CPU usage, could you attach the wlserver.log? That will help the investigation. Thanks Currently I have two of them after closing and reopening VSCode :)

image

Log file attached but it does not seem very informative

wlserver.log

p-pavel commented 3 years ago

image

I am not sure how you can monitor the sub-processes on Mac, but could you confirm that it is the wolfram kernel (highlighted in the above screenshot) that consumes 30% CPU, or the other sub-processes of VSCode?

Looking at your screenshot I suppose the problem is macOS specific (didn't have a change to check under Linux yet). So I'll probably try to investigate it more thoroughly.

VasilySotnikov commented 3 years ago

I think it would be useful to add here that I can confirm similar behaviour on Linux distributions Ubuntu 20.04 and openSUSE Tumbleweed.

In fact, I am using lsp-wl not with VSCode, but with vim through coc-lsp-wl interface. The process

WolframKernel -script <..>/init.wls <...>

always takes up to 30-40% of a CPU while vim is idle, and this also happens even with vim in terminal (without graphical interface). Most of the time this process even stays running when I close vim and it continues to take up similar CPU load until I kill it manually, but this is likely an unrelated problem.

newptcai commented 3 years ago

@VasilySotnikov Same problem here. Have to kill the server manually each time.