Skip to content

bind EMFILE 0.0.0.0 errors with Node 20 #452

@kimmoahokas

Description

@kimmoahokas

Expected Behavior

Function works the same as with Node 18

Actual Behavior

Function error rate is about 1-2% with following error in logs (added new lines for easier reading)

2023-12-12T13:22:28.894Z
4f6bb64f-d04b-48ca-a6c3-a55abc6e36c8
ERROR
[dd.trace_id=364466785825974076 dd.span_id=364466785825974076]
Uncaught Exception 
{
  "errorType": "Error",
  "errorMessage": "bind EMFILE 0.0.0.0",
  "code": "EMFILE",
  "errno": -24,
  "syscall": "bind",
  "address": "0.0.0.0",
  "stack": [
    "Error: bind EMFILE 0.0.0.0",
    "    at node:dgram:363:20",
    "    at AsyncResource.runInAsyncScope (node:async_hooks:206:9)",
    "    at bound (node:async_hooks:238:16)",
    "    at /opt/nodejs/node_modules/dd-trace/packages/datadog-instrumentations/src/dns.js:79:12",
    "    at AsyncResource.runInAsyncScope (node:async_hooks:206:9)",
    "    at bound (node:async_hooks:238:16)",
    "    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)"
  ]
}

Steps to Reproduce the Problem

I don't have isolated reproduction steps for this, but so far we have seen this with all the lambda functions we have tried to update to node 20. Seems to happen at least with lambdas that use AWS SDK v3 or that do HTTPS requests with got v13. We are currently trying to implement a minimal reproduction case.

Specifications

  • Datadog Lambda Layer version: arn:aws:lambda:eu-west-1:464622532012:layer:Datadog-Node20-x:102
  • Node version: 20.x
  • Datadog Extension layer: arn:aws:lambda:eu-west-1:464622532012:layer:Datadog-Extension-ARM:51

Stacktrace

Error: bind EMFILE 0.0.0.0
at node:dgram:363:20
at AsyncResource.runInAsyncScope (node:async_hooks:206:9)
at bound (node:async_hooks:238:16)
at /opt/nodejs/node_modules/dd-trace/packages/datadog-instrumentations/src/dns.js:79:12
at AsyncResource.runInAsyncScope (node:async_hooks:206:9)
at bound (node:async_hooks:238:16)
at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions