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

Python Test spawning infinite Pipenv processes #24654

Open
rodrigocaus opened this issue Dec 23, 2024 · 3 comments
Open

Python Test spawning infinite Pipenv processes #24654

rodrigocaus opened this issue Dec 23, 2024 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed Needs assignment to the proper sub-team

Comments

@rodrigocaus
Copy link

Type: Bug

Behaviour

On Python test discovery, several instances of Pipenv are spawned, looking like a nested sequence of fork calls. Closing the VSCode session does not solve.

Here is a print-screen of the Process Explorer:
Image

The root command is:

/usr/bin -c . ~/.local/share/virtualenvs/suggestion-service-9KXSQYLP/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2024.22.0-linux-x64/python_files/printEnvVariables.py

As a result of this, the computer's memory usage is exceeded and completely freezes my computer, requiring a restart. Several calls to pkill -9 pipenv could prevent the freezing if the problem is previously detected.

Steps to reproduce:

  1. Set a pipenv Python interpreter
  2. Click on Testing badge
  3. Click on Refresh Tests

Diagnostic data

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

2024-12-23 19:34:26.164 [warning] Dir "/mnt/projects/suggestion-service/.pixi/envs" is not watchable (directory does not exist)
2024-12-23 19:34:26.164 [info] Starting Environment refresh
2024-12-23 19:34:26.164 [info] > hatch env show --json
2024-12-23 19:34:26.164 [info] cwd: .
2024-12-23 19:34:26.164 [info] Python interpreter path: ~/.local/share/virtualenvs/suggestion-service-9KXSQYLP/bin/python
2024-12-23 19:34:26.184 [info] > ~/.pyenv/bin/pyenv which python
2024-12-23 19:34:26.184 [info] cwd: .
2024-12-23 19:34:26.207 [info] > conda info --json
2024-12-23 19:34:26.211 [info] > /usr/share/anaconda/bin/conda info --json
2024-12-23 19:34:26.240 [info] > ~/.local/share/virtualenvs/suggestion-service-9KXSQYLP/bin/python -I ~/.vscode/extensions/ms-python.python-2024.22.0-linux-x64/python_files/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.22.0-linux-x64/python_files/interpreterInfo.py
2024-12-23 19:34:26.240 [info] Environments refresh paths discovered: 303 milliseconds
2024-12-23 19:34:26.259 [info] Environments refresh finished (event): 322 milliseconds
2024-12-23 19:34:26.263 [info] Environment refresh took 326 milliseconds
2024-12-23 19:34:36.430 [info] Starting Pylance language server.
2024-12-23 19:34:55.874 [info] Discover tests for workspace name: suggestion-service - uri: /mnt/2e000f48-be9a-447b-ad40-3e648af86fc5/gobots/projects/suggestion-service
2024-12-23 19:34:55.888 [info] > . ~/.local/share/virtualenvs/suggestion-service-9KXSQYLP/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2024.22.0-linux-x64/python_files/printEnvVariables.py
2024-12-23 19:34:55.888 [info] shell: bash
2024-12-23 19:35:23.523 [info] > ~/.local/share/virtualenvs/suggestion-service-9KXSQYLP/bin/python ~/.vscode/extensions/ms-python.python-2024.22.0-linux-x64/python_files/testing_tools/run_adapter.py discover pytest -- --rootdir . -s --cache-clear tests
2024-12-23 19:35:23.523 [info] cwd: .

Extension version: 2024.22.0
VS Code version: Code 1.96.2 (fabdb6a30b49f79a7aba0f2ad9df9b399473380f, 2024-12-19T10:22:47.216Z)
OS version: Linux x64 6.12.5-200.fc41.x86_64
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.12.8
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): PipEnv
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Pylance"

testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true

terminal
• activateEnvironment: false

Installed Extensions
Extension Name Extension Id Version
autopep8 ms-python.autopep8 2024.0.0
Continue - Codestral, Claude, and more Continue.continue 0.8.66
Dev Containers ms-vscode-remote.remote-containers 0.394.0
Docker ms-azuretools.vscode-docker 1.29.3
Excel Viewer GrapeCity.gc-excelviewer 4.2.62
GitHub Theme GitHub.github-vscode-theme 6.3.5
GitLab Workflow GitLab.gitlab-workflow 5.25.1
JavaScript Debugger ms-vscode.js-debug 1.96.0
JavaScript Debugger Companion Extension ms-vscode.js-debug-companion 1.1.3
Jupyter ms-toolsai.jupyter 2024.11.0
Jupyter Cell Tags ms-toolsai.vscode-jupyter-cell-tags 0.1.9
Jupyter Keymap ms-toolsai.jupyter-keymap 1.1.2
Jupyter Notebook Renderers ms-toolsai.jupyter-renderers 1.0.21
Jupyter Slide Show ms-toolsai.vscode-jupyter-slideshow 0.1.6
Kubernetes ms-kubernetes-tools.vscode-kubernetes-tools 1.3.18
LaTeX Workshop James-Yu.latex-workshop 10.7.0
Pylance ms-python.vscode-pylance 2024.12.1
Python ms-python.python 2024.22.0
Python Debugger ms-python.debugpy 2024.14.0
Rainbow CSV mechatroner.rainbow-csv 3.13.0
shell-format foxundermoon.shell-format 7.2.5
Table Visualizer for JavaScript Profiles ms-vscode.vscode-js-profile-table 1.0.10
YAML redhat.vscode-yaml 1.15.0
System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i5-13600K (20 x 4846)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
webnn: disabled_off
Load (avg) 1, 1, 1
Memory (System) 31.07GB (23.43GB free)
Process Argv --crash-reporter-id 9c46c9df-143c-4910-8123-8af7b0289af2
Screen Reader no
VM 0%
DESKTOP_SESSION gnome
XDG_CURRENT_DESKTOP GNOME
XDG_SESSION_DESKTOP gnome
XDG_SESSION_TYPE wayland
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Dec 23, 2024
@karthiknadig
Copy link
Member

