Closed devurandom closed 4 months ago
Thanks for the report, I'm working on improving the troubleshooting even more for cases like that. Did you try to disable Cursive? they are not compatible and you will face issues when using both.
Did you try to disable Cursive?
I just tried, but everything looks exactly the same (as in my screenshots above). I cannot notice any difference.
@devurandom, that's interesting, I cannot repro that though, can you try to reproduce that in this repro?
can you try to reproduce that in this repro?
I disabled Cursive and Clojure Extras (which depends on Cursive) and enabled Clojure LSP. I restarted IntelliJ. I opened the local clone of that sample. The in the IntelliJ window for the sample, "background task" first showed "starting server" and then "initializing" and it got stuck there, just like before. I closed my main project IntelliJ window and restarted IntelliJ with only the sample project window open. This time the background task went from "starting server" to "analyzing external classpath" and now Clojure LSP appears to work. When I now switch back to my main project (open in: this window), Clojure LSP works there, too. When I now restart IntelliJ with just my main project window open, Clojure LSP will "starting server", "initializing", "finding cache", "analyzing external classpath" and it continues to work.
Unrelated bug: I opened async.clj
in the sample project and when I press CTRL and hover the mouse over one of the Thread/sleep
invocations, a lot of home/.../Thread.java
tabs open, showing a file with /** GWT compatible no-op replacement for {@code Thread}. */
and a stub public class Thread { ... }
.
That probably is happening because with no project associated clojure-lsp is starting in a folder different than your project root, even so, it should show a error message when the classpath is not found, I'll try to improve the tools settings window to allow specifing a server log path but probably it's related with clojure-lsp being started in a folder different than your Clojure project root
Unrelated bug: I opened async.clj in the sample project and when I press CTRL and hover the mouse over one of the Thread/sleep invocations, a lot of home/.../Thread.java tabs open, showing a file with /* GWT compatible no-op replacement for {@code Thread}. / and a stub public class Thread { ... }.
Yeah, there is a bug that the file is opened automatically, I should fix it soon
@ericdallo I'm was having the same issue in my IntelliJ. When I click to stop LSP server it don't stop either.
I noticed it occurred when I have multiple projects open (which is the default for my usage). Here are the logs I exported:
2024-01-11 09:35:36,595 [ 17409] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: Syntax error compiling at (nrepl/middleware/completion.clj:23:1).
2024-01-11 09:35:36,887 [ 17701] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: Syntax error compiling var at (nrepl/server.clj:96:1).
2024-01-11 09:42:47,560 [ 17150] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: java.net.BindException: Address already in use
2024-01-11 14:48:14,740 [18344330] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: java.net.BindException: Address already in use
2024-01-11 17:26:06,361 [27815951] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: java.net.BindException: Address already in use
2024-01-11 17:54:41,582 [29531172] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: java.net.BindException: Address already in use
2024-01-12 10:34:44,197 [ 28734] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: java.net.BindException: Address already in use
2024-01-12 10:34:44,198 [ 28735] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: java.net.BindException: Address already in use
2024-01-12 10:34:44,200 [ 28737] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: java.net.BindException: Address already in use
2024-01-12 10:34:44,201 [ 28738] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: java.net.BindException: Address already in use
2024-01-12 10:40:16,386 [ 22527] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: Syntax error macroexpanding at (nrepl/middleware/dynamic_loader.clj:1:1).
2024-01-12 10:40:16,408 [ 22549] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: Syntax error macroexpanding at (nrepl/middleware/dynamic_loader.clj:1:1).
2024-01-12 10:40:16,419 [ 22560] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: Syntax error macroexpanding at (nrepl/middleware/dynamic_loader.clj:1:1).
2024-01-12 10:40:16,428 [ 22569] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: Syntax error macroexpanding at (nrepl/middleware/dynamic_loader.clj:1:1).
2024-01-12 10:40:16,436 [ 22577] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: Syntax error macroexpanding at (nrepl/middleware/dynamic_loader.clj:1:1).
2024-01-12 10:49:58,690 [ 15037] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: java.net.BindException: Address already in use
2024-01-12 10:49:58,690 [ 15037] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: java.net.BindException: Address already in use
2024-01-12 10:49:58,691 [ 15038] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: java.net.BindException: Address already in use
2024-01-12 10:49:58,691 [ 15038] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: java.net.BindException: Address already in use
2024-01-12 10:51:38,477 [ 15851] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: java.net.BindException: Address already in use
2024-01-12 10:51:38,477 [ 15851] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: java.net.BindException: Address already in use
2024-01-12 10:51:38,477 [ 15851] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: java.net.BindException: Address already in use
2024-01-12 10:51:38,477 [ 15851] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: java.net.BindException: Address already in use
2024-01-12 10:56:34,030 [ 13491] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: java.net.BindException: Address already in use
2024-01-12 10:56:34,030 [ 13491] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: java.net.BindException: Address already in use
2024-01-12 10:58:26,211 [ 13958] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: java.net.BindException: Address already in use
2024-01-12 10:58:26,211 [ 13958] WARN - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure LSP] Could not start nrepl server, error: java.net.BindException: Address already in use
Errors highlighted:
@romulo-oliveira-nubank, thank you! that should help! The Address already in use are related with a development nrepl server we try to start, it should not be a problem and only a warning, but I will check how can we improve that. I hope that's not related with this bug, but I'll double check
I released the plugin 1.14.3 which should not throw any of these exceptions, but I think it's not related with this issue yet.
I see these clj4intellij related log messages:
2024-02-27 10:52:48,722 [ 10229] INFO - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [null] Skipping nrepl server start, no config found.
2024-02-27 10:52:48,732 [ 10239] INFO - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [null] Starting clojure-lsp plugin...
I get a log file in the default location (/tmp/clojure-lsp.X.out
) instead of the configured location ("server log path": /tmp/clojure-lsp-intellij.log
, but that file does not exist):
❯ cat /tmp/clojure-lsp.17079323471841263323.out
2024-02-27T09:53:06.871Z INFO [clojure-lsp.server:620] - [SERVER] Starting server...
2024-02-27T09:53:07.234Z INFO [clojure-lsp.nrepl:18] - ====== LSP nrepl server started on port 44947
lsof /tmp/clojure-lsp.17079323471841263323.out
returns an error (exit code 1).
Searching for that "LSP nrepl server started on port 44947" yields:
❯ netstat -nptul | rg 44947
tcp6 0 0 127.0.0.1:44947 :::* LISTEN 18006/java
PID 18006
is IntelliJ IDEA (.../.local/share/JetBrains/Toolbox/apps/intellij-idea-ultimate/jbr/bin/java ... com.intellij.idea.Main
).
If this is the Clojure LSP server started by the plugin, notice how it takes almost 20s between "Starting clojure-lsp plugin" and "Starting server".
I configured "server trace level" to verbose
, but the /tmp/clojure-lsp.17079323471841263323.out
log file seems to be pretty quiet.
Is it possible that the plugin passes options in the wrong way?
"server info" is nil
and "server version" is "server not started", but I guess that is expected. Is there a way to figure out what version of the server the plugin intends to run with? The equivalent of:
❯ clojure-lsp --version
clojure-lsp 2024.02.01-11.01.59
clj-kondo 2023.12.15
I just noticed that https://clojure-lsp.io/installation/#embedded-jar-legacy-executable says:
In Github releases you will find a
clojure-lsp
file that runs a embedded jar. This should be removed soon, use GraalVM binaries instead.
Does this affect the IntelliJ plugin?
Same with IntelliJ 2024.1 EAP6 and Clojure LSP 1.14.9:
IntelliJ IDEA 2024.1 EAP (Ultimate Edition)
Build #IU-241.13688.18, built on February 21, 2024
Licensed to IntelliJ IDEA EAP user: [REDACTED]
Expiration date: [REDACTED]
Runtime version: 17.0.10+8-b1207.1 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 6.7.5-200.fc39.x86_64
GC: G1 Young Generation, G1 Old Generation
Memory: 8192M
Cores: 8
Registry:
ide.experimental.ui=true
Non-Bundled Plugins:
com.jetbrains.plugins.ini4idea (241.13688.39)
org.jetbrains.plugins.go (241.13688.18)
com.github.clojure-lsp (1.14.9)
com.intellij.grazie.pro (0.3.287)
name.kropp.intellij.makefile (241.13688.16)
com.intellij.plugins.watcher (241.13688.16)
org.intellij.plugins.hcl (241.13688.16)
com.jetbrains.rust (241.24015.147)
com.jetbrains.space (241.13688.16)
org.jetbrains.plugins.go-template (241.13688.16)
com.intellij.ideolog (222.3.1.0)
org.jetbrains.plugins.localization (241.13688.16)
com.intellij.properties.bundle.editor (241.13688.16)
Pythonid (241.13688.18)
com.intellij.datagen (241.13688.16)
com.intellij.aqua (241.13688.39)
PlantUML integration (7.7.0-IJ2023.2)
com.intellij.ml.llm (241.13688.18)
mobi.hsz.idea.gitignore (4.5.2)
com.jetbrains.packagesearch.intellij-plugin (241.0.4)
com.intellij.tide (241.13688.22)
mdx.js (241.13688.16)
com.dmarcotte.handlebars (241.13688.16)
com.intellij.bigdatatools.core (241.13688.18)
com.intellij.bigdatatools.binary.files (241.13688.18)
com.intellij.bigdatatools.rfs (241.13688.18)
com.intellij.bigdatatools.metastore.core (241.13688.18)
com.intellij.bigdatatools.spark (241.13688.18)
to.bri.intellij.clubhouse (0.1.13)
net.ashald.envfile (3.4.2)
com.intellij.bigdatatools.kafka (241.13688.18)
Kotlin: 241.13688.18-IJ
Current Desktop: KDE
Thank you very much for the detailed info @devurandom, but one thing is important to notice, clojure-lsp-intellij uses clojure-lsp as a JVM dependency so no clojure-lsp
process is spawned... although I'm highly considering chang that as this issue + #26 would be probably be fixed by that... so that java process is probably not clojure-lsp or related to this plugin
I done like that because would it's pretty easy to just call the clojure public function to start the server and everything just works, but it seems it's causing these issues that I can't think a better way to solve, at least that would make it work like all other editors which spawn a clojure-lsp process as well
Folks, finally, this bug should be fixed by #34, now following all other editors standard, the plugin downloads automatically clojure-lsp process and spawn it instead of using clojure-lsp as a lib, it should not change anything to the final user, but it should fix this issue and others. Available on 2.0.0 version.
The issue persists even with plugin version 2.0.0.
I have set a "server log path":
But the log file does not exist:
❯ cat /tmp/clojure-lsp-intellij.log
cat: /tmp/clojure-lsp-intellij.log: No such file or directory
The process is running:
❯ ^ps aux | rg clojure-lsp
[REDACTED] 40727 0.0 0.0 33686252 49920 ? Sl 12:31 0:00 [REDACTED]/.local/share/JetBrains/IntelliJIdea2023.3/clojure-lsp/clojure-lsp listen
❯ ls -l /proc/40727/fd
# name type target readonly mode num_links inode user group size created accessed modified
0 /proc/40727/fd/0 symlink pipe:[2028149] true r-x------ 1 2028156 [REDACTED] [REDACTED] 64 B 34 minutes ago 34 minutes ago
1 /proc/40727/fd/1 symlink pipe:[2028150] false -wx------ 1 2028157 [REDACTED] [REDACTED] 64 B 34 minutes ago 34 minutes ago
2 /proc/40727/fd/2 symlink pipe:[2028151] false -wx------ 1 2028158 [REDACTED] [REDACTED] 64 B 34 minutes ago 34 minutes ago
3 /proc/40727/fd/3 symlink [REDACTED]/.local/share/JetBrains/IntelliJIdea2023.3/clojure-lsp/clojure-lsp true r-x------ 1 2028159 [REDACTED] [REDACTED] 64 B 34 minutes ago 34 minutes ago
4 /proc/40727/fd/4 symlink /dev/random true r-x------ 1 2028160 [REDACTED] [REDACTED] 64 B 34 minutes ago 34 minutes ago
5 /proc/40727/fd/5 symlink /dev/urandom true r-x------ 1 2034919 [REDACTED] [REDACTED] 64 B 34 minutes ago 34 minutes ago
Something I noticed (using nushell):
❯ ps -l | where name =~ "clojure-lsp"
Error: × Error getting process stat
╭─[source:1:1]
1 │ nu
· ▲
· ╰── Unexpected IO error(/proc/1/stat): Too many open files (os error 24)
╰────
This appears to be independent of clojure-lsp and only affect this one command.
Redirected here from issue #35. Updated plugin today and now I get a proper crash instead with the following stacktrace: (first line is pretty clear)
java.io.FileNotFoundException: https://github.com/clojure-lsp/clojure-lsp/releases/download/2024.03.01-11.37.51/null
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1996)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:224)
at java.base/java.net.URL.openStream(URL.java:1161)
at clojure.java.io$fn__11621.invokeStatic(io.clj:239)
at clojure.java.io$fn__11621.invoke(io.clj:235)
at clojure.java.io$fn__11569$G__11523__11576.invoke(io.clj:69)
at clojure.java.io$fn__11629.invokeStatic(io.clj:256)
at clojure.java.io$fn__11629.invoke(io.clj:254)
at clojure.java.io$fn__11569$G__11523__11576.invoke(io.clj:69)
at clojure.java.io$input_stream.invokeStatic(io.clj:136)
at clojure.java.io$input_stream.doInvoke(io.clj:121)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at com.github.clojure_lsp.intellij.server$download_server_BANG_.invokeStatic(server.clj:77)
at com.github.clojure_lsp.intellij.server$download_server_BANG_.invoke(server.clj:67)
at com.github.clojure_lsp.intellij.server$start_server_BANG_$fn__21205.invoke(server.clj:146)
at com.github.clojure_lsp.intellij.tasks$run_background_task_BANG_$run21108_impl__21110.invoke(tasks.clj:16)
at com.github.clojure_lsp.intellij.tasks.proxy_plus21107.run(Unknown Source)
at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:434)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:132)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$5(CoreProgressManager.java:484)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:248)
at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:73)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:192)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:610)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:685)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:641)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:609)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:78)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:179)
at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:73)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$5(ProgressRunner.java:248)
at com.intellij.openapi.progress.impl.ProgressRunner$ProgressRunnable.run(ProgressRunner.java:498)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
at java.base/java.lang.Thread.run(Thread.java:840)
This on IntelliJ 2023.3.4 (Ultimate Edition) on macOS Big Sur 11.7.10.
@gerdint your issue will be fixed on 2.0.1 (affects only mac non aarch64), I uploaded today morning, should be available later today or tomorrow
@devurandom that's weird, you may be facing this problem that happens only on macos
@ericdallo Cool, now it works. Static analysis seems to work well, off to explore the REPL!
FYI: I updated to 2.1.0 and now Clojure LSP initializes fine and proceeds to "analyzing external classpath".
@devurandom thanks for the reply, glad it works for you too
When I enable the Clojure LSP plugin or press the "restart" button in the settings (cf. https://github.com/clojure-lsp/clojure-lsp-intellij/blob/e017810ac2041c4d9c7804e684b74d0f18300206/docs/troubleshooting.md) I get an additional "Clojure LSP startup" background task, but the server never actually starts. "Copy server info to clipboard" gives me
nil
.ps aux
does not list any process withlsp
in its name, either.Note that I do also have Cursive enabled and that (as far as I can tell from
Settings > Editor > File Types > Clojure, ClojureScript and ClojureDart
, which I believe is the Clojure LSP plugin's file type) Cursive, providing the "Clojure file" section, still holds the*.clj
files, which are the only files in this project.