Skip to content
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

Conjure 4.40.x and Neovim 0.9.0 have 100% CPU by clojure-lsp when opening JAR using zipfile:/// scheme #494

Open
oryband opened this issue May 17, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@oryband
Copy link

oryband commented May 17, 2023

Similar Neovim setup as #481 , except I updated to Neovim 0.9.0 ; Opening the following file hangs the process entirely due to 100% CPU. Downgrading to Conjure 4.39.x or Neovim 0.8.3 resolves the issue. This also occurs if I install Neovim without snap, using apt install with the latest version (0.10.0-dev)

# this is a dependency library for one of my projects, managed via `lein deps`
$ nvim zipfile:///home/ory/.m2/repository/com/stuartsierra/component/1.0.0/component-1.0.0.jar::com/stuartsierra/component.cljc

Calling htop shows this

    PID  CPU%▽MEM%  DISK READ   DISK WRITE Command
 148218 291.3 16.9   58.99 M/s    0.00 B/s /snap/nvim/2801/usr/bin/nvim --embed
 148398 103.0  4.6    0.00 B/s    0.00 B/s /home/ory/.local/share/nvim/mason/bin/clojure-lsp
 148555 103.0  4.6    0.00 B/s    0.00 B/s pool-3-thread-1

Debug screenshot when hangs. I'm reached this zipfile via going to definition of component library:

; Assumed session: Sloughi (Clojure)
; debug: receive
{:id "51a2e239-03c0-450b-a688-2a71ebdc3ebe"
 :ns "user"
 :session "c4ec88da-16c5-4c5c-ae64-826602d463d1"
 :value "nil"}
; debug: receive
{:id "51a2e239-03c0-450b-a688-2a71ebdc3ebe"
 :session "c4ec88da-16c5-4c5c-ae64-826602d463d1"
 :status ["done"]}
; debug: send
{:code "(require 'component.core)"
 :id "485d9f3b-e0ea-4b29-9669-2a81c22402cb"
 :nrepl.middleware.print/options {:associative 1 :length 500 :level 50}
 :nrepl.middleware.print/print "conjure.internal/pprint"
 :op "eval"
 :session "e6a1b3af-bf5f-4b6e-9a93-f6baa713ce49"}
; debug: receive
{:id "485d9f3b-e0ea-4b29-9669-2a81c22402cb"
 :ns "some.ns.from.my.project"
 :session "e6a1b3af-bf5f-4b6e-9a93-f6baa713ce49"
 :value "nil"}
; debug: receive
{:id "485d9f3b-e0ea-4b29-9669-2a81c22402cb"
 :session "e6a1b3af-bf5f-4b6e-9a93-f6baa713ce49"
 :status ["done"]}
@oryband
Copy link
Author

oryband commented May 17, 2023

Update: I'm not entirely sure this is related to Conjure. See related Slack discussion in Clojurians here: https://clojurians.slack.com/archives/CPABC1H61/p1684239469765269

@oryband oryband changed the title Conjure 4.40.x and Neovim 0.9.0 hang when opening JAR using zipfile:/// scheme Conjure 4.40.x and Neovim 0.9.0 have 100% CPU by clojure-lsp when opening JAR using zipfile:/// scheme May 17, 2023
@Olical
Copy link
Owner

Olical commented May 21, 2023

😞 not good, I can open it just fine on the latest Conjure development commit and:

NVIM v0.9.0
Build type: Release
LuaJIT 2.1.0-beta3

It could be LSP related, although that'd surprise me too tbh. The things that changed over some of these Conjure / Neovim transition periods were breaking changes in Neovim's APIs that Conjure had to handle and branch on, so that's the most likely candidate.

So they changed some names of methods in the LSP API and I think a few things around how mappings and autocmds worked from the Lua side. So Conjure upgraded with those changes, moving off of the deprecated APIs and naming. Some parts had a switch where if you had an older Neovim it'd support the old approach for a while, so it gracefully degraded or at least supported older and newer Neovim versions.

One thing I've run into in the past was that my Tree Sitter grammars were out of date, so when I updated Neovim it crashed or hung until I performed the :TSUpdate command. Just trying to brain dump everything I think could be relevant to this right now since nothing stands out as a prime suspect so far.

@Olical
Copy link
Owner

Olical commented Jun 11, 2023

Did you ever get to the bottom of this? Or even get any more clues?

@oryband
Copy link
Author

oryband commented Jun 11, 2023

@Olical sorry for delay, I switch between Python and Clojure every few weeks which affects my responsiveness on these issues. Updating Treesitter parsers and queries has no effect on resolving. I'm running the same version as you. No idea what's causing this. Maybe if we could find a way to catch which neovim / lua calls are hanging it would help - but this has to be viewable outside of the neovim process since it hangs.

@Olical
Copy link
Owner

Olical commented Jun 11, 2023

Not a problem, no need to apologise! Thanks for trying those bits and ruling more out, I'll try to reproduce it myself and see if I can narrow it down. I still don't see how it'd be Conjure doing this, but your evidence of it going away at particular versions is quite convincing.

@oryband
Copy link
Author

oryband commented Jun 11, 2023

Suggestion: Try installing Ubuntu on a VM and reproduce

@oryband
Copy link
Author

oryband commented Jun 14, 2023

Update:

  • This is also reproducable by just opening a standalone x.clj file in my home directory (maybe since there's no existing repl).
  • The issue doesn't reproduce if opening a x.cljc file ! Looks like this doesn't start conjure (even though clojure lsp is starting). this strengthen the theory the issue is in conjure.

@Olical Olical added the bug Something isn't working label Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants