Fork me on GitHub
#cider
<
2021-02-17
>
rickmoynihan09:02:26

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

rickmoynihan09:02:15

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

rickmoynihan09:02:22

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

rickmoynihan09:02:30

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

rickmoynihan09:02:33

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

kaffein11:02:41

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")
  re-search-forward(":dependencies")
  cljr--insert-into-leiningen-dependencies("mount" "0.1.16")
  cljr--add-project-dependency("mount" "0.1.16")
  cljr-add-project-dependency(nil)
  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))
  [email protected]+-record-current-command(#<subr call-interactively> cljr-add-project-dependency nil nil)
  apply([email protected]+-record-current-command #<subr call-interactively> (cljr-add-project-dependency nil nil))
  call-interactively(cljr-add-project-dependency nil nil)
  command-execute(cljr-add-project-dependency)

kaffein11:02:43

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
            (back-to-indentation)
          (paredit-backward-down))
        (cljr-hotload-dependency)))))

bozhidar11:02:04

@rickmoynihan If this started happening recently, it might be related to the fixes we've tried for https://github.com/clojure-emacs/orchard/issues/103

bozhidar11:02:53

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

rickmoynihan11:02:55

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

bozhidar11:02:16

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

bozhidar11:02:48

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

bozhidar11:02:18

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

rickmoynihan11:02:41

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

witek12:02:53

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?

bozhidar15:02:42

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

bozhidar15:02:39

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.

👍 1
bozhidar15:02:52

(as it saves you the extra movement)

enn16:02:37

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.

dpsutton16:02:36

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

enn16:02:11

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

dpsutton16:02:13

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)

dpsutton16:02:29

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

dpsutton16:02:35

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

bozhidar16:02:18

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.

dpsutton16:02:59

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

dpsutton16:02:10

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

dpsutton16:02:19

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

enn16:02:55

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.

dpsutton16:02:24

yeah that's really about a hanging process

dpsutton16:02:35

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.

enn19:02:40

profiling output in thread

enn19:02:07

- 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%

enn19:02:23

don’t really see any smoking gun here

dpsutton19:02:27

did you run this report after the 45 second freeze?

dpsutton19:02:35

maybe run it during the 45 second freeze?

enn21:02:42

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

FiVo22:02:10

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