Skip to content

python process will be killed when project window activating conda environment #25009

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

Closed
XZLancer opened this issue Apr 24, 2025 · 4 comments
Closed
Assignees
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@XZLancer
Copy link

XZLancer commented Apr 24, 2025

Type: Bug

Behaviour

I encounterd a weird problem, whenever I open a project window (with remote-SSH), normally, a conda environment starts activating, but at this time the processes using the conda environments (other environments and the activating one) will be killed. Such processes include pytorch training, jupyter notebook and even conda install command.

I'm using VS code 1.99.3, the latest python extensions and the latest anaconda. Thanks for any help.

Steps to reproduce:

  1. For example, open a project window and start a python process, then reload this window. At that time I can see the process be killed. I have checked dmesg | grep kill, it is not a resouce limitation problem.

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

The only error I see in `Output-Pyhon` is below:

[error] Failed to initialize deactivate script /bin/bash [Error: "/home/user/.vscode-server/extensions/ms-python.python-2025.4.0-linux-x64/python_files/deactivate/bash/envVars.txt" file not created
	at Timeout.<anonymous> (/home/user/.vscode-server/extensions/ms-python.python-2025.4.0-linux-x64/out/client/extension.js:2:310591)
	at listOnTimeout (node:internal/timers:581:17)
	at process.processTimers (node:internal/timers:519:7)]

Extension version: 2025.4.0
VS Code version: Code 1.99.3 (17baf841131aa23349f217ca7c570c76ee87b957, 2025-04-15T23:18:46.076Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Remote OS version: Linux x64 5.4.0-212-generic
Remote OS version: Linux x64 5.4.0-204-generic
Remote OS version: Linux x64 5.4.0-204-generic

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Apr 24, 2025
@XZLancer
Copy link
Author

I found the error message in Output-Server when the crash happens:

[error] [File Watcher] Inotify limit reached (ENOSPC) (path: /home/user/anaconda3/envs/torch-latest/lib/python3.9)

and the error in Output-Jupyter(The following is the complete log, there is no information after 'Reason:'):

[error] Disposing session as kernel process died ExitCode: undefined, Reason:

Is there any other useful information I can provide?

@karthiknadig
Copy link
Member

@DonJayamanne Is this something that Jupyter needs to investigate?

@karthiknadig karthiknadig self-assigned this Apr 30, 2025
@github-actions github-actions bot added the info-needed Issue requires more information from poster label Apr 30, 2025
@DonJayamanne
Copy link

DonJayamanne commented May 1, 2025

then reload this window. At that time I can see the process be killed

This is expected. f you reload VSCode, then all processes started by VS Code will be killed.
Same with Jupyter kernels and the like.

The only process that survive reloading VS Code are terminal sessions.
https://code.visualstudio.com/docs/terminal/advanced#_persistent-sessions

If you want Jupyter Kernels in VS Code Notebooks to persist, then please upvote & follow this issue microsoft/vscode-jupyter#3998

@karthiknadig
Not sure what the following error means though
Failed to initialize deactivate script /bin/bash [Error: "/home/user/.vscode-server/extensions/ms-python.python-2025.4.0-linux-x64/python_files/deactivate/bash/envVars.txt" file not created at Timeout.<anonymous> (/home/user/.vscode-server/extensions/ms-python.python-20

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label May 1, 2025
@XZLancer
Copy link
Author

XZLancer commented May 7, 2025

This is expected. f you reload VSCode, then all processes started by VS Code will be killed.

The process not related to VS Code (e.g. a shell command like python script.py in a standalone terminal) will also be killed when a VS Code window starts activating environment.

However, this problem suddenly disappeared after a few days, during which time VS Code and extensions were not updated. Maybe it's a system problem, I will close the issue, thank you for your attention

@XZLancer XZLancer closed this as completed May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

3 participants