Logstash StatsD Plugin caches DNS resolutions when using UDP forever

The recent(ish) release of https://github.com/logstash-plugins/logstash-output-statsd to 3.2.0 used the latest release of https://github.com/reinh/statsd/blob/master/lib/statsd.rb, which changed the socket logic to reuse a single socket until error (https://github.com/reinh/statsd/blob/master/lib/statsd.rb#L438). This works fine for TCP, but for UDP if a host name changes (like it might in a k8s-like environment), we will never refresh the socket and start losing stats. I'm sort of assuming the upstream won't get fixed based on the issues that exist in their github (calls for a maintainer, etc.)

I confirmed this by testing https://github.com/SpencerMalone/logstash-output-statsd/commit/5130f960ae2e45e40b01da7427cf21a8e09cd03c, but am unsure of how to proceed for an upstream fix. My current solution is hacky at best. I don't really recall ruby's concurrency semantics, is it a whole new process? Can we call connect from a child thread created in the register function? Anyone have opinions on how to best approach this?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.