Skip to content

Inspector profiling can't be stopped or viewed after script finishes running #14432

Closed
@not-an-aardvark

Description

@not-an-aardvark
  • Version: Node 8.2.1, Chrome 59.0.3071.115
  • Platform: macOS Sierra (10.12.5)
  • Subsystem: inspector

When using the Profiler to measure performance in Chrome, it seems to be impossible to stop the profiler and view the data after the script has finished running.

Reproduction:

  1. Create a file (chrome-inspector-test.js) that runs for 5 seconds and then exits:

    'use strict';
    
    const fiveSecondsFromNow = Date.now() + 5000;
    
    while (Date.now() < fiveSecondsFromNow) {
      // do nothing
    }
  2. Run it with node --inspect-brk chrome-inspector-test.js

  3. Go to chrome://inspect in Chrome

  4. Under "Remote Target" and "chrome-inspector-test.js", click "inspect".

  5. In the new window, go to the "Profiler" tab and click "Start".

  6. Wait for more than 5 seconds.

  7. Click "Stop".

Expected behavior: After clicking "Stop", the profile should stop recording, and it should be possible to see the performance data.

Actual behavior: After clicking "Stop", the devtools window gets stuck looking like this. It's not possible to switch tabs. Profile 1 still appears to be recording, and it doesn't seem to be possible to stop it. The Node process is still running, and has printed "Waiting for the debugger to disconnect...".

If the test is repeated and "Stop" is clicked after fewer than 5 seconds (i.e. while the script is still running), profiling works as expected: the profile stops recording, and it's possible to see the performance data.

Metadata

Metadata

Assignees

Labels

inspectorIssues and PRs related to the V8 inspector protocol

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions