coder / code-server

VS Code in the browser
https://coder.com
MIT License
66.51k stars 5.45k forks source link

code server interactive window takes forever to load #6766

Closed mvpp closed 2 months ago

mvpp commented 2 months ago

Is there an existing issue for this?

OS/Web Information

Steps to Reproduce

  1. I installed code server on my ec2 instance mannually and then installed the python and jupyter extension.
  2. I can use it as an coding IDE without problems. but when I tried to click the new jupyter notebook. It took forever to load.
  3. Tried uninstalled and reinstalled jupyter extension. Tried installing older versions. Didn't solve the issue.
  4. Tried restart nginx (reverse proxy) and restart code-server. Didn't solve the issue.
  5. I thought it's a jupyter or python environment issue so I installed the latest anaconda as well. I selected a conda python kernal during the loading. Didn't solve the issue.
  6. OK I thought maybe it's not about jupyter. So I created a hello.py file which only have print("hello") in it. In the upper right corner of the editor I clicked the Run Current File in Interactive Window. No jupyter involvement. It also takes forever to load.
  7. Tried the recommendation here but still no luck.
  8. It looks like something got timeout. I pasted the python output in the Logs section.

Expected

I expect the interactive window loads quickly

Actual

It got timeout.

Logs

024-04-19 18:18:39.058 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-04-19 18:18:39.058 [info] Experiment 'pythonREPLSmartSend' is active
2024-04-19 18:18:39.058 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-04-19 18:18:39.058 [info] Experiment 'pythonTestAdapter' is active
2024-04-19 18:18:39.058 [info] Default formatter is set to null for workspace /home/ubuntu/python
2024-04-19 18:18:39.058 [info] Test server listening.
2024-04-19 18:18:39.058 [info] > conda info --json
2024-04-19 18:18:39.058 [info] Python interpreter path: ~/anaconda3/envs/myenv/bin/python
2024-04-19 18:18:39.289 [info] > ~/.pyenv/bin/pyenv which python
2024-04-19 18:18:39.289 [info] cwd: .
2024-04-19 18:18:39.776 [info] > conda info --json
2024-04-19 18:18:39.776 [info] shell: bash
2024-04-19 18:18:42.726 [info] > conda run -n myenv --no-capture-output python ~/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/get_output_via_markers.py ~/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/printEnvVariables.py
2024-04-19 18:18:42.726 [info] shell: bash
2024-04-19 18:18:42.754 [info] > conda run -n myenv --no-capture-output python ~/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/get_output_via_markers.py ~/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/printEnvVariables.py
2024-04-19 18:18:42.754 [info] shell: bash
2024-04-19 18:18:43.392 [info] Starting Jedi language server for python.
2024-04-19 18:18:43.868 [info] Discover tests for workspace name: python - uri: /home/ubuntu/python/.vscode/hello.py
2024-04-19 18:18:44.891 [info] > /usr/bin/python ~/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/printEnvVariables.py
2024-04-19 18:18:44.891 [info] shell: bash
2024-04-19 18:18:44.990 [info] Setting environment variable GSETTINGS_SCHEMA_DIR in collection to /home/ubuntu/anaconda3/envs/myenv/share/glib-2.0/schemas {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-04-19 18:18:44.990 [info] Setting environment variable CONDA_ROOT in collection to /home/ubuntu/anaconda3 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-04-19 18:18:44.990 [info] Setting environment variable CONDA_PREFIX in collection to /home/ubuntu/anaconda3/envs/myenv {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-04-19 18:18:44.990 [info] Setting environment variable CONDA_PROMPT_MODIFIER in collection to (myenv)  {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-04-19 18:18:44.990 [info] Setting environment variable CONDA_SHLVL in collection to 2 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-04-19 18:18:44.990 [info] Setting environment variable CONDA_DEFAULT_ENV in collection to myenv {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-04-19 18:18:44.990 [info] Prepending environment variable PATH in collection to /usr/lib/code-server/lib/vscode/bin/remote-cli:/home/ubuntu/.local/bin:/home/ubuntu/anaconda3/envs/myenv/bin:/home/ubuntu/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/usr/local/cuda/bin: {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-04-19 18:18:44.990 [info] Setting environment variable CONDA_PREFIX_1 in collection to /home/ubuntu/anaconda3 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-04-19 18:18:44.990 [info] Prepending environment variable PS1 in collection with (myenv)  {"applyAtShellIntegration":true,"applyAtProcessCreation":false}
2024-04-19 18:18:44.992 [info] Send text to terminal: /usr/bin/python /home/ubuntu/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/printEnvVariablesToFile.py /home/ubuntu/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/deactivate/bash/envVars.txt
2024-04-19 18:18:48.315 [info] Discover tests for workspace name: python - uri: /home/ubuntu/python/.vscode/hello.py
2024-04-19 18:18:54.487 [info] > hatch env show --json
2024-04-19 18:18:54.487 [info] cwd: .
2024-04-19 18:18:54.542 [info] Found: /usr/bin/python --> /usr/bin/python2.7
2024-04-19 18:18:54.596 [info] Found: /usr/bin/python2 --> /usr/bin/python2.7
2024-04-19 18:18:54.596 [info] Found: /usr/bin/python2.7 --> /usr/bin/python2.7
2024-04-19 18:18:54.607 [info] > /usr/bin/python3.12 -I ~/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/get_output_via_markers.py ~/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/interpreterInfo.py
2024-04-19 18:18:54.608 [info] Found: /usr/bin/python3 --> /usr/bin/python3.8
2024-04-19 18:18:54.616 [info] Found: /usr/bin/python3.11 --> /usr/bin/python3.11
2024-04-19 18:18:54.617 [info] Found: /usr/bin/python3.12 --> /usr/bin/python3.12
2024-04-19 18:18:54.621 [info] Found: /usr/bin/python3.8 --> /usr/bin/python3.8
2024-04-19 18:18:54.649 [info] > ~/anaconda3/bin/python -I ~/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/get_output_via_markers.py ~/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/interpreterInfo.py
2024-04-19 18:18:54.694 [info] Found: /home/ubuntu/anaconda3/bin/python --> /home/ubuntu/anaconda3/bin/python3.11
2024-04-19 18:18:54.694 [info] Found: /home/ubuntu/anaconda3/bin/python3 --> /home/ubuntu/anaconda3/bin/python3.11
2024-04-19 18:18:54.694 [info] Found: /home/ubuntu/anaconda3/bin/python3.1 --> /home/ubuntu/anaconda3/bin/python3.11
2024-04-19 18:18:54.694 [info] Found: /home/ubuntu/anaconda3/bin/python3.11 --> /home/ubuntu/anaconda3/bin/python3.11
2024-04-19 18:18:54.766 [info] > ~/anaconda3/envs/myenv/bin/python -I ~/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/get_output_via_markers.py ~/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/interpreterInfo.py
2024-04-19 18:18:54.814 [info] > /usr/bin/python -I ~/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/get_output_via_markers.py ~/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/interpreterInfo.py
2024-04-19 18:18:54.825 [info] > /usr/bin/python3 -I ~/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/get_output_via_markers.py ~/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/interpreterInfo.py
2024-04-19 18:18:54.832 [warning] [Error: Command failed: /usr/bin/python -I /home/ubuntu/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/get_output_via_markers.py /home/ubuntu/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/interpreterInfo.py
Unknown option: -I
usage: /usr/bin/python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Try `python -h' for more information.

    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:529:35)
    at maybeClose (node:internal/child_process:1098:16)
    at ChildProcess._handle.onexit (node:internal/child_process:303:5)] {
  code: 2,
  killed: false,
  signal: null,
  cmd: '/usr/bin/python -I /home/ubuntu/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/get_output_via_markers.py /home/ubuntu/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/interpreterInfo.py'
}
2024-04-19 18:18:54.832 [error] Support for Python 2.7 has been dropped by the Python extension so certain features may not work, upgrade to using Python 3.
2024-04-19 18:18:54.843 [info] > /usr/bin/python ~/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/get_output_via_markers.py ~/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/interpreterInfo.py
2024-04-19 18:18:54.936 [info] > /usr/bin/python3.11 -I ~/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/get_output_via_markers.py ~/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/interpreterInfo.py
2024-04-19 18:19:14.992 [error] Failed to initialize deactivate script /bin/bash [Error: "/home/ubuntu/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/deactivate/bash/envVars.txt" file not created
    at Timeout.<anonymous> (/home/ubuntu/.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/out/client/extension.js:2:271175)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)]

Screenshot/Video

No response

Does this bug reproduce in native VS Code?

I did not test native VS Code

Does this bug reproduce in GitHub Codespaces?

I did not test GitHub Codespaces

Are you accessing code-server over a secure context?

Notes

No response

code-asher commented 2 months ago

Looks like it wants Python 3, not Python 2.7. I imagine -I must be a new option for Python 3.

Unknown option: -I
Support for Python 2.7 has been dropped by the Python extension so certain features may not work, upgrade to using Python 3.
mvpp commented 2 months ago

Looks like it wants Python 3, not Python 2.7. I imagine -I must be a new option for Python 3.

Unknown option: -I
Support for Python 2.7 has been dropped by the Python extension so certain features may not work, upgrade to using Python 3.

I agree it's causing an error but I'm not sure if that's the problem causing the timeout. I launched a new ubuntu 20.04 instance with only python3 installed, when I tried to open the interactive window, it still got stuck.

In the output, I didn't see any error in the python output, but it's not moving after:

2024-04-22 20:23:09.093 [info] > hatch env show --json
2024-04-22 20:23:09.093 [info] cwd: .
2024-04-22 20:23:09.115 [info] Found: /bin/python3 --> /bin/python3.8
2024-04-22 20:23:09.116 [info] Found: /bin/python3.8 --> /bin/python3.8
2024-04-22 20:23:09.136 [info] Found: /usr/bin/python3 --> /usr/bin/python3.8
2024-04-22 20:23:09.137 [info] Found: /usr/bin/python3.8 --> /usr/bin/python3.8
2024-04-22 20:23:09.144 [info] > /bin/python3 -I ./.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/get_output_via_markers.py ./.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/interpreterInfo.py
2024-04-22 20:23:09.408 [info] > /usr/bin/python3 -I ./.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/get_output_via_markers.py ./.local/share/code-server/extensions/ms-python.python-2024.4.1-universal/python_files/interpreterInfo.py

Below is the output of extension host (remote):

2024-04-23 04:16:40.471 [info] Extension host with pid 265170 started
2024-04-23 04:16:40.524 [info] Lock '/home/ubuntu/.local/share/code-server/User/workspaceStorage/-1b53b4a2/vscode.lock': Lock acquired.
2024-04-23 04:16:40.646 [info] ExtensionService#_doActivateExtension ms-python.python, startup: false, activationEvent: 'onLanguage:python', root cause: ms-python.debugpy
2024-04-23 04:16:40.648 [info] ExtensionService#_doActivateExtension ms-toolsai.jupyter, startup: false, activationEvent: 'onLanguage:python'
2024-04-23 04:16:40.657 [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onLanguage'
2024-04-23 04:16:43.375 [info] ExtensionService#_doActivateExtension vscode.git-base, startup: true, activationEvent: '*', root cause: vscode.git
2024-04-23 04:16:43.439 [info] ExtensionService#_doActivateExtension vscode.tunnel-forwarding, startup: false, activationEvent: 'onTunnel'
2024-04-23 04:16:45.208 [error] PortAttributesProvider must specify either a portRange or a commandPattern
2024-04-23 04:16:45.243 [info] ExtensionService#_doActivateExtension ms-toolsai.jupyter-renderers, startup: false, activationEvent: 'api', root cause: ms-toolsai.jupyter
2024-04-23 04:16:45.305 [info] ExtensionService#_doActivateExtension vscode.git, startup: true, activationEvent: '*'
2024-04-23 04:16:45.305 [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '*'
2024-04-23 04:16:45.931 [info] ExtensionService#_doActivateExtension ms-python.debugpy, startup: false, activationEvent: 'onLanguage:python'
2024-04-23 04:16:46.239 [info] Eager extensions activated
2024-04-23 04:16:46.239 [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: false, activationEvent: 'onStartupFinished'
2024-04-23 04:16:46.240 [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
2024-04-23 04:16:52.946 [info] ExtensionService#_doActivateExtension vscode.ipynb, startup: false, activationEvent: 'onNotebookSerializer:interactive'

In the output of Window, I got the below error:

2024-04-22 21:06:31.619 [info] [remote-connection][Management   ][dcbac…][reconnect] reconnected!
2024-04-22 21:23:58.220 [error] [Extension Host] Lintings failed on open
2024-04-22 21:23:58.220 [error] [Extension Host] File: file:///home/rstudio/python_code/test.py
2024-04-22 21:23:58.220 [error] [Extension Host] Message: TypeError: Cannot read properties of undefined (reading 'uri')
2024-04-22 21:24:02.582 [error] 'crypto.subtle' is not available so webviews will not work. This is likely because the editor is not running in a secure context (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).: Error: 'crypto.subtle' is not available so webviews will not work. This is likely because the editor is not running in a secure context (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).
    at T (http://ec2-xxx.us-west-1.compute.amazonaws.com/vscode/stable-9a28bc29dbddb6886dfe03dc1c31320249a901ce/static/out/vs/workbench/workbench.web.main.js:4:4754)
    at M.mountTo (http://ec2-xxx.us-west-1.compute.amazonaws.com/vscode/stable-9a28bc29dbddb6886dfe03dc1c31320249a901ce/static/out/vs/workbench/workbench.web.main.js:1229:23611)
    at K.nb (http://ec2-xxx.us-west-1.compute.amazonaws.com/vscode/stable-9a28bc29dbddb6886dfe03dc1c31320249a901ce/static/out/vs/workbench/workbench.web.main.js:1904:1409)
    at K.createWebview (http://ec2-xxx.us-west-1.compute.amazonaws.com/vscode/stable-9a28bc29dbddb6886dfe03dc1c31320249a901ce/static/out/vs/workbench/workbench.web.main.js:1904:859)
    at http://ec2-xxx.us-west-1.compute.amazonaws.com/vscode/stable-9a28bc29dbddb6886dfe03dc1c31320249a901ce/static/out/vs/workbench/workbench.web.main.js:2716:7616
    at Oe.rc (http://ec2-xxx.us-west-1.compute.amazonaws.com/vscode/stable-9a28bc29dbddb6886dfe03dc1c31320249a901ce/static/out/vs/workbench/workbench.web.main.js:2716:8062)
    at Oe.yc (http://ec2-xxx.us-west-1.compute.amazonaws.com/vscode/stable-9a28bc29dbddb6886dfe03dc1c31320249a901ce/static/out/vs/workbench/workbench.web.main.js:2716:11960)
    at Oe.tc (http://ec2-xxx.us-west-1.compute.amazonaws.com/vscode/stable-9a28bc29dbddb6886dfe03dc1c31320249a901ce/static/out/vs/workbench/workbench.web.main.js:2716:10495)
    at Oe.setModel (http://ec2-xxx.us-west-1.compute.amazonaws.com/vscode/stable-9a28bc29dbddb6886dfe03dc1c31320249a901ce/static/out/vs/workbench/workbench.web.main.js:2716:4151)
    at oe.setInput (http://ec2-xxx.us-west-1.compute.amazonaws.com/vscode/stable-9a28bc29dbddb6886dfe03dc1c31320249a901ce/static/out/vs/workbench/workbench.web.main.js:2754:2762)

To this point I think it's due to [error] 'crypto.subtle' is not available so webviews will not work. It looks like it's because I didn't use HTTPS for my code server?

code-asher commented 2 months ago

Ahhhhhhhhhh right yeah that makes sense. The Jupyter window uses web views, VS Code uses crypto.subtle in their web views, and crypto.subtle is only available in a secure context.