Description
Tracer Version(s)
5.49
Node.js Version(s)
22.15.0
Bug Report
We are deploying a standalone build of nextjs 15 with app router
It was working fine until we are on 5.37.1
Last month we upgraded it to 5.41.1
(then latest)
But we observed it caused memory leak in our application (issue1, issue2)
A few days ago, we upgraded to 5.48.1
to fix this leak
But the entire app gets unresponsive after an hour or so (reproducible on 5.49.0
too)
Reproduction Code
next.js ( reproducible on both 15.2 & 15.3) app router standalone output build
src/lib/tracer.ts
import tracer from "dd-trace"
// refer: https://docs.datadoghq.com/tracing/trace_collection/automatic_instrumentation/dd_libraries/nodejs/#typescript-and-bundlers
const ddtracer = tracer.init() // initialized in a different file to avoid hoisting
const provider = new ddtracer.TracerProvider()
provider.register()
export { default } from "dd-trace"
src/instrumenation.ts
// https://nextjs.org/docs/app/building-your-application/optimizing/instrumentation
// https://vercel.com/docs/observability/otel-overview
export async function register() {
// To avoid errors with built-in modules not being defined https://github.com/vercel/next.js/discussions/16600#discussioncomment-7204740
if (process.env.NEXT_RUNTIME === "nodejs") {
if (process.env.DD_API_KEY) {
await import("./lib/tracer") // must come before importing any instrumented module
}
}
}
Error Logs
No response
Tracer Config
DD_SERVICE=webui DD_VERSION=$REVISION DD_SITE="datadoghq.com"
DD_LOGS_INJECTION=true DD_LOGS_ENABLED=true DD_TRACE_ENABLED=true DD_TRACE_SAMPLE_RATE=1.0 DD_PROFILING_ENABLED=true DD_IAST_ENABLED=true DD_APPSEC_ENABLED=true DD_DYNAMIC_INSTRUMENTATION_ENABLED=true DD_RUNTIME_METRICS_ENABLED=true DD_EXCEPTION_DEBUGGING_ENABLED=true
Operating System
Linux x86_64 GNU/Linux
Bundling
Next.js