Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(error "Cyclic keymap inheritance") on cider-test-run-test #3195

Closed
rrudakov opened this issue May 3, 2022 · 27 comments
Closed

(error "Cyclic keymap inheritance") on cider-test-run-test #3195

rrudakov opened this issue May 3, 2022 · 27 comments

Comments

@rrudakov
Copy link
Contributor

rrudakov commented May 3, 2022

Expected behavior

No emacs errors after running cider-test-run-test or any other cider-test-* funciton.

Actual behavior

Debugger entered--Lisp error: (error "Cyclic keymap inheritance")
  cider-test-report-mode()
  cider-test-render-report("*cider-test-report*" (dict "error" 0 "fail" 0 "ns" 1 "pass" 1 "test" 1 "var" 1) (dict "core-test" (dict "simple-test" ((dict "context" nil "index" 0 "message" "" "ns" "core-test" "type" "pass" "var" "simple-test")))))
  #f(compiled-function (response) #<bytecode 0xdc993a82ffbcc89>)((dict "gen-input" nil "id" "33" "results" (dict "core-test" (dict "simple-test" ((dict "context" nil "index" 0 "message" "" "ns" "core-test" "type" "pass" "var" "simple-test")))) "session" "5c50f48b-7e2b-4566-bbe4-3d90fbfb4aca" "summary" (dict "error" 0 "fail" 0 "ns" 1 "pass" 1 "test" 1 "var" 1) "testing-ns" "core-test"))
  nrepl--dispatch-response((dict "gen-input" nil "id" "33" "results" (dict "core-test" (dict "simple-test" ((dict "context" nil "index" 0 "message" "" "ns" "core-test" "type" "pass" "var" "simple-test")))) "session" "5c50f48b-7e2b-4566-bbe4-3d90fbfb4aca" "summary" (dict "error" 0 "fail" 0 "ns" 1 "pass" 1 "test" 1 "var" 1) "testing-ns" "core-test"))
  nrepl-client-filter(#<process nrepl-connection<1>> "d9:gen-inputle2:id2:337:resultsd9:core-testd11:sim...")

Steps to reproduce the problem

  1. Create a simple test project with failing test:
;; deps.edn
{:paths ["test"]}
;; ./test/core-test.clj
(ns core-test
  (:require [clojure.test :refer [deftest is]]))

(deftest simple-test
  (is (= 5 (* 2 2))))
  1. Run the test using C-c C-t C-t or cider-test-run-test
  2. Test fails, dismiss test report window by pressing q
  3. Fix the test
(ns core-test
  (:require [clojure.test :refer [deftest is]]))

(deftest simple-test
  (is (= 4 (* 2 2))))
  1. Run the test again.

Environment & Version information

CIDER version information

;; Connected to nREPL server - nrepl://localhost:62907
;; CIDER 1.4.0 (Kyiv), nREPL 0.9.0
;; Clojure 1.11.1, Java 18
;;     Docs: (doc function-name)
;;           (find-doc part-of-name)
;;   Source: (source function-name)
;;  Javadoc: (javadoc java-object-or-class)
;;     Exit: <C-c C-q>
;;  Results: Stored in vars *1, *2, *3, an exception in *e;
;;  Startup: /usr/local/bin/clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version "0.9.0"} cider/cider-nrepl {:mvn/version "0.28.3"} refactor-nrepl/refactor-nrepl {:mvn/version "3.5.2"}} :aliases {:cider/nrepl {:main-opts ["-m" "nrepl.cmdline" "--middleware" "[refactor-nrepl.middleware/wrap-refactor,cider.nrepl/cider-middleware]"]}}}' -M:cider/nrepl

Emacs version

GNU Emacs 28.1 (build 2, x86_64-apple-darwin21.4.0, NS appkit-2113.40 Version 12.3.1 (Build 21E258)) of 2022-04-28

Operating system

macOS 12.3.1 (21E258)

@bitti
Copy link

bitti commented May 4, 2022

