Skip to content

VTune breaking Node.JS issue has been fixed in V8 repo, but the fix patch was not cherry-picked by Node.JS repo #29060

Closed
@lucshi

Description

@lucshi
  • Version:
    v13.0.0-pre

  • Platform:
    4.18.0-25-generic GitHub issue management #26~18.04.1-Ubuntu SMP Thu Jun 27 07:28:31 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

  • Subsystem:
    JIT

  • Issue:
    VTune profiling is removed from Node.js due to its broken support (commit: 88bac02).

This problem has been fixed in V8 (commit: f044f91d87f80d59b4a65799149fa38fa6d67cd7). However Node didn’t cherry-pick this patch.

The root cause of this issue was that, when VTune JIT support is enabled, the WasmEngine of an Isolate tries to enable code logging by EnableCodeLogging() method. This multithreaded method requires a Mutex for safety. However, as the WasmEngine is not created, the Mutex of it is not initialized. An attempt of acquiring this Mutex results in an error. The bug is fixed by creating WasmEngine before it enables code logging.

The fix was that,

   if (event_handler) {
-    isolate_->wasm_engine()->EnableCodeLogging(isolate_);
+    if (isolate_->wasm_engine() != nullptr) {
+      isolate_->wasm_engine()->EnableCodeLogging(isolate_);
+    }
     jit_logger_.reset(new JitLogger(isolate_, event_handler));
     AddCodeEventListener(jit_logger_.get());
     if (options & kJitCodeEventEnumExisting) {

Tracked by:

Change-Id: I59e749190288ec412f6661233e8f62b0dff3cd7f
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1337376
    Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
    Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#60060}

VTune is a useful tool to profile Node app performance bottleneck and microarchitecture breakdown. Could you please review this issue and cherry-pick the patch to re-enable VTune profiling in Node.JS? Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildIssues and PRs related to build files or the CI.feature requestIssues that request new features to be added to Node.js.wontfixIssues that will not be fixed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions