Issue metadata
Sign in to add a comment
|
Node --inspector should fire Runtime.executionContextFinished
Reported by
noj...@gmail.com,
Jul 14 2016
|
||||||||||||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (iPhone; CPU iPhone OS 9_2_1 like Mac OS X) AppleWebKit/601.1 (KHTML, like Gecko) CriOS/49.0.2623.73 Mobile/13D15 Safari/601.1.46 Steps to reproduce the problem: Use case : automatically profile execution of a node script. E.g node-cpu-profile myscript.js arg1 arg2. this will basically run node --inspect-brk tsc.js, start profiling, wait for script to finish and dump the profile as [date].cpuprofile file which can be loaded in chrome devtools. It will call Runtime.enable, Profiler.enable, profiler.start It has no way of knowing when the script execution has finished. What is the expected behavior? An event like Runtime.executionContextFinished will signal the client that all the script has finished executing and it can stop the profiler and other tools. This is only useful for node and doesn't make sense for a browser. What went wrong? No event fired when script has finished executing. Did this work before? No Chrome version: <Copy from: 'about:version'> Channel: n/a OS Version: Flash Version:
,
Jul 15 2016
Sounds interesting. What if the script is waiting for IO? Listening to the socket? Scheduled a timer? Do we only consider "the program has finished completely" usecase? I think node should destroy the context and issue Runtime.executionContextDestroyed in this case. It's just not wired up. Eugene, could you take a look please?
,
Jul 15 2016
Just confirming, when Runtime.executionContextDestroyed is sent, I can still call Profiler.stop and get back the profile right ?
The idea is the client will auto stop when there is a executionContext[Finished|Destroyed] sent. Otherwise if user is waiting for IO, s?he can always press Ctrl+C at any time, when the action they want to record is over.
In node it be handled on process.on('SIGINT') which will stop profiler, dump the profile and exit the process.
The idea of cli utility is that developers can write performance regression tests and have continuous integration.
,
Jul 15 2016
> Just confirming, when Runtime.executionContextDestroyed is sent, I can still call Profiler.stop and get back the profile right ? This is where we should call V8Debugger::contextDestroyed: https://github.com/nodejs/node/blob/master/src/node.cc#L2178. Probably makes sense to report it under node and fix it there.
,
Jul 15 2016
(and yes, you'll be able to Profiler.stop it once you got the Runtime.executionContextDestroyed)
,
Jul 15 2016
,
Jul 28 2016
Could someone dupe this issue against https://bugs.chromium.org/p/chromium/issues/detail?id=632245 Didn't realize I had already created one a while ago.
,
Jul 28 2016
|
|||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||
Comment 1 by pfeldman@chromium.org
, Jul 14 2016Status: Assigned (was: Unconfirmed)