-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Support for subprocess inspection #77
Comments
That would be very cool. I wonder a bit about backwards compatibility importance though. Is there any existing tooling that deals with debugging a cluster, for example? |
The (@paulirish or @pavelfeldman can probably clarify) |
I implemented something like it when I was working on bugger[1]. As long as the worker is spawned via [1] https://github.com/buggerjs/bugger/blob/master/lib/agents/worker/index.js |
@Qard this would be Inspector-specific (e.g. require a --inspect). I don't think it would be possible to use existing IPC pipe (not sure what interplay would be if V8 is suspended on a breakpoint and such). So, it most likely will be some new command line flag (--inspect-pipe=<path/to/pipe>?) I don't think it would have impact on backwards compatibility... |
Target API is indeed not the most elegant extensibility implementation, but there are things that speak in its favor:
So I think that we could stick with it. Supporting it in Node means making it public. Let us review it and present to you. |
I wonder if it'd be possible to provide an API for the targets feature to programmatically allow linking frontend to backend or linking isolated nodes in a distributed system. It'd be very cool to be able to inspect multiple levels of the stack at the same time, in the same UI. |
Seems like this would be ideal for process managers like PM2 and indeed anyone relying on the cluster module and multiple processes per system. Right now they'd have to add args to child_process/cluster.fork, as e.g. here: https://github.com/nodejs/node/blob/master/test/parallel/test-cluster-debug-port.js FWIW seems the name of the domain should be "Proxy" or "InspectorProxy" rather than "Target" though, as the original debuggee/target is in fact acting as that.
+1, would be great to somehow discover and be able to automatically attach to backend (i.e. Node) from frontend. |
Both our team experiments and some embedder request indicate a potential in implementing alternative transport for inspector - e.g. IPC pipes or custom embedder APIs. This change moves all HTTP specific code into a separate class and is a first attempt at defining a boundary between the inspector agent and transport. This API will be refined as new transports are implemented. Note that even without considering alternative transports, this change enables better testing of the HTTP server (Valgrind made it possible to identify and fix some existing memory leaks). PR-URL: #9630 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
Ref: nodejs/node#12941 |
This had been implemented some time ago. |
Chrome DevTools protocol has a domain for working with subtargets (https://chromedevtools.github.io/debugger-protocol-viewer/tot/Target/). In the browser case, subtargets are be web/service workers, nested IFrames, etc.
In the Node case a subtarget may be a forked Node process. Introducing such a domain would remove a need to separately connect to forked instances.
Current proposal is to introduce a dedicated inspector pipe between parent and child process (in addition to current ipc pipe). This way there will be no need to look for a free port and to start up inspector HTTP server in every subprocess.
The text was updated successfully, but these errors were encountered: