Fork me on GitHub
#lsp
<
2021-12-06
>
Stefan12:12:54

I’m afraid I also have a case of 100% CPU usage, but basically all the time, not just for a while. I mean, I just had lunch and it stayed on 100% all that time. I’m using the latest version through Calva (vscode). In the trace log (enabled through Calva settings), I don’t see anything happening. Also the log file doesn’t show anything happening. I have already tried to throw away all things like caches. One special thing of note maybe: sometimes it’s OK when I launch vscode and start working, and then it starts thrashing at some point (and doesn’t stop). I don’t know what triggers it. Oh and force-killing the process just causes it to restart and immediately get back into the same situation. The fans of my laptop would be very grateful for a solution or suggestions on how to diagnose this. As would I 🙂

ericdallo12:12:24

Could you paste the return of server info command?

ericdallo12:12:36

I think there is a calva command for that

Stefan12:12:45

clojure-lsp version used: 2021.12.01-12.28.16 clj-kondo version used: 2021.10.20-SNAPSHOT Clojure-lsp server info: { "client-settings": { "auto-add-ns-to-new-files?": true, "cljfmt": { "indents": {} }, "document-formatting?": false, "dependency-scheme": "jar", "keep-require-at-start?": true, "document-range-formatting?": false, "cljfmt-config-path": ".cljfmt.edn" }, "project-root-uri": "[redacted]", "clj-kondo-version": "2021.10.20-SNAPSHOT", "final-settings": { "auto-add-ns-to-new-files?": true, "cljfmt": { "indents": {} }, "document-formatting?": false, "dependency-scheme": "jar", "keep-require-at-start?": true, "source-paths": [ "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]", "[redacted]" ], "project-specs": [ { "project-path": "project.clj", "classpath-cmd": [ "lein", "classpath" ] }, { "project-path": "deps.edn", "classpath-cmd": [ "clojure", "-A:dev:test", "-Spath" ] }, { "project-path": "build.boot", "classpath-cmd": [ "boot", "show", "--fake-classpath" ] }, { "project-path": "shadow-cljs.edn", "classpath-cmd": [ "npx", "shadow-cljs", "classpath" ] }, { "project-path": "bb.edn", "classpath-cmd": [ "bb", "print-deps", "--format", "classpath" ] } ], "source-aliases": [ {}, {} ], "uri-format": { "upper-case-drive-letter?": false, "encode-colons-in-path?": false }, "document-range-formatting?": false, "cljfmt-config-path": ".cljfmt.edn" }, "port": "NREPL only available on :debug profile (make debug-bin`)",` "server-version": "2021.12.01-12.28.16", "log-path": "/var/folders/pb/bpqwngc509z77r228yr_75z00000gn/T/clojure-lsp.17387178897337450842.out", "project-settings": {} }

ericdallo12:12:22

Do you override source-aliases or source-paths manually in any clojure-lsp config?

Stefan12:12:29

No, I don’t have custom clojure-lsp config at all.

pithyless12:12:30

@UKFSJSM38 I've suffered from 100% CPU usage and my Emacs locking up; I didn't particularly suspect LSP until now, but I guess it may be related. We do use custom source-paths in our monorepo - is there some kind of hypothesis I can help you to debug?

ericdallo12:12:34

could you paste the output o clojure-lsp server log? there is a command for that as well

ericdallo12:12:11

@U05476190 not really, is just that I saw a lot of source-paths and I thought it could be some weird custom config

ericdallo12:12:35

usually clojure-lsp CPU takes time only when starting the procces/analyzing the project, after that it should be ok

pithyless12:12:41

No, this is an issue of emacs locking up and requiring restart. Next time it happens, what kind of data should I try to extract from running processes?

pithyless12:12:36

(even to disprove clojure-lsp as a potential culprit)

pithyless12:12:45

would the clojure-lsp log be enough?

ericdallo12:12:01

yes, check if there is any on server log should help

ericdallo12:12:41

but I never saw LSP lock emacs completly

pithyless12:12:19

OK, next time it shows up I'll keep the LSP log in mind

pithyless12:12:07

@UGNFXV1FA - sorry, didn't mean to derail your thread :)

Stefan13:12:35

Right, just to make sure: this was vscode, not emacs 🙂

👍 1
Stefan16:12:32

@UKFSJSM38 I just now saw that you requested server logs, sorry about that. I guess somebody hijacked my thread 😛 I got a 3MB file here, which I don’t really want to post to Slack. What’s the best way to get it to you?

ericdallo16:12:53

That sounds big and hard to debug, could you try to restart and reproduce the issue again? Also is that the clojure-lsp server log, not the client<->server json one, right?

Stefan06:12:58

Huh it turns out that the troublesome repo was not the one I was working in, but a second one that I also had open in vscode. This is the log:

2021-12-07T06:49:30.778Z  INFO [clojure-lsp.server:446] - Starting server...
2021-12-07T06:49:30.890Z  DEBUG [clojure-lsp.nrepl:21] - nrepl not found, skipping nrepl server start...
2021-12-07T06:49:30.919Z  INFO [clojure-lsp.server:319] - Initializing...
and this is the output of the client in vscode:
[Trace - 7:57:27 AM] Sending request 'initialize - (0)'.
[Trace - 7:57:27 AM] Received notification '$/progress'.
After that I killed it. I know noticed that in that window, in the status bar it keeps saying “Initializing Clojure language features via clojure-lsp” indefinitely. Also in that repo I cleaned everything out (`rm -rf .lsp`), which didn’t help.

ericdallo12:12:18

So it's freezing on the initialize, is this all the server logs it prints? I'd expect more

Stefan13:12:18

Yep that’s it…