Open dpetran opened 2 years ago
We solved the problem by adding a perpetual loop where we wait for the host name to be resolvable, and I'm happy to contribute that if you'd like:
(defn ^InetSocketAddress inet-addr [{:keys [^String host ^Integer port] :as spec}]
(let [addr (if host
(InetSocketAddress. host port)
(InetSocketAddress. port))]
(if (.isUnresolved addr)
(do (logging/warn "addr is unresolved" host port)
(Thread/sleep 5000)
(recur spec))
addr)))
Though if you'd prefer to handle it a different way, that's fine too.
This is a very old library and I am surprised to find out you are actually using it :) I can transfer the project to you, if you want: it’s hard for me to make the calls because I don’t remember what this was about and I don’t really use it myself. I’d be happy to see it improving based on real-world usage. WDYT?
When trying to connect to a host that isn't resolvable via DNS causes the event-loop thread to crash.
In the logs you'll find:
The event loop still exists and the thread is still runnable, but the connection isn't retried and the only sign that something is wrong is the SEVERE line in the logs.
We discovered it when bringing up a service in an environment with dynamic DNS, where the server it was connecting to was not yet resolvable.