denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
96.77k stars 5.34k forks source link

Support starting inspector through signal #9312

Open lucacasonato opened 3 years ago

lucacasonato commented 3 years ago

In some cases it is useful to be able to start the inspector on an already running process (for example a long running task that you can not easily restart). Deno currently has no infrastructure to support this. Currently the only way to enable the debugger is through --inspect or --inspect-brk.

In Node you can start the inspector on an already running process by sending the process a SIGUSR1 signal. See Node docs: https://nodejs.org/api/process.html#process_signal_events & article on the topic: https://blog.sqreen.com/memory-leaks-nodejs-heroku/.

It would be cool if we supported something like to this.

caspervonb commented 3 years ago

Yeah been thinking this as-well; but with one addition (tangent really), another signal to drop into an interactive session from any run-like command.

JamesKyburz commented 3 years ago

If this was added, then maybe add something similar to node's process._debugProcess to also support windows.

bartlomieju commented 3 years ago

Inspector instance is now created for all isolate, so technically there's nothing preventing us from implementing this feature (which would mean spawning a WS inspector server when signal is received).