-
Notifications
You must be signed in to change notification settings - Fork 30k
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
The script under the system user continues to run after closing the terminal. #94877
Comments
I can reproduce the issue you're seeing when I run this first
|
Not sure what |
here are the logs when I kill the terminal with the context menu action:
state 5 just indicates killed by user |
I believe this is an upstream node-pty issue |
Thats actually expected behavior. The culprit behind is the sudo move - the POSIX permissions system is meant to disallow any process manipulations from an under privileged account, thus closing the PTY cannot clean sudo'ed child processes via SIGHUP. |
@jerch, if this is the expected behavior, then why doesn't it happen when we work, for example, with the default terminal for Ubuntu 20.04? |
@KostyaTretyak I cannot tell you that. But have a few hints/remarks for that issue: In principle there are two ways to tear down a child process tree behind a PTY - first send the session leader (first program on the pty) SIGHUP by yourself. That signal will bubble through the children (if the session leader cooperates), but cannot pass the user permission border, as it was created by the user of the pty process. Thus the kernel wont deliver it to sudo'ed processes. A second more robust way is to let the kernel create that signal in the first place, e.g. by simply closing the PTY master end. That second method has one big advantage - it can cross user permission borders, since it comes from the kernel itself (who is allowed to do anything anyway). So my guess is - vscode prolly uses method 1, while your default ubuntu terminal uses method 2 (or even both of them)? |
No, I think it's true bug, and it was not worth closing this issue. |
Tried to give you an explanation to your "why..." question. In that context your "No, I think it's true bug" makes absolutely no sense without any further explanation from your side. Geez, why do I even care to explain things... |
@jerch, your explanation did not seem logical to me. |
Steps to Reproduce:
1. create
index.js
script for node server:2. in VS Code integrated terminal, login under system user, in my case it's
node-user
:3. run the script:
4. from second terminal, check work:
response:
5. kill first integrated terminal or close VS Code
6. check work and the script continues to work:
response:
P.S. To kill the process, run:
The text was updated successfully, but these errors were encountered: