duct 2022-08-03

Hi all, we noticed that our application does not restart when there’s an exception in HikariCP (it cannot connect) on startup

We use startup code similar to

(defn -main [& args]
  (let [keys     (or (duct/parse-keys args) [:duct/daemon])
        profiles [:duct.profile/prod]
        config (-> (duct/resource "simple/config.edn")
                   (duct/read-config)
                   (duct/prep-config profiles))
        system (ig/init config keys)]
    (reset! stored-config config)
    (reset! stored-system system)
    (duct/await-daemons system)))
(I still work at that company ;))

😬 1

HikariPool-1 - Exception during pool initialization

We want to restart the application when that happens, how can that be accomplished?

I see in your message HikariPool-1 it seems like exception was in thread 1. I’m not an expert but assume that hikary launching separate threads and not joining them to the main application thread. So if one thread dies others will still continue to work

aha

so this exception doesn’t happening during Duct initialization

so maybe an exception on a separate thread that only crashes the thread

but fact of the matter is there’s no database connection after the exception, it does not retry

but not a duct issue then, but hikari

there’s a bunch of parameters tho

maybe you need to play with them and setup some timeouts or increase the pool size

thank you

If hikary throws an exception then you probably can wrap the body of -main function in try/catch block and do a retry

thanks

do you know why the exception does not crash the application?

Now it stays in a “Healthy” state after it