code-server
code-server copied to clipboard
[Bug]: Terminal bash process doesn't exit when vscode page in the browser closed
Is there an existing issue for this?
- [X] I have searched the existing issues
OS/Web Information
- Web Browser: Chrome
- Local OS: Windows 10
- Remote OS: Ubuntu
- Remote Architecture: amd64
-
code-server --version
: v4.10.1
Steps to Reproduce
- open code-server
- open vscode page in chrome
- open bash terminal in vscode Terminal panel
- close vscode page
- ps -ef to show process
Expected
bash process closed
Actual
bash process still active
Logs
No response
Screenshot/Video
No response
Does this issue happen in VS Code or GitHub Codespaces?
- [X] I cannot reproduce this in VS Code.
- [X] I cannot reproduce this in GitHub Codespaces.
Are you accessing code-server over HTTPS?
- [X] I am using HTTPS.
Notes
No response
The directory is a mount point of a ceph rbd device, opened in vscode and bash terminal. the diectory umounted by umount -l and removed. After the vscode web page closed, the bash process is still active and hold the directory node. The rbd device cannot be unmaped by rbd unmap.
Yup, this is by design, I believe they remain active to support reconnecting when the network is interrupted.
They should get cleaned up after some timeout.
Could it be set to kill the terminals belong to the vscode page when the web page closed? I find there is a button named "Kill Terminal" at the terminal panel upper right corner.
I took a brief look at the settings but I did not see anything for disabling that behavior. It could be raised upstream to VS Code as a feature request.
Is there a particular bug/error you are trying to avoid by disabling the persistence? If so that could help the make the case that there should be a toggle for this.
I took a brief look at the settings but I did not see anything for disabling that behavior. It could be raised upstream to VS Code as a feature request. Is there a particular bug/error you are trying to avoid by disabling the persistence? If so that could help the make the case that there should be a toggle for this.
I have tried to kill the bash process belongs to the vscode page when I try to umount and unmap the device. After killed the bash process, the device could be umount and unmapped successfully.
I also agree to this use-case. A simple example is running some sort of web dev server in-terminal and closing the tab, and code-server still running the web server in the background.
Sorry to bump this after half a year but i just stubled upon this issue myself.
There is a feature in vscode called Persistent Sessions which can be turned off. But even with this turned off the terminal process keeps running. And now that vscode does not try to reattach to this running process it will spawn a new one every time you open the terminal.
I just tested it on code-server 4.20.0 d0215eca8804d0be5d3551c39404e336032c3141 with Code 1.85.1
My usecase also involves starting development webservers, so leaving them running on the server would quickly consume too many resources and/or block ports.
Note: this can be worked around by using something like tmux and attaching to the same session every time using a terminal profile, so you notice the dev server is still running
@TheLD6978 Could you try reproducing in Codespaces? It smells like an upstream bug with VS Code. Assuming it reproduces, we should raise the issue to the VS Code folks. If it does not reproduce, I will be very confused. :laughing:
You are correct. I got mutiple shell sessions to stay open by disabling persistent sessions and just closing the tab and re-opening it:
Yup, this is by design, I believe they remain active to support reconnecting when the network is interrupted.
They should get cleaned up after some timeout.
how to set not cleaned up,i do not want end a long time task by web close
I do not believe there is an option to prevent the cleanup. A workaround is to use screen
or tmux
or something similar.
Well, unless you mean a VS Code task and not just a regular terminal, in which case I think there is no workaround.
Closing for now as working as an upstream behavior.