X Tutup
The Wayback Machine - https://web.archive.org/web/20220510115931/https://github.com/nodejs/node/issues/42446
Skip to content
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

Ability to stop debugger listening #42446

Closed
ecalcutin opened this issue Mar 23, 2022 · 6 comments
Closed

Ability to stop debugger listening #42446

ecalcutin opened this issue Mar 23, 2022 · 6 comments
Labels
feature request

Comments

@ecalcutin
Copy link

@ecalcutin ecalcutin commented Mar 23, 2022

What is the problem this feature will solve?

If main process receives SIGUSR1 then there are no way to stop debugger from listening new connections

What is the feature you are proposing to solve the problem?

An additional NodeJS reserved signal should be ideal to stop listenning debugger.

What alternatives have you considered?

No response

@ecalcutin ecalcutin added the feature request label Mar 23, 2022
@ecalcutin
Copy link
Author

@ecalcutin ecalcutin commented Mar 23, 2022

Here is a example how I start debugger for listening new connections:

@Get('/signal/:signal')
async makeSignal(@Param('signal') signal: string) {
  process.kill(process.pid, signal);
}

If endpoing receives SIGUSR1 signal then debugger is started.
Would be nice if we have another COOL_SIGNAL to stop debugger.

@bnoordhuis
Copy link

@bnoordhuis bnoordhuis commented Mar 24, 2022

You can use the open() and close() methods from require('inspector') to start and stop the debugger manually.

An additional NodeJS reserved signal should be ideal to stop listenning debugger.

I don't think there are any general purpose signals left for node to claim. SIGUSR2, for example, is in use by at least two popular modules.

@ecalcutin
Copy link
Author

@ecalcutin ecalcutin commented Mar 24, 2022

You can use the open() and close() methods from require('inspector') to start and stop the debugger manually.

An additional NodeJS reserved signal should be ideal to stop listenning debugger.

I don't think there are any general purpose signals left for node to claim. SIGUSR2, for example, is in use by at least two popular modules.

Then I am curious to know what are use cases to use SIGUSR1 or inspector module?
When to use SIGUSR1 and when to use inspector

@bnoordhuis
Copy link

@bnoordhuis bnoordhuis commented Mar 26, 2022

The inspector module is for programmatic access to the debugger, what you are doing. SIGUSR1 is for non-programmatic access.

@theanarkh
Copy link

@theanarkh theanarkh commented Mar 28, 2022

"SIGUSR1" can work in the following situations:
while(1) {}.

@ecalcutin
Copy link
Author

@ecalcutin ecalcutin commented Apr 5, 2022

"SIGUSR1" can work in the following situations: while(1) {}.

Thanks @theanarkh. This is a great example of SIGUSR1 usage.

@ecalcutin ecalcutin closed this Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request
Projects
Status: Pending Triage
Development

No branches or pull requests

3 participants
X Tutup