Skip to content

Node 10 profiler path output regression on Windows #20891

Closed
@edmorley

Description

@edmorley
  • Version: v10.1.0
  • Platform: Windows 10 x64 (1803)
  • Subsystem: v8 profiler

Summary:

With Node 10 on Windows, the v8 log generated via node --prof no longer quotes paths correctly, causing node --prof-process to treat the backslashes in the paths as escape sequences.

This causes a path like:
C:\Users\Ed\src\neutrino-dev\node_modules\webpack\lib\Stats.js

...to be output as:
C:\u0000\rc\u0000erder\node_modulesëck\u0000tats.js

...which doesn't make for the most readable profiles.

In addition, redirecting stdout when using --prof-process without the --preprocess, results in a binary file (whereas if there is no redirection, text is output to the console as expected).

I'm presuming this is a regression between v8 6.2 and 6.6.

STR:

  1. node --prof node_modules\webpack\bin\webpack.js --mode production
  2. node --prof-process --preprocess isolate-[IDENTIFIER]-v8.log > preprocessed.json
  3. node --prof-process isolate-[IDENTIFIER]-v8.log > processed.txt
  4. Repeat steps 1-3 using Node 8.11.2 instead, and compare output from each.

Expected:

Node 10.1.0 produces comparable output to Node 8.x, that correctly lists the filesystem paths for items in the profile.

Actual:

# Step 1 produces... (note difference in quoting)

Node 10.1.0:

v8-version,6,6,346,27,-node.6,0
shared-library,C:\Users\Ed\Desktop\node-v10.1.0-win-x64\node.exe,0x7ff64f880000,0x7ff650f0f000,0
shared-library,C:\WINDOWS\SYSTEM32\ntdll.dll,0x7ff9b1df0000,0x7ff9b1fd1000,0
shared-library,C:\WINDOWS\System32\KERNEL32.DLL,0x7ff9b0da0000,0x7ff9b0e52000,0
...

Node 8.11.2:

v8-version,6,2,414,54,0
shared-library,"C:\Users\Ed\Desktop\node-v8.11.2-win-x64\node.exe",0x7ff6f9ec0000,0x7ff6fb490000,0
shared-library,"C:\WINDOWS\SYSTEM32\ntdll.dll",0x7ff9b1df0000,0x7ff9b1fd1000,0
shared-library,"C:\WINDOWS\System32\KERNEL32.DLL",0x7ff9b0da0000,0x7ff9b0e52000,0
...

# Step 2 produces...

Node 10.1.0:

{
  "code": [
  {
    "name": "C:\u0000\rsktop\node-v10.1.0-win-x64\node.exe",
    "type": "SHARED_LIB"
  },
  {
    "name": "C:\u0000WS\u0000M32\ntdll.dll",
    "type": "SHARED_LIB"
  },
...

Node 8.11.2:

{
  "code": [
  {
    "name": "C:\\Users\\Ed\\Desktop\\node-v8.11.2-win-x64\\node.exe",
    "type": "SHARED_LIB"
  },
  {
    "name": "C:\\WINDOWS\\SYSTEM32\\ntdll.dll",
    "type": "SHARED_LIB"
  },
...

# Step 3 produces...

Node 10.1.0 (note: the binary output only occurs when redirecting stdout to a file):

5374 6174 6973 7469 6361 6c20 7072 6f66
696c 696e 6720 7265 7375 6c74 2066 726f
6d20 6973 6f6c 6174 652d 3030 3030 3031
3139 3031 3441 3539 4130 2d76 382e 6c6f
...

Node 8.11.2:

Statistical profiling result from isolate-0000027B49039D30-v8.log, (5485 ticks, 82 unaccounted, 0 excluded).

 [Shared libraries]:
   ticks  total  nonlib   name
   2551   46.5%          C:\WINDOWS\SYSTEM32\ntdll.dll
   1507   27.5%          C:\Users\Ed\Desktop\node-v8.11.2-win-x64\node.exe
...

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