luminus-framework / luminus-framework/luminus-template

(stop) fails on fresh 'lein new luminus prj +http-kit'

Open
#506 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Clojure
Stars
648
Forks
143
PR merge metrics
No merged PRs in 30d

Description

## To reproduce

```console
$ lein new luminus lumtest +http-kit
$ cd lumtest
$ lein repl
user=> (start)
user=> (stop)
```

## Results
```console
user=> (start)
2020-08-12 08:52:21,558 [nREPL-session-a1fbf890-d24b-4206-a536-cce6f5197ae8] INFO lumtest.env -
-=[lumtest started successfully using the development profile]=-
2020-08-12 08:52:21,832 [nREPL-session-a1fbf890-d24b-4206-a536-cce6f5197ae8] INFO luminus.http-server - starting HTTP server on port 3000
{:started ["#'lumtest.config/env" "#'lumtest.handler/init-app" "#'lumtest.handler/app-routes" "#'lumtest.core/http-server"]}
user=> (stop)
#error {
:cause "class clojure.lang.AFunction$1 cannot be cast to class java.util.concurrent.Future (clojure.lang.AFunction$1 is in unnamed module of loader 'app'; java.util.concurrent.Future is in module java.base of loader 'bootstrap')"
:via
[{:type clojure.lang.ExceptionInfo
:message "could not stop [#'lumtest.core/http-server] due to"
:data {}
:at [mount.core$down$fn__446 invoke "core.cljc" 96]}
{:type java.lang.ClassCastException
:message "class clojure.lang.AFunction$1 cannot be cast to class java.util.concurrent.Future (clojure.lang.AFunction$1 is in unnamed module of loader 'app'; java.util.concurrent.Future is in module java.base of loader 'bootstrap')"
:at [clojure.core$deref_future invokeStatic "core.clj" 2298]}]
:trace
[[clojure.core$deref_future invokeStatic "core.clj" 2298]
[clojure.core$deref invokeStatic "core.clj" 2320]
[clojure.core$deref invoke "core.clj" 2306]
[luminus.http_server$stop invokeStatic "http_server.clj" 16]
[luminus.http_server$stop invoke "http_server.clj" 15]
[lumtest.core$eval12850$fn__12856 invoke "core.clj" 31]
[mount.core$record_BANG_ invokeStatic "core.cljc" 74]
[mount.core$record_BANG_ invoke "core.cljc" 73]
[mount.core$down$fn__446 invoke "core.cljc" 97]
[mount.core$down invokeStatic "core.cljc" 96]
[mount.core$down invoke "core.cljc" 86]
[mount.core$bring invokeStatic "core.cljc" 247]
[mount.core$bring invoke "core.cljc" 239]
[mount.core$stop invokeStatic "core.cljc" 300]
[mount.core$stop doInvoke "core.cljc" 291]
[clojure.lang.RestFn applyTo "RestFn.java" 137]
[clojure.core$apply invokeStatic "core.clj" 665]
[clojure.core$apply invoke "core.clj" 660]
[mount.core$stop_except invokeStatic "core.cljc" 382]
[mount.core$stop_except doInvoke "core.cljc" 377]
[clojure.lang.RestFn invoke "RestFn.java" 408]
[user$stop invokeStatic "user.clj" 24]
[user$stop invoke "user.clj" 21]
[user$eval13396 invokeStatic "form-init9286139410565183375.clj" 1]
[user$eval13396 invoke "form-init9286139410565183375.clj" 1]
[clojure.lang.Compiler eval "Compiler.java" 7177]
[clojure.lang.Compiler eval "Compiler.java" 7132]
[clojure.core$eval invokeStatic "core.clj" 3214]
[clojure.core$eval invoke "core.clj" 3210]
[nrepl.middleware.interruptible_eval$evaluate$fn__11892 invoke "interruptible_eval.clj" 91]
[clojure.main$repl$read_eval_print__9086$fn__9089 invoke "main.clj" 437]
[clojure.main$repl$read_eval_print__9086 invoke "main.clj" 437]
[clojure.main$repl$fn__9095 invoke "main.clj" 458]
[clojure.main$repl invokeStatic "main.clj" 458]
[clojure.main$repl doInvoke "main.clj" 368]
[clojure.lang.RestFn invoke "RestFn.java" 1523]
[nrepl.middleware.interruptible_eval$evaluate invokeStatic "interruptible_eval.clj" 84]
[nrepl.middleware.interruptible_eval$evaluate invoke "interruptible_eval.clj" 56]
[nrepl.middleware.interruptible_eval$interruptible_eval$fn__11918$fn__11922 invoke "interruptible_eval.clj" 155]
[clojure.lang.AFn run "AFn.java" 22]
[nrepl.middleware.session$session_exec$main_loop__12019$fn__12023 invoke "session.clj" 190]
[nrepl.middleware.session$session_exec$main_loop__12019 invoke "session.clj" 189]
[clojure.lang.AFn run "AFn.java" 22]
[java.lang.Thread run "Thread.java" 834]]}
2020-08-12 08:52:33,463 [nREPL-session-a1fbf890-d24b-4206-a536-cce6f5197ae8] INFO lumtest.env -
-=[lumtest has shut down successfully]=-
{:stopped ["#'lumtest.handler/init-app"]}
```

Subsequent `(start)`s fail!

Contributor guide

No contributing guide indexed for this repository

Research direction

Run the lein new luminus lumtest +http-kit reproduction and inspect the stop path shown in luminus.http_server/stop at http_server.clj line 16, along with the generated core.clj entry point. Verify that stopping after start completes without the ClassCastException and that a subsequent start succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.