Fork me on GitHub

> richiardiandrea: Is there a way to stop a Jetty server started with :crux.http-server/server? > I use the reloaded pattern and I do call .close on the node on stop but it seems the Http server is still running on restart and I get back a Address already in use error Hi there, I wanted to find if there was an answer to the question above. I could not find it and I am still receiving

Execution error (BindException) at  (
Address already in use
When restarting the app cause Jetty remains started - I have also checked the CruxNode defrecord but I don't see the http server...any hint?


I think I found it under (:server (:crux.http-server/server @(:!system node))) Please let me know if this is considered an anti-pattern 😄


hey 🙂 sorry to be late to the party are you saying that you had held on to a reference to the http server by looking it up inside the node and storing it somewhere in your app state, preventing it from getting GC'd?


Or (on second reading) are you saying that you have a workaround you're happy enough with for the moment?


which JVM platform + OS are you using?


Hey Jeremy yes sorry that was late here and I was definitely tired :D So basically I needed a way to shut down the jetty server launched as a module I found the above as workaround, and in my component start I can now:

(assoc :node node
               :http-server (-> node
And in the component stop:

(when (and http-server
             (or (not (.isStopping ^Server http-server)) (not (.isStopped ^Server http-server))))
    (.stop ^Server http-server))
I think the ideal solution would be to have :close-fn on the node stop the server for me...I am calling it this way:
(when (and node (not (:closed? node))) (let [close-fn (:close-fn node)] (close-fn))) 
Do you think it is worth a GitHub issue?


The server record implements Closeable already (which runs .stop) and the xtdb.system wiring should be .close-ing everything I'm not sure why it's not actually stopping for you


> which JVM platform + OS are you using? (^bump)


are you leaving a pause between stopping and restarting? Looking at I see that STOPPING is listed as a possible AbstractLifeCycle field value :thinking_face:


I am on JVM plus linux but let me verify in isolation what is going on - your link clearly shows that you it is calling .stop there

👍 1