Fork me on GitHub
#lsp
<
2021-12-17
>
hugod13:12:49

I have a project where clojure-lsp --verbose diagnostics hangs at [ 0%] clojure-lsp with 100% cpu. No explicit lsp config. clojure-lsp 2021.12.01-12.28.16. Any hints on how to debug this?

hugod13:12:17

I have removed .lsp/.cache and .clj-kondo/.cache

ericdallo13:12:29

is it a deps.edn or lein project?

hugod13:12:57

it is a polylith project

ericdallo13:12:00

could you double check if clj -Spath runs without issues?

hugod13:12:26

It runs without issue. All the dependencies are in the :dev alias though, if that makes any difference.

ericdallo13:12:24

I never saw it blocks on 0%, something weird happening during this code: https://github.com/clojure-lsp/clojure-lsp/blob/master/src/clojure_lsp/crawler.clj#L193-L213

ericdallo13:12:50

does clojure-lsp works in your editor for this project or you don't use it?

hugod13:12:47

Emacs has the same issue - it starts the process but it hangs at 0%

ericdallo13:12:04

do you have any .lsp/config.edn or in your ~/.lsp/config.edn or ~/.config/clojure-lsp/config.edn ?

hugod13:12:31

have tried with and without .lsp/config.edn, and I don’t have a ~/.config/clojure-lsp/config.edn

hugod13:12:55

I’ll have a go at adding some debug to clojure-lsp

ericdallo13:12:23

yeah, also we probably should add more (report-callback) between de 0% and 5%

ericdallo13:12:31

it's the first time I see a bug on there

ericdallo13:12:55

I suspect there is some exception we were not expecting and should try/catch

ericdallo13:12:14

anyway, any exception on this flow should be catch to not avoid those freezes

ericdallo13:12:42

I was about to release new clojure-lsp version today, probably worth wait for this fix 😅

hugod13:12:55

I’let you know if I find something or run out of time for today

hugod14:12:57

it’s something in udpate-with-default-settings - still looking

ericdallo14:12:51

Hum :thinking_face:

ericdallo14:12:33

Probably something on clojure-lsp.source-paths/process-source-paths

hugod14:12:38

it’s the loop in resolve-deps-source-paths. Unfortunately I have to step away from this for a while

ericdallo14:12:42

thanks, that's already help me to start debugging later today, I just need to repro that in some polylith repo

ericdallo14:12:56

is that something special about your polylith project?

hugod14:12:39

I have a base with the same name as the project. I suspect a :local/root has a ../name path which is getting resolved at the project root level, rather than relative to the deps file in which it is a declared as a dependency. Yet to verify that though.

👀 1
hugod15:12:24

I’ve had the issue mentioned in 672 - not sure it’s related though.

ericdallo15:12:42

Let's wait to see what @UUKPL2T9C thinks, but I suspect it's related, anyway we should add a try catch there for any error on that process, to log a better message

Cnly15:12:03

Interesting, could you try changing it to an absolute path and see how it goes then?

ericdallo15:12:50

you meant a relative path right? the issue happens when it's an absolute path, right?

Cnly15:12:39

Umm, right, sorry I’ve mixed the two the whole time 😅

😅 1
hugod16:12:13

resolving local/root paths to be relative to their deps.edn file seems to fix things. https://github.com/clojure-lsp/clojure-lsp/commit/29835afdef80201f0490e04eeb42de6f5fbb1b9e

👍 1
ericdallo16:12:25

@U0HFRSY0M I'll merge @UUKPL2T9C PR's right now, it should fix your issue so

ericdallo16:12:27

@U0HFRSY0M I merged, could you try later with latest clojure-lsp, I'll try here as well

hugod17:12:49

That doesn’t seem to fix my issue.

😔 1
ericdallo17:12:12

I'll debug your branch local and try to figure it out

hugod18:12:51

You don’t think the fix in my branch is correct?

hugod18:12:58

is there some setup to make make test work - it complains “java.lang.ClassNotFoundException: clojure.tools.reader.reader_types.Reader”

ericdallo18:12:49

Oh, I totally missed your mention of your commit, let me take a look

ericdallo18:12:06

yes, run make classes

ericdallo18:12:29

@U0HFRSY0M looks good to me, can you open an PR adding a test as well? that source-paths discovery have too many corner cases 😅

👍 1