microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.61k stars 29.03k forks source link

remote ssh and Jupyter #224117

Closed raminass closed 2 months ago

raminass commented 2 months ago

Type: Performance Issue

After version update, Vscode remote ssh is too slow. variable in notebooks aren't shown instantly and takes a minute to load them each time I select the Jupyter tab.

VS Code version: Code 1.91.1 (Universal) (f1e16e1e6214d7c44d078b1f0607b2388f29d729, 2024-07-09T22:07:54.982Z) OS version: Darwin arm64 22.2.0 Modes: Remote OS version: Linux x64 5.4.0-73-generic

System Info |Item|Value| |---|---| |CPUs|Apple M1 Pro (10 x 2400)| |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: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|3, 3, 2| |Memory (System)|16.00GB (0.10GB free)| |Process Argv|--crash-reporter-id e7b8bd20-3b18-4e5b-acc0-9173db64ee20| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|SSH: c-003| |OS|Linux x64 5.4.0-73-generic| |CPUs|Intel(R) Core(TM) i7-6900K CPU @ 3.20GHz (16 x 3697)| |Memory (System)|62.73GB (22.35GB free)| |VM|0%|
Process Info ``` CPU % Mem MB PID Process 11 197 80382 code main 5 82 80385 gpu-process 0 49 80386 utility-network-service 57 410 80387 window [1] (12_HEK_networks.ipynb — CLIP-MUSE [SSH: c-003]) 4 246 80422 extensionHost [1] 0 66 80430 ptyHost 0 0 80432 /bin/sh -c ssh -T -D 57920 -o ConnectTimeout=15 'c-003' bash << 'EOSSH'\012\012echo "e6b320840ca3: running"\012\012#\012# Setup\012#\012VSC_TMP="${XDG_RUNTIME_DIR:-`echo /tmp`}"\012COMMIT_ID="f1e16e1e6214d7c44d078b1f0607b2388f29d729"\012SERVER_APP_NAME="code-server"\012TELEMETRY="--telemetry-level all"\012export VSCODE_AGENT_FOLDER='/home/bnet/raminasser'/.vscode-server\012ALLOW_CLIENT_DOWNLOAD="1"\012FORCE_CLIENT_DOWNLOAD="0"\012\012CLI_NAME_IN_ARCHIVE=code\012CLI_NAME_ON_DISK="$CLI_NAME_IN_ARCHIVE-$COMMIT_ID"\012CLI_PATH="$VSCODE_AGENT_FOLDER/$CLI_NAME_ON_DISK"\012CLI_LOG_FILE="$VSCODE_AGENT_FOLDER/.cli.$COMMIT_ID.log"\012\012now=`date +%s`\012\012PORT_FLAG=--port=0\012\012UNPACK_RESULT=\012DID_LOCAL_DOWNLOAD=0\012DOWNLOAD_TIME=\012INSTALL_TIME=\012SERVER_START_TIME=\012CONNECTION_TOKEN=\012\012\012fail_with_exitcode() {\012\011echo "e6b320840ca3: start"\012\011echo "exitCode==$1=="\012\011echo_common_results\012\011echo "e6b320840ca3: end"\012\011exit 0\012}\012\012echo_common_results() {\012\011echo "listeningOn==$LISTENING_ON=="\012\011echo "osReleaseId==$OSRELEASEID=="\012\011echo "arch==$ARCH=="\012\011echo "vscodeArch==$VSCODE_ARCH=="\012\011echo "bitness==$BITNESS=="\012\011echo "tmpDir==$VSC_TMP=="\012\011echo "platform==$PLATFORM=="\012\011echo "unpackResult==$UNPACK_RESULT=="\012\011echo "didLocalDownload==$DID_LOCAL_DOWNLOAD=="\012\011echo "downloadTime==$DOWNLOAD_TIME=="\012\011echo "installTime==$INSTALL_TIME=="\012\011echo "serverStartTime==$SERVER_START_TIME=="\012\011echo "execServerToken==ffcf97f5-ff1c-4240-92c3-a3f46adb057c=="\012}\012\012millis() {\012\011if [[ $PLATFORM == linux ]]; then\012\011\011echo $(($(date +%s%N)/1000000))\012\011else\012\011\011# Can't get actual millis on mac\012\011\011echo $(($(date +%s)*1000))\012\011fi\012}\012\012elapsed() {\012\011echo $(($(millis) - $1))\012}\012\012if [[ ! -d "$VSCODE_AGENT_FOLDER" ]]; then\012\011mkdir -p "$VSCODE_AGENT_FOLDER"\012\012\011if (( $? > 0 ))\012\011then\012\011\011echo "Creating the server install dir failed..."\012\011\011fail_with_exitcode 34\012\011fi\012fi\012\012printenv_indent() {\012\011echo "printenv:"\012\011printenv | sed 's/^/ /'\012}\012\012#\012# Get OS name\012#\012OSRELEASEID=`cat /etc/os-release 2>/dev/null | grep -a -E '^ID=' | sed 's/^[Ii][Dd]=//g' | sed 's/"//g'`\012if [[ -z $OSRELEASEID ]]\012then\012\011OSRELEASEID=`cat /usr/lib/os-release 2>/dev/null | grep -a -E '^ID=' | sed 's/^[Ii][Dd]=//g' | sed 's/"//g'`\012\011if [[ -z $OSRELEASEID ]]\012\011then\012\011\011OSRELEASEID=`uname -s`\012\011fi\012fi\012\012#\012# Get host platform/architecture\012#\012UNAME=$(uname -s)\012case $UNAME in\012\011Linux) PLATFORM=linux;;\012\011Darwin) PLATFORM=macOS;;\012\011*)\012\011\011echo "Unsupported platform: $UNAME"\012\011\011fail_with_exitcode 35\012\011\011;;\012esac\012\012BITNESS=$(getconf LONG_BIT)\012ARCH=$(uname -m)\012case $ARCH in\012\011x86_64) VSCODE_ARCH="x64";;\012\011armv7l | armv8l)\012\011\011VSCODE_ARCH="armhf"\012\011\011;;\012\011arm64 | aarch64)\012\011\011if [[ $BITNESS == 32 ]]; then\012\011\011\011# Can have 32-bit userland on 64-bit kernel\012\011\011\011VSCODE_ARCH="armhf"\012\011\011else\012\011\011\011VSCODE_ARCH="arm64"\012\011\011fi\012\011\011;;\012\011*)\012\011\011OSRELEASE=$(uname -r)\012\011\011case $OSRELEASE in\012\011\011\011*x86_64*) VSCODE_ARCH="x64";;\012\011\011\011*)\012\011\011\011\011echo "Unsupported architecture: $ARCH"\012\011\011\011\011fail_with_exitcode 27\012\011\011\011;;\012\011\011esac\012\011\011;;\012esac\012\012if [[ $PLATFORM == linux ]]; then\012\011if [[ $VSCODE_ARCH == armhf ]]; then\012\011\011PLATFORM_DOWNLOAD_PATH=cli-linux-armhf\012\011else\012\011\011PLATFORM_DOWNLOAD_PATH=cli-alpine-$VSCODE_ARCH\012\011fi\012elif [[ $VSCODE_ARCH == "arm64" ]]; then\012\011PLATFORM_DOWNLOAD_PATH=cli-darwin-arm64\012else\012\011PLATFORM_DOWNLOAD_PATH=cli-darwin-x64\012fi\012\012#\012# Delete old CLIs if needed\012#\012TO_DELETE=$(ls -1 -t "$VSCODE_AGENT_FOLDER" | grep cli | tail -n +6)\012for CLI_TO_DELETE in $TO_DELETE; do\012\011echo "Found old VS Code install $CLI_TO_DELETE, attempting to clean up"\012\012\011if (( $? == 0 )); then\012\011\011echo "Deleting old install $VSCODE_AGENT_FOLDER/$CLI_TO_DELETE"\012\011\011rm -rf "$VSCODE_AGENT_FOLDER/$CLI_TO_DELETE"\012\011fi\012done\012\012do_client_download() {\012\011DID_LOCAL_DOWNLOAD=1\012\011echo "Trigger local server download"\012\011echo e6b320840ca3:trigger_server_download\012\011echo artifact==$PLATFORM_DOWNLOAD_PATH==\012\011echo destFolder==$VSCODE_AGENT_FOLDER==\012\011echo destFolder2==/vscode-cli-$COMMIT_ID.tar.gz==\012\011echo e6b320840ca3:trigger_server_download_end\012\011echo "Waiting for client to transfer server archive..."\012\011echo "Waiting for $VSCODE_AGENT_FOLDER/vscode-cli-$COMMIT_ID.tar.gz.done and vscode-server.tar.gz to exist"\012\012\011while true; do\012\011\011if [[ -f "$VSCODE_AGENT_FOLDER/vscode-cli-$COMMIT_ID.tar.gz.done" ]]; then\012\011\011\011if [[ ! -f "$VSCODE_AGENT_FOLDER/vscode-cli-$COMMIT_ID.tar.gz" ]]; then\012\011\011\011\011echo "Found flag but not server tar - server transfer failed"\012\011\011\011\011fail_with_exitcode 31\012\011\011\011fi\012\012\011\011\011echo "Found flag and server on host"\012\011\011\011rm "$VSCODE_AGENT_FOLDER/vscode-cli-$COMMIT_ID.tar.gz.done"\012\011\011\011break\012\011\011else\012\011\011\011echo -n ' '\012\011\011\011sleep 3\012\011\011fi\012\011done\012}\012\012do_client_download_or_fail() {\012\011if [[ $DID_LOCAL_DOWNLOAD == "1" ]]; then\012\011\011echo "Already attempted local download, failing"\012\011\011fail_with_exitcode $1\012\011elif [[ $ALLOW_CLIENT_DOWNLOAD == "1" ]]; then\012\011\011do_client_download\012\011\011LOCAL_DOWNLOAD_RESULT=success\012\011else\012\011\011fail_with_exitcode $1\012\011fi\012}\012\012do_host_download() {\012\011start=$(millis)\012\011echo 'e6b320840ca3%%1%%'\012\012\011DOWNLOAD_URL=https://update.code.visualstudio.com/commit:$COMMIT_ID/$PLATFORM_DOWNLOAD_PATH/stable\012\012\011wget --version &> /dev/null\012\011if (( $? == 0 ))\012\011then\012\011\011echo "Downloading with wget"\012\011\011WGET_ERRORS=$(2>&1 wget --tries=1 --connect-timeout=7 --dns-timeout=7 -nv -O vscode-cli-$COMMIT_ID.tar.gz $DOWNLOAD_URL)\012\011\011if (( $? != 0 ))\012\011\011then\012\011\011\011echo "wget download failed"\012\011\011\011echo $WGET_ERRORS\012\011\011\011printenv_indent\012\012\011\011\011do_client_download_or_fail 25\012\011\011else\012\011\011\011echo "Download complete"\012\011\011\011DOWNLOAD_TIME=$(elapsed $start)\012\011\011fi\012\011else\012\011\011curl --version &> /dev/null\012\011\011if (( $? == 0 ))\012\011\011then\012\011\011\011echo "Downloading with curl"\012\011\011\011CURL_OUTPUT=$(curl --connect-timeout 7 -L $DOWNLOAD_URL --output vscode-cli-$COMMIT_ID.tar.gz -w "%{http_code}")\012\011\011\011if [[ ($? != 0) || ($CURL_OUTPUT != 2??) ]]\012\011\011\011then\012\011\011\011\011echo "curl download failed"\012\011\011\011\011echo $CURL_OUTPUT\012\011\011\011\011printenv_indent\012\012\011\011\011\011do_client_download_or_fail 25\012\011\011\011else\012\011\011\011\011echo "Download complete"\012\011\011\011\011DOWNLOAD_TIME=$(elapsed $start)\012\011\011\011fi\012\011\011else\012\011\011\011printenv_indent\012\011\011\011echo "Neither wget nor curl is installed"\012\012\011\011\011do_client_download_or_fail 26\012\011\011fi\012\011fi\012}\012\012do_install() {\012\011start=$(millis)\012\011echo 'e6b320840ca3%%2%%'\012\011UNPACK_RESULT=success\012\011echo 'tar --version:'\012\011tar --version\012\011tar -xf vscode-cli-$COMMIT_ID.tar.gz\012\011TAR_EXIT=$?\012\011INSTALL_TIME=$(elapsed $start)\012\012\011if (( $TAR_EXIT > 0 ))\012\011then\012\011\011echo "ERROR: tar exited with non-0 exit code: $?"\012\011\011UNPACK_RESULT=error\012\011\011do_client_download_or_fail 37\012\011\011do_install\012\011\011return\012\011fi\012\012\011mv "$CLI_NAME_IN_ARCHIVE" "$CLI_PATH"\012\012\011# cheap sanity check\012\011eval "$CLI_PATH --version"\012\011if (( $? != 0 ))\012\011then\012\011\011UNPACK_RESULT=missingFiles\012\011\011echo "ERROR: $CLI_PATH don't exist"\012\011\011do_client_download_or_fail 37\012\011\011do_install\012\011\011return\012\011fi\012\012\011# Delete the leftover folder which might have -web prefix, and the .tar.gz\012\011rm -rf vscode-cli*\012}\012\012#\012# Install if needed\012#\012if [[ ! -f "$CLI_PATH" ]]\012then\012\011echo "Installing to $VSCODE_AGENT_FOLDER..."\012\011STASHED_WORKING_DIR="`pwd`"\012\011cd "$VSCODE_AGENT_FOLDER"\012\012\011if [[ $FORCE_CLIENT_DOWNLOAD == "1" ]]; then\012\011\011do_client_download\012\011else\012\011\011do_host_download\012\011fi\012\012\011do_install\012\011cd "$STASHED_WORKING_DIR"\012else\012\011echo "Found existing installation at $VSCODE_AGENT_FOLDER..."\012fi\012\012\012#\012# Start the server\012#\012start_server() {\012\011echo "Starting VS Code CLI... \"$CLI_PATH\" command-shell --cli-data-dir \"$VSCODE_AGENT_FOLDER/cli\" --on-port --on-host=127.0.0.1 --parent-process-id $$ &> \"$CLI_LOG_FILE\" < /dev/null"\012\011printenv_indent\012\011start=$(millis)\012\011if [[ -f $CLI_LOG_FILE ]]; then\012\011\011echo "Removing old logfile at $CLI_LOG_FILE"\012\011\011rm "$CLI_LOG_FILE" # See #6265\012\011fi\012\011VSCODE_CLI_REQUIRE_TOKEN=ffcf97f5-ff1c-4240-92c3-a3f46adb057c "$CLI_PATH" command-shell --cli-data-dir "$VSCODE_AGENT_FOLDER/cli" --parent-process-id $$ --on-port --on-host=127.0.0.1 &> "$CLI_LOG_FILE" < /dev/null &\012\011CLI_PID=$!\012\011echo "Spawned remote CLI: $!"\012\012\011stopTime=$((SECONDS+15))\012\012\011while (($SECONDS < $stopTime))\012\011do\012\011\011LISTENING_ON=`cat "$CLI_LOG_FILE" | grep -a -E 'Listening on .+' | grep -v grep | sed 's/Listening on //'`\012\011\011if [[ $LISTENING_ON != '' ]]\012\011\011then\012\011\011\011break\012\011\011fi\012\012\011\011if ! ps -p $CLI_PID > /dev/null; then\012\011\011\011echo "Exec server process not found"\012\011\011\011cat $CLI_LOG_FILE\012\011\011\011break\012\011\011fi\012\012\011\011echo "Waiting for server log..."\012\011\011sleep .03\012\011done\012\012\011SERVER_START_TIME=$(elapsed $start)\012}\012\012start_server\012\012# What we echo below cannot be wider than 80 characters\012echo "e6b320840ca3: start"\012echo SSH_AUTH_SOCK==$SSH_AUTH_SOCK==\012echo DISPLAY==$DISPLAY==\012echo_common_results\012echo "e6b320840ca3: end"\012\012while true; do sleep 180; echo -n ' '; done\012\012EOSSH\012exit 0 1 49 80435 ssh -T -D 57920 -o ConnectTimeout=15 c-003 bash 2 115 80437 shared-process 0 0 80821 /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command= 0 66 80438 fileWatcher [1] 0 131 80471 window 0 98 80599 window 29 98 80814 window [2] (Issue Reporter) Remote: SSH: c-003 ```
Workspace Info ``` ; ```
Extensions (21) Extension|Author (truncated)|Version ---|---|--- better-cpp-syntax|jef|1.27.1 vsc-python-indent|Kev|1.18.0 jupyter-keymap|ms-|1.1.2 remote-containers|ms-|0.375.1 remote-ssh|ms-|0.112.0 remote-ssh-edit|ms-|0.86.0 remote-explorer|ms-|0.4.3 pdf|tom|1.2.2 vscode-icons|vsc|12.8.0 vscode-ruby|win|0.28.0 copilot|Git|1.219.0 copilot-chat|Git|0.17.1 black-formatter|ms-|2024.2.0 debugpy|ms-|2024.8.0 python|ms-|2024.10.0 vscode-pylance|ms-|2024.7.1 jupyter|ms-|2024.6.0 jupyter-keymap|ms-|1.1.2 jupyter-renderers|ms-|1.0.18 vscode-jupyter-cell-tags|ms-|0.1.9 vscode-jupyter-slideshow|ms-|0.1.6 (1 theme extensions excluded)
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805cf:30301675 binariesv615:30325510 vsaa593:30376534 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 a9j8j154:30646983 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonnoceb:30805159 asynctok:30898717 pythonregdiag2:30936856 pythonmypyd1:30879173 2e7ec940:31000449 pythontbext0:30879054 accentitlementst:30995554 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 bdiig495:31013172 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 dwnewjupytercf:31046870 2f103344:31071589 impr_priority:31102340 nativerepl1:31104043 refactort:31101459 ccplt:31103426 pythonrstrctxtcf:31103194 wkspc-onlycs-t:31102394 ```
roblourens commented 2 months ago

Where are you looking at the variables? Can you give some more details?

raminass commented 2 months ago
image

under the jupyter tab.

amunger commented 2 months ago

Is it slow for any amount of variables, like if you just have a cell that runs x = 1, or just when you start building up large variables? If you enable the setting "notebook.experimental.variablesView": true, and use that variable view in the debug panel, is that one loading them slowly as well?

raminass commented 2 months ago

yes, just simple variable. I have a feeling it's due to last update of VScode.

amunger commented 2 months ago

Could you collect some trace logs to help diagnose this further

  1. add the setting "jupyter.logging.level": "trace"
  2. reload the window
  3. Set some variables and open the jupyter variables view to exhibit the performance issue
  4. then copy the jupyter log output (Jupyter: Show Output) into this issue
vs-code-engineering[bot] commented 2 months ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!