You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
inspector: add way to force worker to wait inspector session detach #27677
Is your feature request related to a problem? Please describe.
I am working on a tool that exposes different information available over the inspector protocol from Node (https://github.com/ak239/thetool). Right now I can get the data from processes and I would like to add way to get this data from workers as well.
With regular process following way to get all information is available:
Start process with --inspect-brk flag in this case process will wait for Runtime.runIfWaitingForDebugger call.
Start tool, tool connects to process, prepare everything, e.g. enable profiler using Profiler.start and when ready tool starts process using Runtime.runIfWaitingForDebugger.
When process is finished it sends Runtime.executionContextDestroyed for main context and waits for tool to disconnect.
Tool gets events capture all required data and disconnect.
Node process finished.
In this case we have nice way to get all data and avoid any possible race condition.
For workers right now:
Tool calls NodeWorker.enable with waitForDebuggerOnStart equals true.
When worker is started, it sends NodeWorker.attachedToWorker and waits tool to call Runtime.runIfWaitingForDebugger.
Tool prepare session, e.g. start profiler and send Runtime.runIfWaitingForDebugger
Worker sends NodeWorker.detachedFromWorker. When tool gets this event it is too late to try to get any data from worker session. It is gone.
Describe the solution you'd like
Based on @eugeneo comment:
Implement NodeRuntime in worker. NodeRuntime. notifyWhenWaitingForDisconnect will force Worker to wait for disconnect and worker will send NodeRuntime. waitingForDisconnect when it is done. NodeWorker domain should get NodeWorker.detach to make disconnect possible.
Can this be joined with the #27600 - e.g. sending a NodeRuntime. notifyWhenWaitingForDisconnect to a worker will keep it alive while the frontend needs it.
Activity
eugeneo commentedon May 13, 2019
Can this be joined with the #27600 - e.g. sending a
NodeRuntime. notifyWhenWaitingForDisconnectto a worker will keep it alive while the frontend needs it.inspector: supported NodeRuntime domain in worker
inspector: supported NodeRuntime domain in worker
alexkozy commentedon Jul 3, 2019
Fixed.