diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5da2350b..937f7826 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,7 @@ jobs: asan: strategy: matrix: - version: [16, 18, 20, 22, 23] + version: [18, 20, 22, 24] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -23,7 +23,7 @@ jobs: valgrind: strategy: matrix: - version: [16, 18, 20, 22, 23] + version: [18, 20, 22, 24] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.gitlab/benchmarks.yml b/.gitlab/benchmarks.yml index 73bb6494..31d0c913 100644 --- a/.gitlab/benchmarks.yml +++ b/.gitlab/benchmarks.yml @@ -32,10 +32,10 @@ benchmarks: - ./steps/run-benchmarks.sh parallel: matrix: - - MAJOR_NODE_VERSION: 16 - MAJOR_NODE_VERSION: 18 - MAJOR_NODE_VERSION: 20 - MAJOR_NODE_VERSION: 22 + - MAJOR_NODE_VERSION: 24 artifacts: name: "reports" paths: diff --git a/binding.gyp b/binding.gyp index d059d3c0..55fa8b9a 100644 --- a/binding.gyp +++ b/binding.gyp @@ -83,6 +83,8 @@ 'xcode_settings': { 'OTHER_CFLAGS+': [ "-Wno-deprecated-declarations", + "-Wno-cast-function-type-mismatch", # clang17 now warns about casts between incompatible function types and v8 has some of those + "-Wno-unknown-warning-option", # "-Wcast-function-type-mismatch" is not a valid warning option for clang < 17 "-Werror", '-std=gnu++20', ], diff --git a/bindings/profilers/heap.cc b/bindings/profilers/heap.cc index 0ad9a9de..dc80992b 100644 --- a/bindings/profilers/heap.cc +++ b/bindings/profilers/heap.cc @@ -56,6 +56,11 @@ struct HeapProfilerState { explicit HeapProfilerState(v8::Isolate* isolate) : isolate(isolate) {} ~HeapProfilerState() { + auto profiler = isolate->GetHeapProfiler(); + if (profiler) { + profiler->StopSamplingHeapProfiler(); + } + UninstallNearHeapLimitCallback(); if (async) { // defer deletion of async when uv_close callback is invoked @@ -323,7 +328,7 @@ static int CreateTempFile(uv_loop_t& loop, std::string& filepath) { } static void ExportProfile(HeapProfilerState& state) { - const int64_t timeoutMs = 5000; + const int64_t timeoutMs = 15000; uv_loop_t loop; int r; @@ -355,6 +360,14 @@ static void ExportProfile(HeapProfilerState& state) { options.file = args[0]; options.args = args.data(); options.exit_cb = &OnExit; + uv_stdio_container_t child_stdio[3]; + child_stdio[0].flags = UV_IGNORE; + child_stdio[1].flags = UV_INHERIT_FD; + child_stdio[1].data.fd = 2; + child_stdio[2].flags = UV_INHERIT_FD; + child_stdio[2].data.fd = 2; + options.stdio = child_stdio; + options.stdio_count = 3; uv_process_t child_req; uv_timer_t timer; timer.data = &child_req; diff --git a/bindings/profilers/wall.cc b/bindings/profilers/wall.cc index 3769dbf0..33f6e3e7 100644 --- a/bindings/profilers/wall.cc +++ b/bindings/profilers/wall.cc @@ -671,7 +671,7 @@ NAN_METHOD(WallProfiler::New) { NAN_METHOD(WallProfiler::Start) { WallProfiler* wallProfiler = - Nan::ObjectWrap::Unwrap(info.Holder()); + Nan::ObjectWrap::Unwrap(info.This()); if (info.Length() != 0) { return Nan::ThrowTypeError("Start must not have any arguments."); @@ -766,7 +766,7 @@ NAN_METHOD(WallProfiler::Stop) { bool restart = info[0].As()->Value(); WallProfiler* wallProfiler = - Nan::ObjectWrap::Unwrap(info.Holder()); + Nan::ObjectWrap::Unwrap(info.This()); v8::Local profile; auto err = wallProfiler->StopImpl(restart, profile); @@ -996,27 +996,27 @@ void WallProfiler::SetContext(Isolate* isolate, Local value) { } NAN_GETTER(WallProfiler::GetContext) { - auto profiler = Nan::ObjectWrap::Unwrap(info.Holder()); + auto profiler = Nan::ObjectWrap::Unwrap(info.This()); info.GetReturnValue().Set(profiler->GetContext(info.GetIsolate())); } NAN_SETTER(WallProfiler::SetContext) { - auto profiler = Nan::ObjectWrap::Unwrap(info.Holder()); + auto profiler = Nan::ObjectWrap::Unwrap(info.This()); profiler->SetContext(info.GetIsolate(), value); } NAN_GETTER(WallProfiler::SharedArrayGetter) { - auto profiler = Nan::ObjectWrap::Unwrap(info.Holder()); + auto profiler = Nan::ObjectWrap::Unwrap(info.This()); info.GetReturnValue().Set(profiler->jsArray_.Get(v8::Isolate::GetCurrent())); } NAN_METHOD(WallProfiler::V8ProfilerStuckEventLoopDetected) { - auto profiler = Nan::ObjectWrap::Unwrap(info.Holder()); + auto profiler = Nan::ObjectWrap::Unwrap(info.This()); info.GetReturnValue().Set(profiler->v8ProfilerStuckEventLoopDetected()); } NAN_METHOD(WallProfiler::Dispose) { - auto profiler = Nan::ObjectWrap::Unwrap(info.Holder()); + auto profiler = Nan::ObjectWrap::Unwrap(info.This()); delete profiler; } diff --git a/package-lock.json b/package-lock.json index b5311269..755b1bd7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@datadog/pprof", - "version": "5.7.1", + "version": "5.8.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@datadog/pprof", - "version": "5.7.1", + "version": "5.8.0", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index e48b9ae3..a4cdb874 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@datadog/pprof", - "version": "5.7.1", + "version": "5.8.0", "description": "pprof support for Node.js", "repository": "datadog/pprof-nodejs", "main": "out/src/index.js", @@ -83,5 +83,7 @@ }, "engines": { "node": ">=16" - } + }, + "//": "Temporary fix to make nan@2.22.2 work with Node 24", + "postinstall": "sed -i '' 's/^.* Holder() const.*//' ./node_modules/nan/nan_callbacks_12_inl.h" }