This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-08-07
Channels
- # babashka (10)
- # biff (3)
- # cider (37)
- # cljsrn (2)
- # clojure (97)
- # clojure-europe (64)
- # clojure-norway (18)
- # clojure-uk (3)
- # clojurescript (24)
- # datalevin (16)
- # datomic (8)
- # events (2)
- # fulcro (17)
- # graalvm (11)
- # humbleui (44)
- # hyperfiddle (25)
- # london-clojurians (1)
- # malli (16)
- # pedestal (2)
- # portal (1)
- # reitit (4)
- # releases (1)
- # ring (3)
- # shadow-cljs (9)
- # squint (2)
I'm having some extremely weird problem in one project that I've never seen before.
So in one file if I run the same test with cider-test-run-test
multiple times, sometimes it takes up to a minute and most times it takes less than a second.
Now this happens even with a stupid test and after disabling all the fixtures (which I thought were the problem)
`
(deftest check-speed
(testing "hello"
(is (= 1 0))))
When I enabled the fixtures and added some logging I would still see that it simply wasn't even getting there for the first 30 seconds, so I really don't get wtf is going here.
I tried to profile Emacs itself as well in case somehow it's the thing locking, and this is a sample output from the profiler, but I don't think it's that either.
17,708,184 65% + redisplay_internal (C function)
4,839,610 17% + command-execute
3,212,640 11% + timer-event-handler
1,369,590 5% + nrepl-client-filter
39,961 0% + #<compiled -0x9c8d5a8487f65e>
4,144 0% + jit-lock--antiblink-post-command
1,848 0% + lsp--post-command
1,544 0% + flycheck-display-error-at-point-soon
240 0% + flycheck-error-list-highlight-errors
72 0% + lsp-ui-sideline
0 0% ...
it just looks like for whatever reason, in that scenario it just sometimes hangs for a while before doing anything
never seen an issue like that before
I guess one thing about this project that's maybe different from all the rest is that it's using schema.core
for defining many functions, with
(s/defn
but I also tried to disable the (s/set-fn-validation! false)
the validation with that and I think it's the same
if you view top
/`htop` do you see your CPU or RAM spike when you get these hangs? You would, I suppose, possibly expect to see a Java process skyrocket on one of those
I can check, but the interesting thing is that I also tried to attach visualvm to the process
but it just broke the repl
so I could not get much out of it, maybe I can try with a different jvm version
of course now that I opened btop it stopped happening entirely
wtf. 😄
we love heisenbugs ❤️
I don't think there are any cpu spikes
and the other intersting thing is that every time according to cider the tests still only take 40ms
so whatever is hanging doesn't end up in the total time
other interesting thing is that it happened with both cider-test-run-test and kaocha
but only when I run the single test, not all of them
hmm, i assume if you run the tests from the cli you don't encounter any hitching then? (which would imply it is just a cider/emacs thing)
yeah it looks fine when I run all the tests from the cli
I'd run cider-nrepl from the CLI and hit Ctrl+\
(print thread dump) whenever it happens again, that will tell us what the JVM part of cider is doing at that point in time
other options that don't need to start the process from the cli (for the Ctrl+\
) is to run jstack PID
or jcmd PID Thread.print
they are all the same thing

Nice thanks yeah very weird, in the evening I could make it happen very often
And it doesn't get stuck for long enough to be able to do other things, but I'll try again tomorrow
I even wondered if it was related to the rest of the code in that particular file since commenting all the other tests out seemed to have helped, which seems crazy
But another colleague noticed the same thing so I'm not the only one
There is definitely something weird going on
> other interesting thing is that it happened with both cider-test-run-test and kaocha I missed this. If it's happening on kaocha from the cli without cider-nrepl activated or in the classpath, that should guide to a different direction But if it's cider-nrepl, a GH issue is most welcome
Well I run kaocha from emacs with the kaocha runner, which I think uses cider nrepl
Running from the cli is tricky since it takes forever to start (and it's Leiningen so ever slower)
> Well I run kaocha from emacs with the kaocha runner, which I think uses cider nrepl Yep. But at that point it's a bare nrepl eval request, most likely no cider-nrepl involved for practical cases > Running from the cli is tricky since it takes forever to start (and it's Leiningen so ever slower) Maybe run it in a timed manner 100 times while you sleep
Hehe could try
I was trying to run the test after jacking in from an external process actually but that doesn't work at all
the repl works fine but cider-test-run-test doesn't, not sure if that's normal since I never really do it that way
Sounds like the cider-nrepl middleware isn't there https://docs.cider.mx/cider/basics/middleware_setup.html
ah yeah it's not in the dependencies