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

ansi namespace attempts to require nrepl.core, causes exceptions in some cases #93

Closed
ptaoussanis opened this issue Jun 22, 2023 · 4 comments · Fixed by #95
Closed

ansi namespace attempts to require nrepl.core, causes exceptions in some cases #93

ptaoussanis opened this issue Jun 22, 2023 · 4 comments · Fixed by #95
Assignees
Labels
Milestone

Comments

@ptaoussanis
Copy link

@hlship Hi Howard, thanks for all your work on Pretty!

I have an issue to report, involving an apparent interaction between recent versions of Pretty, and cider-nrepl.

Quick info:

  • I author a library called Timbre, which includes Pretty as a dependency.
  • A Timbre user reported a strange error that had appeared after a Timbre update.
  • On further digging, I managed to create a minimal reproducible showing that the issue actually seems to have been triggered by the update of Pretty from version 1.1.1 to 1.3.
  • The reproducible reliably shows the issue on my system with [io.aviso/pretty "1.3"] and [io.aviso/pretty "1.4.4"], but not with [io.aviso/pretty "1.1.1"].
  • The reproducible includes only Pretty and cider-nrepl, nothing else - so it looks like this might be a problem either with Pretty, or that Pretty is triggering an issue with cider-nrepl.

Instructions to reproduce

  1. Clone the minimum reproducible project.
  2. Run lein repl
  3. Try to evaluate (require '[beholder.handlers] :reload-all)

On my system this reliably generates the following error:

Exception updating the ns-cache #error {
 :cause No implementation of method: :send of protocol: #'nrepl.transport/Transport found for class: nrepl.middleware.caught$caught_transport$reify__1208
 :via
 [{:type java.lang.IllegalArgumentException
   :message No implementation of method: :send of protocol: #'nrepl.transport/Transport found for class: nrepl.middleware.caught$caught_transport$reify__1208
   :at [clojure.core$_cache_protocol_fn invokeStatic core_deftype.clj 584]}]
 :trace
 [[clojure.core$_cache_protocol_fn invokeStatic core_deftype.clj 584]
  [clojure.core$_cache_protocol_fn invoke core_deftype.clj 576]
  [nrepl.transport$eval7719$fn__7737$G__7710__7744 invoke transport.clj 23]
  [clojure.lang.Var invoke Var.java 388]
  [cider.nrepl.middleware.track_state$update_and_send_cache$fn__4360 invoke track_state.clj 213]
  [cider.nrepl.middleware.track_state$update_and_send_cache invokeStatic track_state.clj 209]
  [cider.nrepl.middleware.track_state$update_and_send_cache invoke track_state.clj 159]
  [cider.nrepl.middleware.track_state$update_and_send_cache invokeStatic track_state.clj 181]
  [cider.nrepl.middleware.track_state$update_and_send_cache invoke track_state.clj 159]
  [clojure.lang.AFn applyToHelper AFn.java 156]
  [clojure.lang.AFn applyTo AFn.java 144]
  [clojure.core$apply invokeStatic core.clj 669]
  [clojure.core$update_in$up__6922 invoke core.clj 6220]
  [clojure.core$update_in invokeStatic core.clj 6221]
  [clojure.core$update_in doInvoke core.clj 6207]
  [clojure.lang.RestFn applyTo RestFn.java 146]
  [clojure.core$apply invokeStatic core.clj 673]
  [clojure.core$binding_conveyor_fn$fn__5823 doInvoke core.clj 2058]
  [clojure.lang.RestFn applyTo RestFn.java 146]
  [clojure.lang.Agent$Action doRun Agent.java 114]
  [clojure.lang.Agent$Action run Agent.java 163]
  [java.util.concurrent.ThreadPoolExecutor runWorker ThreadPoolExecutor.java 1144]
  [java.util.concurrent.ThreadPoolExecutor$Worker run ThreadPoolExecutor.java 642]
  [java.lang.Thread run Thread.java 1589]]}

Do you have any ideas what might have changed since 1.1.1 to cause this?
I couldn't find any related open or closed issues.

Thanks for any assistance! Cheers :-)

@hlship
Copy link
Collaborator

hlship commented Jun 22, 2023

This is almost certainly related to the code in the ansi namespace that attempts to determine whether to enable colors or not; it checks to see if namespace nrepl.core is present.

@hlship hlship self-assigned this Jun 22, 2023
ptaoussanis added a commit to taoensso/timbre that referenced this issue Jun 30, 2023
There's currently an upstream issue with new Pretty versions,
Ref. clj-commons/pretty#93

Until the issue can be fixed, Timbre will switch back to the
last known-working version of Pretty.
ptaoussanis added a commit to taoensso/timbre that referenced this issue Jun 30, 2023
There's currently an upstream issue with new Pretty versions,
Ref. clj-commons/pretty#93

Until the issue can be fixed, Timbre will switch back to the
last known-working version of Pretty.
@hlship hlship added this to the 2.1 milestone Jul 14, 2023
@hlship hlship added the bug label Jul 14, 2023
hlship added a commit that referenced this issue Jul 20, 2023
@hlship
Copy link
Collaborator

hlship commented Jul 20, 2023

Looking into this now; I've wired up your sample project to the org.clj-commons/pretty source and can reproduce your error. When I comment out the (is-ns-available? 'nrepl.core) part, it works fine.

@hlship
Copy link
Collaborator

hlship commented Jul 20, 2023

Using Namespace/find instead of require seems to work.

@hlship hlship changed the title Apparent issue with latest pretty & cider-nrepl, minimal repro included ansi namespace attempts to require nrepl.core, causes exceptions in some cases Jul 20, 2023
@ptaoussanis
Copy link
Author

That's great news Howard, thanks so much for your help on this - and your work on Pretty in general!

Cheers :-)

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

Successfully merging a pull request may close this issue.

2 participants