Fork me on GitHub
#cider
<
2023-11-06
>
Charles Comstock17:11:44

@vemv What do you think about enabling cljr-slash-uses-suggest-libspec for clj-refactor by default now? I know https://github.com/clojure-emacs/clj-refactor.el/issues/530 hasn't been fixed, but the primary use case of detecting the project :as aliases and suggesting them works much better with suggest-libspec, so it would be nice to transition folks over to that method. I know there was some discussion about moving cljr-slash into cider, but it still seems like we can move forward in cljr before transitioning it to cider.

vemv17:11:41

Let me check but likely yes, I've been happy with the refactored feature over clj/s :)

Charles Comstock17:11:48

Awesome, glad to hear it. Let me know if we have more steps there.

phronmophobic18:11:57

I'm running into an issue where when I try to hit tab tab for completions, my CPU spikes for a while until I get a OOM exception (See attached stacktrace). I'd be happy to follow up with a github issue or more info. More info in 🧵 .

phronmophobic18:11:10

I'm running emacs via ssh on a pretty dinky server 1G RAM and 1VCPU.

phronmophobic18:11:37

It's possible that I also have some large jars on the classpath from including binaries resources.

phronmophobic18:11:43

versions:

;; CIDER 1.10.0 (Sant Cugat), nREPL 1.0.0                                                                                                                       
;; Clojure 1.11.1, Java 18.0.2-ea   
Ubuntu linux

phronmophobic18:11:41

I've had this issue for a while, but I thought it was because I was running old versions. However, I just ran into issue again with the same project on a fresh setup.

oyakushev19:11:19

Yikes, certainly shouldn't happen. Are all of that dependencies public, or is there some private stuff?

phronmophobic19:11:39

Most of it's public

oyakushev19:11:09

If you just paste the public part of the dependencies, I'll take a look what's going on

phronmophobic19:11:35

everything there should be public except com.phronemophobic.discord {:local/root "../discord"}

oyakushev19:11:33

Cool, I'm in the middle of refactoring Compliment, so this is very apposite

phronmophobic19:11:56

Actually, let me try and reproduce without that dep.

vemv19:11:44

Truth be told, a large category of Clojure programs are subject to fail with just 1GB RAM knowing Alex, I'd bet that this will be fixed, but in general limited official support can be expected from CIDER under constrained resources

phronmophobic19:11:31

Everything else works fine. I also added 4G of swap which isn't great for performance, but it doesn't need to do anything quickly.

vemv19:11:52

...A good example being clj-kondo, if you want to analyze the whole classpath it can take 4GB with no possible workaround. I'm fine with that.

oyakushev19:11:24

Oooh, I overlooked the 1Gb part. Still, this should certainly be enough for Compliment, I bet there is a bug somewhere and this is not a natural limit

👍 1
phronmophobic19:11:01

Yea, completely turning it off is an acceptable workaround for me.

phronmophobic19:11:22

It's just my muscle memory hoses the server 😛.

phronmophobic19:11:46

Anyway, just thought I'd make a report since it seems reproducable.

❤️ 1
🙌 1
phronmophobic19:11:10

Ok, so I was able to reproduce without the private dependency.

🔥 1
oyakushev19:11:29

Any particular prefix that you try to trigger the completion with?

phronmophobic19:11:33

there's an example in the error log, but it's usually when I'm in slackcommands.util and trying to call save-large-png

phronmophobic19:11:42

so something like save-l

oyakushev19:11:49

Hm, could not reproduce right away with my default heap sizing, let me try downsize it

oyakushev19:11:29

Hm, works fine on my machine with Xmx1g. Could you check if it still reproduces if you e.g. clear the target directory? I see it isnt' listed in paths so it shouldn't matter but who knows 🤷

phronmophobic19:11:18

the target directory?

phronmophobic19:11:28

I don't think there is one.

oyakushev19:11:53

There is indeed a good amount of classes on the classpath (100k+) but it goes through without a hitch on my laptop

oyakushev19:11:00

Could you please try this instead of hitting Tab?

(require '[cider.nrepl.inlined.deps.compliment.v0v4v4.compliment.utils :as cutils])

(count (cutils/namespaces&files-on-classpath))

👍 1
oyakushev19:11:39

But it finished, that's interesting

oyakushev19:11:43

What if you trigger completion now?

phronmophobic19:11:56

ok, now it's working

phronmophobic19:11:17

let me double check it

vemv19:11:29

I wonder if it's a classic concat / mem problem

oyakushev19:11:11

I thought of concat as well. Gonna remove each and every of those for sure

🙀 1
oyakushev19:11:29

However, concat was more about stackoverflow I think

phronmophobic19:11:39

oh, ok. just calling that code doesn't fix it. I think I just realized the problem.

phronmophobic19:11:35

When I want a completion, I mash a combination of tab and ESC+TAB several times. 😆

💡 1
phronmophobic19:11:48

Which I think overloads it.

phronmophobic19:11:00

oh weird. at some point it caches the response and it works fine again?

oyakushev19:11:40

It does cache the list of all files/classes/namespaces

oyakushev19:11:32

Still weird that you run into this because it flies almost instantly. But that's on a decent machine

oyakushev19:11:53

In a setup like yours, I can imagine it being slower so that you can squeeze in multiple invocations of that stuff

oyakushev19:11:56

Guess I gonna protect those fat one-time calls with a mutex just in case.

phronmophobic19:11:38

I was able to reproduce the OOM with the following steps: • open slackcommands.util • cider-jack-inC-c M-n M-n (cider-repl-set-ns NS) • C-c C-k cider-load-buffer • switch to cider terminal • type save- • tap ESC+TAB 3 times, then immediately TAB 3 times

phronmophobic19:11:53

mashing the different forms of tab is just muscle memory :man-facepalming:

oyakushev19:11:59

Would you try this for me? 🙂

(require '[cider.nrepl.inlined.deps.compliment.v0v4v4.compliment.utils :as cutils])

(dotimes [_ 100]
  (.start (Thread. #(println (count (cutils/classes-on-classpath))))))

👍 1
phronmophobic19:11:06

I didn't include it in the error log, but I also end up with several messages in the cider log:

ERROR: Unhandled REPL handler exception processing message {:op complete, :ns slackcommands.util, :prefix save-la, :context :same, :enhanced-cljs-completion? t, :session 3f3f37d6-2df9-4b11-868b-98810d8eda29, :id 85}

oyakushev19:11:15

Great, it hung up on me as well, finally!

phronmophobic19:11:33

Ok, running the above snippet. The CPU is pegged and OOM exceptions are being printed sporadically.

👍 1
oyakushev19:11:40

Now I have something to work with. Thanks for the help!

phronmophobic19:11:30

Thanks for the quick response! Glad my impatient mashing is good for something.

😁 1
1
1
cat-on-keyboard 1
phronmophobic19:02:59

Just curious if this issue was ever addressed. It's not critical, but it would be helpful. gratitude

vemv19:02:10

From memory, @U06PNK4HG fixed this and it made it into cider-nrepl latest as bundled with cider.el latest stable

🙏 1
phronmophobic19:02:58

cool. I'll try it out!

oyakushev20:02:22

Indeed, this should no longer happen with the latest CIDER.

phronmophobic20:02:13

awesome! looking forward to trying it out!

❤️ 1
phronmophobic22:02:14

Seems to be working! Thanks again! 🎉 gratitude

❤️ 2