Description
- 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:
-
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 }
-
Run it with
node --inspect-brk chrome-inspector-test.js
-
Go to
chrome://inspect
in Chrome -
Under "Remote Target" and "chrome-inspector-test.js", click "inspect".
-
In the new window, go to the "Profiler" tab and click "Start".
-
Wait for more than 5 seconds.
-
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.