This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-23
Channels
- # announcements (2)
- # architecture (16)
- # babashka (26)
- # beginners (106)
- # calva (172)
- # chlorine-clover (19)
- # cider (36)
- # cljdoc (4)
- # clojure (113)
- # clojure-berlin (3)
- # clojure-czech (3)
- # clojure-dev (5)
- # clojure-europe (37)
- # clojure-france (3)
- # clojure-hamburg (12)
- # clojure-italy (4)
- # clojure-nl (2)
- # clojure-uk (22)
- # clojurescript (38)
- # cryogen (10)
- # cursive (30)
- # data-science (7)
- # datascript (1)
- # datomic (13)
- # deps-new (7)
- # depstar (13)
- # duct (3)
- # events (2)
- # exercism (3)
- # fulcro (31)
- # graalvm (56)
- # graphql (1)
- # helix (5)
- # java (12)
- # jobs-discuss (19)
- # kaocha (13)
- # luminus (1)
- # lumo (4)
- # malli (5)
- # off-topic (17)
- # parinfer (1)
- # pathom (1)
- # pedestal (7)
- # rdf (10)
- # re-frame (1)
- # remote-jobs (7)
- # rum (6)
- # shadow-cljs (4)
- # tools-deps (41)
- # uncomplicate (3)
- # vim (14)
if it's a request for a shortcut clearing the output, then I think we are pretty content with cmd+a delete
😃
as long as you are interacting with it... but doing it ”remotely”,... yeah. If you make it an issue+PR, I'll merge. 😃
yeah a lot of times I’m using the test runner on one side and watching the repl output in the other, so I’m not working in the repl window here
@borkdude one does not simply .... j/k, not following what you are asking actually. I just press ctrl+c
?
ctrl+c is not killing the repl for me, and I am not expecting it to. but it cancels the current prompt, as I expect it to. ctrl+d kills the repl.
[email protected] ~ $ clj
Clojure 1.10.1
user=>
ctrl-c in iTerm2 kills it for meThe same things work for me when I'm connected to the same machine over ssh in iterm2
Right so clj
is killed with ctrl+c
which is a bit odd, but that is what happens for me in both iterm and vscode terminal.
cmd+k cmd+s
shows you the key bindings. You can filter them. If you filter on ctrl+c
you should see what it is bound to in different contexts, I think.
that status looks like Ctrl+C is set as the leading part of a chord for some other keybinding?
so it's probably never getting sent to the terminal
clj-kondo has been slowing my machine to a crawl, I’ve been having to turn off the extension recently. Anybody have tips for debugging this issue? I really want to keep my linting turned on.
@stefan.toubia About to go afk, but if you can repro this using public code, I'd be happy to take a look. Are you using configs/hooks? Maybe setting those aside makes a difference? ttyl
Thanks, I’ll see what I can do. I’ve got a config in .clj-kondo, I’ll see if removing that changes anything
Also try linting from the command line with the binary version, see how long that takes
Will do. Might be hard to compare, since it’s just happening in the background in vscode. It just ends up causing all the calva features to slow down, so paredit stops behaving, my machine tries to take off, etc
I also noticed that after disabling clj-kondo extension and restarting vscode this process did not terminate
so I just killed the process, wiped out the .clj-kondo config and cache and reenabled clj-kondo extension
It’s been pretty consistent, I was on an older version of calva up until a week or two ago when I started getting this issue
To be sure, also lint your code with the command line version, just to see if you get any errors there
There is also a VSCode plugin that can use the native version, without a java process
calva does not use the clj-kondo extension, but it does use clj-kondo as a library in their JVM process
Having the same issue 😕 @stefan.toubia were you able to fix it?
the code for the plugin is here: https://github.com/borkdude/clj-kondo.lsp maybe you can run using a local version with some debug statements in it. Without any repro I can't help
I wish I knew what causes it 🙂
It works fine for hours but then suddenly some java
process starts eating all CPU. And it stays even after I quit VSCode.
After restart everything is fine. I’m trying to edit the same files, but it works ok.
and you can kill it of course, but other than that, I don't know. VSCode should be killing the server itself
Here's a similar bug: https://github.com/forcedotcom/salesforcedx-vscode/issues/968
I’ve tried to quit vscode now and kondo process was killed as well You know, maybe it is killed every time, but when it is in “100% CPU” mode it takes more time, will wait next time :thumbsup:
hmmm, I’ve just realized that I ran test via lein doo
not sure how they work, I didn’t do their setup, but I see that it copies a lot of files to target/cljsbuild/public/...
folder during start phase.
Could it be the reason?
And their content, well, is a copy. Can it confuse kondo? “Oh there are more than 1 definition”, somthing like that
macOS 10.14.6 no AV software installed It happens in the evening. Maybe OS schedules something like indexing (not sure why it affects kondo/java though), maybe something happens just b/c it works for a day and smth like memory leakage is happening
What we can do is put a bunch of debug statements in the plugin, make a vsix package and you watch the clj-kondo output panel
it should already output that it starts (and stops, but it's likely you won't see that since it only happens on workspace change )
Let’s wait, I will avoid running tests on my machine. For some reason I have a feeling that it is somehow connected. Unfortunately I don’t remember the exact day when I ran them for the first time and when the issue started to appear.
clearing the config didn’t help, eventually it just gets back to a bad state and I have to kill the process
thanks for the link @borkdude that’s a good lead, I’ll read through and see if it helps
actually something else I noticed is the CPU for the clj-kondo extension is shooting through the roof as I type as well. That first spike was just typing a bunch of ((((((()))))))
, That last block I just wrote a tiny function and the CPU stayed high for 30s after I stopped
would definitely be helpful to get more verbose output on the language server, will check back in if I find out more
I do see CPU activity as I type, which is expected, but nothing abnormal. do you use one or multiple workspaces at the same time?
@stefan.toubia @UFU7GAE15 Added a bunch of debug statements which are visible in the clj-kondo output pane
I made the VSIX from this branch, fyi https://github.com/borkdude/clj-kondo.lsp/tree/debug
Ok so this issue has come up again, I’ve gotten to a state where I have high clj-kondo CPU usage and I’m getting this in the clj-kondo debug output, even without touching anything in vscode it seems caught in a loop where this is output every couple seconds
[Error - 1:12:24 PM] [email protected]
changed file, linting: file:///Users/stoubia/src/liftoff/clj/lib/user/src/liftoff/user.clj
found config dir at /Users/stoubia/src/liftoff/.clj-kondo
[Error - 1:12:32 PM] [email protected]
changed file, linting: file:///Users/stoubia/src/liftoff/clj/lib/user/src/liftoff/user.clj
found config dir at /Users/stoubia/src/liftoff/.clj-kondo
[Error - 1:12:41 PM] [email protected]
I’m running this build now. Seems I am working with things today that triggers the clj-kondo+calva combo to freak out.
Yes. .91. I was speculating about wether the contents of the Calva output could be what triggers the condition. But maybe not, since we have disabled all linters for it…
can you post (maybe in a gist) the problem that clj-kondo prints to its output panel?
This may be the cause of this CPU spike, if calva keeps printing to the REPL and triggers clj-kondo. But please post output so we know for sure.
We can hard code the Calva output file name in the clj-kondo plugin so it's just always ignored
You can maybe replicate this scenario by printing output to the REPL every second or so
Do you see any output in the clj-kondo output panel. Like, is it trying to lint the REPL output?
Yeah, it prints when the files are changed.
changed file, linting: file:///Users/peter/Projects/app/.calva/output-window/output.calva-repl
found config dir at /Users/peter/Projects/app/.calva/output-window/.clj-kondo
publishing diagnostics
For project files it says the same thing except no file name after the message
found config dir at
I’ll notice immediately when I trigger the error, because I have my computer on my lap.
so I think we can safely ignore output.calva-repl
in the plugin right. this is just waste of clj-kondo cycles :)
> For project files it says the same thing except no file name after the message I think you might have no .clj-kondo dir for that project, right?
I'll just hardcode it for now, until clj-kondo gets support for it. This saves me doing another clj-kondo release for this one plugin only
diff: https://github.com/borkdude/clj-kondo.lsp/commit/878c704a229196cb97eb36e467bda051782489c7
I’ll wait installing .92 I think. I want the cpu to burn my lap up so that we can try figure out what causes the error. 😃
You have config {:linters ^:replace {}}
: this will still lint the file but not report any errors
I think Calva sets the output window to Clojure mode and this will make it lint with clj-kondo probably
@pez so, this probably does it: https://github.com/borkdude/clj-kondo.lsp/blob/878c704a229196cb97eb36e467bda051782489c7/vscode-extension/src/extension.ts#L56
I haven’t got a hot cpu in my lap since I started wishing for it. But I have two stack traces in the clj-kondo output that look like so:
[Error - 10:15:53 AM] java.lang.OutOfMemoryError: GC overhead limit exceeded
at clojure.lang.PersistentHashMap$BitmapIndexedNode.ensureEditable(PersistentHashMap.java:815)
at clojure.lang.PersistentHashMap$BitmapIndexedNode.assoc(PersistentHashMap.java:894)
at clojure.lang.PersistentHashMap$BitmapIndexedNode.assoc(PersistentHashMap.java:876)
at clojure.lang.PersistentHashMap$TransientHashMap.doAssoc(PersistentHashMap.java:327)
at clojure.lang.ATransientMap.assoc(ATransientMap.java:64)
at clojure.lang.ATransientSet.conj(ATransientSet.java:27)
at clojure.lang.ATransientSet.conj(ATransientSet.java:15)
at clojure.core$conj_BANG_.invokeStatic(core.clj:3366)
at clojure.core$conj_BANG_.invoke(core.clj:3358)
at clojure.lang.ArrayChunk.reduce(ArrayChunk.java:58)
at clojure.core$reduce1.invokeStatic(core.clj:942)
at clojure.core$set.invokeStatic(core.clj:4113)
at clj_kondo.impl.linters$lint_unused_namespaces_BANG_.invokeStatic(linters.clj:364)
at clj_kondo.core$run_BANG_.invokeStatic(core.clj:119)
at clj_kondo.lsp_server.impl.server$lint_BANG_$fn__11528.invoke(server.clj:126)
at clj_kondo.lsp_server.impl.server$lint_BANG_.invokeStatic(server.clj:125)
at clj_kondo.lsp_server.impl.server.LSPTextDocumentService.didChange(server.clj:152)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint$$Lambda$12/2115597658.apply(Unknown Source)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.notify(GenericEndpoint.java:152)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleNotification(RemoteEndpoint.java:220)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:187)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
Both are printed after the output has reported that a file has changed, and none of the files have been the output/rep file.
I think the maps containing all the stuff needs to be cleaned afterwards. Clj-kondo normally runs as a short-lived binary, so it's never been a problem there
My first guess was that the content in these atoms would get large over time: https://github.com/borkdude/clj-kondo/blob/master/src/clj_kondo/core.clj#L99-L117 but they are re-created on each lint, so the old ones would get garbage collected, I think
can you also check the memory usage of the corresponding java process (find the PID with jps
) when it happens?
Seems like the process went to bed after the last GC error:
[Error - 10:34:21 AM] Connection to server is erroring. Shutting down server.
[Error - 10:34:21 AM] Connection to server is erroring. Shutting down server.
[Error - 10:34:21 AM] Connection to server is erroring. Shutting down server.
@pez I have a suspicion where the resource leak might be. I use memoized functions to check things on a config, and this might hold on to something for too long. Can you check the memory usage of the clj-kondo java process over time for a few hours during work?
$ clj -J-Xmx1g
Clojure 1.10.1
user=> (require '[clj-kondo.core :as clj-kondo])
nil
user=> (dotimes [i 10] (do (clj-kondo/run! {:lint ["src"]})))
nil
user=> (dotimes [i 10] (do (clj-kondo/run! {:lint ["src"]})))
nil
user=> (dotimes [i 10] (do (clj-kondo/run! {:lint ["src"]})))
nil
user=> (dotimes [i 10] (do (clj-kondo/run! {:lint ["src"]})))
nil
user=> (dotimes [i 10] (do (clj-kondo/run! {:lint ["src"]})))
user=> (dotimes [i 10] (do (clj-kondo/run! {:lint ["src"]})))
Execution error (OutOfMemoryError) at (REPL:1).
Java heap space
I already suspected it had to do with memoize since that's the only place where things are stored in a global atoms and then I saw with VisualVM that there were sci things in memory after a GC... which was weird. Then I discovered I was also using memoize in the hooks namespace and effectively holding on to all the state forever by memoizing over a ctx argument... https://github.com/borkdude/clj-kondo/issues/1036