Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: send EINVAL ::1:8125 on Node.js 17+ #222

Open
francisdb opened this issue Apr 22, 2022 · 2 comments
Open

Error: send EINVAL ::1:8125 on Node.js 17+ #222

francisdb opened this issue Apr 22, 2022 · 2 comments

Comments

@francisdb
Copy link

hot-shots 9.0.0
Darwin foobar.local 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:46:32 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T6000 arm64

we configure StatsD by default with host localhost

on Node.js 16 everything works as expected
on Node.js 17 and 18 we get:

 Unhandled error. (Error: Error sending hot-shots message: Error: send EINVAL ::1:8125

      at handleCallback (node_modules/hot-shots/lib/statsd.js:350:32)
      at processTicksAndRejections (node:internal/process/task_queues:81:21) {
        code: 'EINVAL'
      })
      at handleCallback (node_modules/hot-shots/lib/statsd.js:367:21)

Probably because localhost now resolves to ::1 instead of 127.0.0.1 and the code path expects an ipv4 address?

workaround is to configure 127.0.0.1 instead of localhost

@bdeitte
Copy link
Collaborator

bdeitte commented Jun 20, 2022

Well, that's interesting. I'm surprised this isn't coming up with more people. Switching away from localhost just happened in version 8.0.0 and was done for performance reasons: #186

@jcarvalho
Copy link

We're seeing the same issue running in a IPv6 EKS Cluster, where the Dogstatsd agent running in the Node only has an IPv6 address.

We're working around this with the following snippet:

  udpSocketOptions: {
    type: process.env.DD_AGENT_HOST != null && isIPv6(process.env.DD_AGENT_HOST) ? "udp6" : "udp4",
  },

It would be great to have hot-shots auto-detect if an IPv6 is provided and change the Socket Type to udp6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants