bhauman / devcards

Devcards aims to provide a visual REPL experience for ClojureScript
1.53k stars 116 forks source link

java.lang.IllegalArgumentException when calling cljs.repl/doc (devcards 0.2.2) #118

Closed skynx closed 7 years ago

skynx commented 7 years ago

EDIT: Using Chrome on Ubuntu 16.04; not happening on OSX. Tried clojure 1.8.0 and 1.9.0-alpha14, clojurescript 1.9.226 and 1.9.456, devcards 0.2.1-7 and 0.2.2.

Using a fresh devcards project (made with lein new devcards), but switching the devcards dependency to current version "0.2.2", I get the following exception when trying to read a docstring from the REPL:

cljs.user> (doc doc)
nil
Exception in thread "async-dispatch-8" 
java.lang.IllegalArgumentException: No value supplied for key: -------------------------
cljs.repl/doc
([name])
Macro
  Prints documentation for a var or special form given its name
    at clojure.lang.PersistentHashMap.create(PersistentHashMap.java:77)
    at figwheel_sidecar.repl.FigwheelEnv$fn__25233$state_machine__21486__auto____25234$fn__25236.invoke(repl.clj:96)
    at figwheel_sidecar.repl.FigwheelEnv$fn__25233$state_machine__21486__auto____25234.invoke(repl.clj:96)
    at clojure.core.async.impl.ioc_macros$run_state_machine.invokeStatic(ioc_macros.clj:1012)
    at clojure.core.async.impl.ioc_macros$run_state_machine.invoke(ioc_macros.clj:1011)
    at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invokeStatic(ioc_macros.clj:1016)
    at clojure.core.async.impl.ioc_macros$run_state_machine_wrapped.invoke(ioc_macros.clj:1014)
    at clojure.core.async.impl.ioc_macros$take_BANG_$fn__21504.invoke(ioc_macros.clj:1025)
    at clojure.core.async.impl.channels.ManyToManyChannel$fn__16457.invoke(channels.clj:135)
    at clojure.lang.AFn.run(AFn.java:22)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

After this, docstrings only print to the browser console and not the REPL.

With devcards 0.2.1-7 (the version in the current devcards leiningen template), I don't encounter this problem. Actually, I am having this problem with 0.2.1-7 as well, but only on Ubuntu. I also tried OSX; doc behaves a little strangely with clojure-1.9.0-alpha14 but doesn't throw -- the weird behaviour goes away when clojurescript-1.9.456 (rather than 1.9.226) is also being used, regardless of devcards version.

bhauman commented 7 years ago

This is interesting and is really subtle.

This is probably more of a figwheel/cljs/core.async issue.

But it's also possible that you are not running lein clean in between runs when you are changing dependencies this could lead to strange behavior where one thing is compiled against one version of core async and now core async is at a different runtime version.

figwheel tries to do this cleaning for you but ...

It does sound like dep conflict of some kind based on its intermittent nature.

skynx commented 7 years ago

I'm guessing now that old compiled .js files were still in the browser cache. Just now, I tried to jack things up on OSX by changing up versions, running lein clean, and not clearing cache. That definitely made things break, but there it was due to some clojurescript-1.9.456 functions being called but not defined in clojurescript-1.9.229. The browser cache was definitely holding on to incompatible files.

So, a false alarm caused by my own failing to clear out the browser cache when updating dependencies. Thanks for pointing me in the right direction.