tolitius / mount

managing Clojure and ClojureScript app state since (reset)
Eclipse Public License 1.0
1.23k stars 89 forks source link

Mount fails to reload with exception #26

Closed sveri closed 8 years ago

sveri commented 8 years ago

The second bug is not easy to understand for me. Also I am not sure if it is mounts fault or not, it would be nice if you could have a look at it.

To reproduce:

  1. clone my example: https://github.com/sveri/mountexample
  2. Run lein figwheel
  3. Run lein repl
  4. Run (start) in the repl
  5. Navigate to http://localhost:3000/example
  6. Open foo.bar.routes.home
  7. Change the println statement in line 19 to print something different
  8. Switch back to browser and reload.

You will see this stacktrace in the repl now:

"<< stopping.. #'foo.bar.components.server/server (namespace was recompiled)" ">> starting.. #'foo.bar.components.server/server (namespace was recompiled)" Wed Dec 23 08:14:35 CET 2015 [worker-1] ERROR - GET /example java.lang.RuntimeException: could not start [#'foo.bar.components.server/server] due to, compiling:(foo/bar/components/server.clj:31:1) at clojure.lang.Compiler.load(Compiler.java:7239) at clojure.lang.RT.loadResourceScript(RT.java:371) at clojure.lang.RT.loadResourceScript(RT.java:362) at clojure.lang.RT.load(RT.java:446) at clojure.lang.RT.load(RT.java:412) at clojure.core$load$fn5448.invoke(core.clj:5866) at clojure.core$load.doInvoke(core.clj:5865) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$load_one.invoke(core.clj:5671) at clojure.core$load_lib$fn5397.invoke(core.clj:5711) at clojure.core$load_lib.doInvoke(core.clj:5710) at clojure.lang.RestFn.applyTo(RestFn.java:142) at clojure.core$apply.invoke(core.clj:632) at clojure.core$load_libs.doInvoke(core.clj:5749) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invoke(core.clj:632) at clojure.core$require.doInvoke(core.clj:5832) at clojure.lang.RestFn.invoke(RestFn.java:421) at ring.middleware.reload$wrap_reload$fn25452.invoke(reload.clj:21) at clojure_miniprofiler$run_handler_profiled$fn__20024.invoke(clojure_miniprofiler.clj:382) at clojure_miniprofiler$run_handler_profiled.invoke(clojure_miniprofiler.clj:382) at clojure_miniprofiler$wrap_miniprofiler$fn20035.invoke(clojure_miniprofiler.clj:429) at noir.util.middleware$wrap_request_map$fn17803.invoke(middleware.clj:39) at ring.middleware.keyword_params$wrap_keyword_params$fn16572.invoke(keyword_params.clj:35) at ring.middleware.nested_params$wrap_nested_params$fn16622.invoke(nested_params.clj:84) at ring.middleware.multipart_params$wrap_multipart_params$fn16749.invoke(multipart_params.clj:117) at ring.middleware.params$wrap_params$fn16775.invoke(params.clj:64) at ring.middleware.cookies$wrap_cookies$fn16359.invoke(cookies.clj:161) at ring.middleware.absolute_redirects$wrap_absolute_redirects$fn16903.invoke(absolute_redirects.clj:36) at ring.middleware.resource$wrap_resource$fn16811.invoke(resource.clj:28) at ring.middleware.content_type$wrap_content_type$fn16880.invoke(content_type.clj:30) at ring.middleware.not_modified$wrap_not_modified$fn16861.invoke(not_modified.clj:52) at ring.middleware.x_headers$wrap_xss_protection$fn16211.invoke(x_headers.clj:71) at ring.middleware.x_headers$wrap_frame_options$fn16201.invoke(x_headers.clj:38) at ring.middleware.x_headers$wrap_content_type_options$fn16206.invoke(x_headers.clj:53) at hiccup.middleware$wrap_base_url$fn__17134.invoke(middleware.clj:12) at ring.middleware.format_params$wrap_format_params$fn17596.invoke(format_params.clj:113) at ring.middleware.format_params$wrap_format_params$fn17596.invoke(format_params.clj:113) at ring.middleware.format_params$wrap_format_params$fn17596.invoke(format_params.clj:113) at ring.middleware.format_response$wrap_format_response$fn17725.invoke(format_response.clj:174) at noir.validation$wrap_noir_validation$fn__17184.invoke(validation.clj:155) at noir.cookies$noir_cookies$fn17245.invoke(cookies.clj:72) at ring.middleware.cookies$wrap_cookies$fn16359.invoke(cookies.clj:161) at noir.session$noir_flash$fn__17328.invoke(session.clj:158) at ring.middleware.flash$wrap_flash$fn16232.invoke(flash.clj:35) at noir.session$noir_session$fn17314.invoke(session.clj:109) at ring.middleware.session_timeout$wrap_idle_session_timeout$fn17270.invoke(session_timeout.clj:25) at ring.middleware.session$wrap_session$fn16480.invoke(session.clj:102) at ring.middleware.file$wrap_file$fn__16832.invoke(file.clj:44) at ring.middleware.file_info$wrap_file_info$fn17860.invoke(file_info.clj:69) at compojure.core$routing$fn16050.invoke(core.clj:144) at clojure.core$some.invoke(core.clj:2570) at compojure.core$routing.doInvoke(core.clj:144) at clojure.lang.RestFn.applyTo(RestFn.java:139) at clojure.core$apply.invoke(core.clj:632) at compojure.core$routes$fn16054.invoke(core.clj:149) at org.httpkit.server.HttpHandler.run(RingHandler.java:91) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) 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) Caused by: java.lang.RuntimeException: could not start [#'foo.bar.components.server/server] due to at mount.core$up$fn__2246.invoke(core.cljc:88) at mount.core$up.invoke(core.cljc:88) at clojure.lang.Var.invoke(Var.java:388) at foo.bar.components.server$eval36438.invoke(server.clj:31) at clojure.lang.Compiler.eval(Compiler.java:6782) at clojure.lang.Compiler.eval(Compiler.java:6772) at clojure.lang.Compiler.load(Compiler.java:7227) ... 61 more Caused by: java.lang.ClassCastException: mount.core.DerefableState cannot be cast to clojure.lang.IFn at org.httpkit.server$run_server.invoke(server.clj:8) at foo.bar.components.server$eval36438$fn36439.invoke(server.clj:31) at mount.core$recordBANG.invoke(core.cljc:82) at mount.core$up$fn2246.invoke(core.cljc:91) ... 67 more

The interesting namespaces regarding mount are: foo.bar.user and the component definitions are in: foo.bar.components.*

tolitius commented 8 years ago

@sveri,

Looks like the same cause as in #25 where a :stop for the #'foo.bar.components.handler/handler solves it.

Let me know if this helps.

tolitius commented 8 years ago

going to close it, and keep #25 open, since it is the same issue