Fork me on GitHub
#aleph
<
2018-11-14
>
lambdam10:11:44

@mccraigmccraig yes I think that i'm correctly shutting it down. Here is my server definition with integrant:

(defn create-aleph-server [aleph-config]
  ;; handler
  ;; middlewares...
  ;; returns aleph server
  )

(defmethod ig/init-key ::aleph [_ aleph-config]
  (create-aleph-server aleph-config))

(defmethod ig/halt-key! ::aleph [_ server]
  (.close server))

(defmethod ig/suspend-key! ::aleph [_ server]
  (.close server))

(defmethod ig/resume-key ::aleph [_key aleph-config _old-opts _old-impl]
  (create-aleph-server aleph-config))
Every time I fire cider-refresh, the server is killed and rebuilt (there is an Emacs hook with a local .dir-locals.el file):
((nil . ((cider-ns-refresh-before-fn . "integrant.repl/suspend")
         (cider-ns-refresh-after-fn  . "integrant.repl/resume"))))
Also, if I'm not mistaken, cider-refresh uses internally clojure.tools.namespace.repl/refresh. The weird thing is that on "simple" projects, this code works perfectly with aleph but with the heavier one (re-natal + web server + Datomic + integrant), aleph seems to get stuck randomly on dev with Spacemacs.

mccraigmccraig10:11:00

i don't have any ideas @dam - your setup is quite different from mine. perhaps worth checking the socket is being released correctly when your server is .closed

lambdam10:11:58

I never did that

lambdam10:11:29

Do you have any piece of advice to do that on Linux. What tool?

valerauko13:11:28

@dam it's a known bug

valerauko14:11:28

apparently it SOMETIMES breaks

valerauko14:11:49

i ran into this issue just today while debugging something else

lambdam21:11:08

oh thanks @vale, it seems to be exactly that