-
Notifications
You must be signed in to change notification settings - Fork 351
Description
Tracer Version(s)
5.67.0, also happened in earlier versions
Node.js Version(s)
22, 24, probably more
Bug Report
When using dd-trace's ESM integration (--import dd-trace/initialize.mjs) with an application that executes failing
dynamic imports, a memory leak occurs. The leak is triggered when the application handles requests after being started with Datadog's ESM integration. Memory consumption increases continuously over time when requests are made to endpoints that execute failing dynamic imports.
The issue occurs specifically when:
- The application is started with Datadog's ESM integration
- A dynamic import that fails at runtime is executed (even when properly caught)
- Requests are made to the application
While failing dynamic imports may not be typical, they are used in some applications to conditionally execute code based on whether dependencies are installed.
Reproduction Code
Link to minimal reproduction repository: https://github.com/ghost91-/dd-trace-esm-memory-leak
Error Logs
No response
Tracer Config
Default
Operating System
Linux pollux 6.16.8-arch3-1 #1 SMP PREEMPT_DYNAMIC Mon, 22 Sep 2025 22:08:35 +0000 x86_64 GNU/Linux
Bundling
No Bundling