This seems like something might be broken with the activation script for that pipenv environment. Does running the activation script from an external terminal work?

@karthiknadig karthiknadig self-assigned this Dec 24, 2024
@karthiknadig karthiknadig added the bug Issue identified by VS Code Team member as probable bug label Dec 24, 2024
@github-actions github-actions bot added the info-needed Issue requires more information from poster label Dec 24, 2024
@rodrigocaus
Copy link
Author

I've ran the activation scripts from an external terminal (Gnome Ptyxis):

$ pipenv shell # from the project folder
$ source /home/rodrigocaus/.local/share/virtualenvs/suggestion-service-9KXSQYLP/bin/activate
$ . /home/rodrigocaus/.local/share/virtualenvs/suggestion-service-9KXSQYLP/bin/activate
$ bash -c  ". /home/rodrigocaus/.local/share/virtualenvs/suggestion-service-9KXSQYLP/bin/activate"

They all worked without any problems.

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Dec 24, 2024
@rodrigocaus
Copy link
Author

rodrigocaus commented Dec 24, 2024

I've set the Python extension log level to trace, and I received the output:

2024-12-24 10:09:29.455 [debug] Activation Commands received source /home/rodrigocaus/.local/share/virtualenvs/suggestion-service-9KXSQYLP/bin/activate for shell bash, resource /mnt/2e000f48-be9a-447b-ad40-3e648af86fc5/gobots/projects/suggestion-service and interpreter /home/rodrigocaus/.local/share/virtualenvs/suggestion-service-9KXSQYLP/bin/python
2024-12-24 10:09:29.455 [debug] Activating Environment to capture Environment variables, . /home/rodrigocaus/.local/share/virtualenvs/suggestion-service-9KXSQYLP/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python /home/rodrigocaus/.vscode/extensions/ms-python.python-2024.22.0-linux-x64/python_files/printEnvVariables.py
2024-12-24 10:09:29.455 [info] > . ~/.local/share/virtualenvs/suggestion-service-9KXSQYLP/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2024.22.0-linux-x64/python_files/printEnvVariables.py
2024-12-24 10:09:29.455 [info] shell: bash
2024-12-24 10:09:59.458 [error] getActivatedEnvironmentVariables [Error: Command failed: . /home/rodrigocaus/.local/share/virtualenvs/suggestion-service-9KXSQYLP/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python /home/rodrigocaus/.vscode/extensions/ms-python.python-2024.22.0-linux-x64/python_files/printEnvVariables.py

	at genericNodeError (node:internal/errors:984:15)
	at wrappedFn (node:internal/errors:538:14)
	at ChildProcess.exithandler (node:child_process:423:12)
	at ChildProcess.emit (node:events:530:35)
	at maybeClose (node:internal/child_process:1104:16)
	at ChildProcess._handle.onexit (node:internal/child_process:304:5)] {
  code: null,
  killed: true,
  signal: 'SIGTERM',
  cmd: ". /home/rodrigocaus/.local/share/virtualenvs/suggestion-service-9KXSQYLP/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python /home/rodrigocaus/.vscode/extensions/ms-python.python-2024.22.0-linux-x64/python_files/printEnvVariables.py"
}
2024-12-24 10:09:59.471 [info] > ~/.local/share/virtualenvs/suggestion-service-9KXSQYLP/bin/python ~/.vscode/extensions/ms-python.python-2024.22.0-linux-x64/python_files/testing_tools/run_adapter.py discover pytest -- --rootdir . -s --cache-clear tests
2024-12-24 10:09:59.472 [info] cwd: .

This is the first time I received the [error] getActivatedEnvironmentVariables message. Even after the error, several instances of Pipenv keep spawning. I can only kill them using pkill.

Running the same command:

. /home/rodrigocaus/.local/share/virtualenvs/suggestion-service-9KXSQYLP/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python /home/rodrigocaus/.vscode/extensions/ms-python.python-2024.22.0-linux-x64/python_files/printEnvVariables.py

on an external terminal work just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants