Fork me on GitHub

Has anyone seen an error like this before in the nrepl middleware? Not entirely sure what causes it - but I think it happens when there’s an exception and cider tries to print it


Trigger by evaling (throw (ex-info "foo" {}))


hmm looks like it might be a subtle env issue with jdk’s and JAVA_HOME etc… 👀


yeah ok that seems to have fixed it… JAVA_HOME was pointing to the system java rather than the one I was using… slight jabba misconfiguration


hmm odd I’ve just seen the exception again… looks like this hasn’t fixed it after all :thinking_face:


hey guys, has any of you experienced a weird behaviour while using clj-refactor where cider seems to be resolving to the wrong project type ? I have a deps.edn-based project and it is supposed to handle refactoring commands pertaining to that particular type of project. Though when launching an add-project-dependency for e.g it tells me that it tried to lookup for a :dependencies key which means that somehow it considers the project as a leiningen-based one.

Debugger entered--Lisp error: (search-failed ":dependencies")
  cljr--insert-into-leiningen-dependencies("mount" "0.1.16")
  cljr--add-project-dependency("mount" "0.1.16")
  funcall-interactively(cljr-add-project-dependency nil)
  #<subr call-interactively>(cljr-add-project-dependency nil nil)
  apply(#<subr call-interactively> cljr-add-project-dependency (nil nil))
  (let ((ido-cr+-current-command command)) (apply orig-fun command args))
  call-interactively@ido-cr+-record-current-command(#<subr call-interactively> cljr-add-project-dependency nil nil)
  apply(call-interactively@ido-cr+-record-current-command #<subr call-interactively> (cljr-add-project-dependency nil nil))
  call-interactively(cljr-add-project-dependency nil nil)


nevermind, I debugged it using edebug and figured out that it was because I had a pom.xml inside the project (which was generated by clj-new)

(defun cljr--add-project-dependency (artifact version)
  (let* ((project-file (cljr--project-file))
         (deps (cljr--project-with-deps-p project-file)))
    (cljr--update-file project-file
      (goto-char (point-min))
      (if deps ;; SO WHEN deps IS nil 
          (cljr--insert-into-clj-dependencies artifact version)
        (cljr--insert-into-leiningen-dependencies artifact version)) ;; clj-refactor CONSIDERS THE PROJECT AS A lein-based ONE
      (cljr--post-command-message "Added %s version %s as a project dependency" artifact version)
      (when cljr-hotload-dependencies
        (if deps


@rickmoynihan If this started happening recently, it might be related to the fixes we've tried for


I'm assuming that something might be missing in your JDK 8 installation. Probably you won't get the error with JDK 11.


@bozhidar yeah I think it’s happened recently since I updated


Mention your issue in the ticket, so Jeff's aware of this.


The Java integration is one of the most frustrating things in CIDER, as things there constantly break...


Now I miss the days where each JDK took 5 years to ship. 😄


Ok, interesting… I could possibly use jdk11, though it’ll mean I need to use two jdks for different services


Hello. I am missing a CIDER command: cider-toggle-ignore-next-form. It should either place or remove #_ at current cursor position. What is the honorable thing to do? Just put it in my custom config? Pull-Request to the Spacemacs configuration layer? Pull-Request to CIDER?


@witek It should like something that should be in clojure-mode, as it doesn't require a REPL to work.


I'm just wondering that's the value of adding a command that adds or delete two characters at point. Probably that'd be more useful if it was applied to the preceding or containing form.

👍 3

(as it saves you the extra movement)


Any tips for troubleshooting a slow cider-connect? The ;; Connected to nREPL server - ... comment appears immediately, but it takes about 45 seconds for the user> to appear. I’m using cider-nrepl 0.25.9 and the CIDER snapshot on Emacs 27.1. I start the server with lein repl.


first guess, its the state tracker populating the emacs side with all the known namespaces and vars


@dpsutton that makes sense--this is a large project. Is there any way to pre-calculate this (something we could do in our build)?


my suspicion is its not the calculation of it but just sending to emacs, parsing, and storing in memory. so no good solution off hand that i can think of (if this is even the problem anyways)


i think you can turn this off and you'll just lose a bit of syntax highlighting


wow. i'm not actually seeing a way to not subscribe to this information


Yeah, you can't. It should probably be configurable, but it's not as even basic things like the connection type are handled by it.


yeah. i imagine the connection type always stays in there. just not the huge map of dictionaries of nses


i remember someone having an issue with millions of keywords or something like that


surprised one result of that wasn't to turn off the tracking


I tried enabling debug on quit and hitting C-g during the wait, as the troubleshooting guide that @bozhidar linked to suggests, but I don’t get any backtrace or any other information. so I’m not sure how to confirm your hypothesis. for a given REPL process, if I disconnect and then reconnect, the second connection is instantaneous.


yeah that's really about a hanging process


start profiling, cider connect, wait until it unfreezes and run profiler-report. note do not run profiler-stop. you'd think you start, stop, see results. but you can only see results of actively running profilers.


profiling output in thread


- command-execute                                           9,655,949  73%
 - call-interactively                                       9,655,949  73%
  - funcall-interactively                                   9,655,949  73%
   - counsel-M-x                                            9,655,949  73%
    - ivy-read                                              9,355,822  70%
     - ivy-call                                             7,208,547  54%
      - counsel-M-x-action                                  7,208,547  54%
       - command-execute                                    7,208,547  54%
        - call-interactively                                7,208,547  54%
         - funcall-interactively                            7,208,515  54%
          - cider-connect                                   3,652,581  27%
           - cider--update-host-port                        2,435,135  18%
            - cider-select-endpoint                         2,435,135  18%
             - cider--ssh-hosts                             1,562,797  11%
              + eval                                        1,542,325  11%
              + seq-map                                        17,400   0%
              + version<                                        3,072   0%
             + cider--completing-read-port                    373,606   2%
             + cider--completing-read-host                    237,411   1%
             + cider--infer-ports                             235,481   1%
             + seq-uniq                                        24,816   0%
               split-string                                     1,024   0%
           - cider-nrepl-connect                            1,208,190   9%
            - nrepl-start-client-process                    1,208,190   9%
             + run-hooks                                      651,591   4%
             + #<compiled 0x1feb8b26da11>                     477,204   3%
             + nrepl--init-capabilities                        45,358   0%
             + nrepl--init-client-sessions                     18,584   0%
             + nrepl-connect                                    7,181   0%
           + cider--update-project-dir                          5,120   0%
           - cider--check-existing-session                      4,136   0%
            + sesman-current-sessions                           4,136   0%
          + profiler-report                                 3,555,279  26%
            profiler-start                                        655   0%
     + read-from-minibuffer                                 1,657,843  12%
     + ivy--reset-state                                       356,434   2%
     + ivy--update-prompt                                       3,104   0%
     + #<compiled 0x1feb870c8e1d>                               1,056   0%
    + counsel--M-x-externs                                    300,127   2%
+ timer-event-handler                                       1,626,289  12%
+ nrepl-client-filter                                         833,280   6%
+ redisplay_internal (C function)                             786,459   5%
+ ucs-normalize-hfs-nfd-pre-write-conversion                  115,835   0%
+ linum-update-current                                         75,598   0%
+ ...                                                          45,360   0%
+ ucs-normalize-hfs-nfd-post-read-conversion                   41,344   0%
+ eldoc-schedule-timer                                            584   0%


don’t really see any smoking gun here


did you run this report after the 45 second freeze?


maybe run it during the 45 second freeze?


I ran the report after (but it was profiling the whole time). I will try running the report during.


Is there a way to run some snippet just after jack in? Similar to cider-custom-cljs-repl-init-form but just for clj.