Same for me (I don't even have to had a failing test beforhand though). Same macOS version but a newer emacs version:

GNU Emacs 29.0.50 (build 1, x86_64-apple-darwin21.3.0, NS appkit-2113.30 Version 12.2.1 (Build 21D62)) of 2022-02-25

Only other difference is that I use Java 11 instead of 18:

;; Connected to nREPL server - nrepl://localhost:49420
;; CIDER 1.4.0 (Kyiv), nREPL 0.9.0
;; Clojure 1.11.1, Java 11.0.11
;;     Docs: (doc function-name)
;;           (find-doc part-of-name)
;;   Source: (source function-name)
;;  Javadoc: (javadoc java-object-or-class)
;;     Exit: <C-c C-q>
;;  Results: Stored in vars *1, *2, *3, an exception in *e;
;;  Startup: /usr/local/bin/lein update-in :dependencies conj \[nrepl/nrepl\ \"0.9.0\"\] -- update-in :dependencies conj \[refactor-nrepl/refactor-nrepl\ \"3.5.2\"\] -- update-in :plugins conj \[refactor-nrepl/refactor-nrepl\ \"3.5.2\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.28.3\"\] -- repl :headless :host localhost

@vemv
Copy link
Member

vemv commented May 4, 2022

9cac658 seems related? @yuhan0

Anyone reading this: you can try "reverting" that commit by hand, quit Emacs, remove any byte-compiled .elc files that may be present, and try again.

@yuhan0
Copy link
Contributor

yuhan0 commented May 4, 2022

That's very strange.. I don't see how there could be any problem with keymap inheritance here and I've been using this commit since 2020 without any issues.
Maybe something to do with stale elc files from before the update?

@rrudakov
Copy link
Contributor Author

rrudakov commented May 4, 2022

Anyone reading this: you can try "reverting" that commit by hand, quit Emacs, remove any byte-compiled .elc files that may be present, and try again.

Just have tried and it fixed the problem for me.

P. S: Also I've tried to remove .elc files without reverting commit and it didn't help.

@DerGuteMoritz
Copy link
Contributor

Maybe something to do with stale elc files from before the update?

FWIW: I've installed the update via vanilla package.el and I only see ~/.emacs.d/elpa/cider-1.4.0 now with only fresh .elc files. I also restarted Emacs after the update.

@yuhan0
Copy link
Contributor

yuhan0 commented May 4, 2022

The only other thing I can think of is some interaction with an external package like evil-collection or Spacemacs' keybinding system
https://github.com/syl20bnr/spacemacs/blob/c6c17748f649236e5c4afab6a0cabb97f0806bf9/layers/%2Blang/clojure/packages.el#L279

I can't reproduce it on my end, either on a bare emacs -Q or my full setup (Doom Emacs).
But it sounds like it's functionality-breaking enough for little gain that maybe we should just revert the commit?

@filip-gomore
Copy link

filip-gomore commented May 4, 2022

I have the same issue and I do use evil-collection.

GNU Emacs 28.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2022-04-06

Edit: Add Emacs version

@rrudakov
Copy link
Contributor Author

rrudakov commented May 4, 2022

I use vanilla emacs without evil.

yuhan0 added a commit to yuhan0/cider that referenced this issue May 4, 2022
This reverts commit 9cac658.

The change resulted in "Cyclic keymap inheritance" errors for some
users, see clojure-emacs#3195,
@DerGuteMoritz
Copy link
Contributor

Vanilla Emacs without evil here, too.

GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0)

@yuhan0 Are you on a version >= 28.1 already? Note that all reported Emacs versions so far are in that range.

@yuhan0
Copy link
Contributor

yuhan0 commented May 4, 2022

Oh... that could be it

GNU Emacs 28.0.91 (build 1, aarch64-apple-darwin21.3.0, NS appkit-2113.30 Version 12.2.1 (Build 21D62)) of 2022-03-10

@chrishowejones
Copy link

I am getting the same issue. I use vanilla emacs and I'm on version 27.2 (Emacs version)

chrishowejones added a commit to chrishowejones/otfrom-org-emacs that referenced this issue May 6, 2022
@bbatsov
Copy link
Member

bbatsov commented May 6, 2022

@chrishowejones Doesn't removing the byte-compiled code fix the issue?

@vemv
Copy link
Member

vemv commented May 7, 2022

@bbatsov: see #3195 (comment), from his input it doesn't look like it's the case

@bbatsov
Copy link
Member

bbatsov commented May 7, 2022

OK, I guess I'll merge the patch that reverses this. Still, I'm puzzled that it seems the bug affected relatively few people, so there must be something we're missing in our analysis of it.

bbatsov pushed a commit that referenced this issue May 7, 2022
This reverts commit 9cac658.

The change resulted in "Cyclic keymap inheritance" errors for some
users, see #3195,
@bbatsov bbatsov closed this as completed May 7, 2022
@chrishowejones
Copy link

@bbatsov sorry it took a while to get back to you Bug but removing the .elc files made no difference to me. So I think your workaround of the patch is probably warranted. When I apply the 'revert' of that commit manually the problem doesn't manifest. Without that patch, I can consistently replicate the issue by getting any test to fail and then fixing it so I too am puzzled as to why it's affecting relatively few. Maybe an interaction with some other mode or submode I have active in my setup?

@DerGuteMoritz
Copy link
Contributor

DerGuteMoritz commented May 9, 2022

Searching for other instances of this error, I came across the following two:

millejoh/emacs-ipython-notebook#181
ljos/sparql-mode#46

IIUIC in both cases the fix was to prevent redundant activations of the same mode? Maybe you can make more sense from this @bbatsov or @yuhan0?

@arichiardi
Copy link
Contributor

Just one more instance of this error here - happens after removing byte code as well. It seems like the key binding is working for a while and then starts throwing the above error.

Thanks for reverting the commit.

@jwr
Copy link

jwr commented May 10, 2022

Just for the record, this problem affected me as well.

@lgrapenthin
Copy link

It affected me as well.

@niquola
Copy link

niquola commented May 19, 2022

same problem

@jonpither
Copy link
Contributor

Same :-)

@niquola
Copy link

niquola commented May 19, 2022

@niquola
Copy link

niquola commented May 19, 2022

That was a problem - 3907351 - your revert make it work property. As well fix other issues like jumping to failed test.

@bbatsov
Copy link
Member

bbatsov commented May 19, 2022

The problematic change has been reverted upstream and soon there will be a 1.4.1 release with a few bugfixes.

@john-conti
Copy link

Me too. Vanilla 28.1

@vemv
Copy link
Member

vemv commented May 26, 2022

Fix available in https://github.com/clojure-emacs/cider/blob/v1.4.1/CHANGELOG.md#141-2022-05-25

@john-conti
Copy link

WFM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests