You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The RawSocketSender takes a host and port in its constructor and coverts these into an InetSocketAddress, which tries to resolve the hostname. On RawSocketSender connect this InetSocketAddress is used to reconnect, but if it wasn't resolved during fluent-logger init then it will fail over and over. The code snipped from RawSocketSender is below:
This issue comes up when using the fluent-logger in a highly dynamic environment (like on Docker Swarm) where apps may come up before a DNS entry in Consul is even resolvable. It also means that during failover of a Fluent host (triggering a DNS change) the then failing socket connection will always try the old Fluent host IP and never re-resolve the DNS entry.
My recommendation is to store the Fluent host and port as private fields within the RawSocketSender, not a resolved InetSocketAddress (now stored as this.server) and create a new InetSocketAddress on every socket connection.
I understand there will be performance implications of this and am happy to submit a PR, but wanted to bring it up in an issue in case there were reasons for implementing the RawSocketSender the current way.
The text was updated successfully, but these errors were encountered:
The performance implication could mitigated. The JVM has a DNS lookup cache for which ttl is customizable, most OS as well. So what would be the drawback of what you suggested ?
The
RawSocketSender
takes a host and port in its constructor and coverts these into anInetSocketAddress
, which tries to resolve the hostname. OnRawSocketSender
connect thisInetSocketAddress
is used to reconnect, but if it wasn't resolved during fluent-logger init then it will fail over and over. The code snipped fromRawSocketSender
is below:This issue comes up when using the fluent-logger in a highly dynamic environment (like on Docker Swarm) where apps may come up before a DNS entry in Consul is even resolvable. It also means that during failover of a Fluent host (triggering a DNS change) the then failing socket connection will always try the old Fluent host IP and never re-resolve the DNS entry.
My recommendation is to store the Fluent host and port as private fields within the
RawSocketSender
, not a resolvedInetSocketAddress
(now stored asthis.server
) and create a newInetSocketAddress
on every socket connection.I understand there will be performance implications of this and am happy to submit a PR, but wanted to bring it up in an issue in case there were reasons for implementing the
RawSocketSender
the current way.The text was updated successfully, but these errors were encountered: