Skip to content

Cancel reading binary files to prevent reading all data #132771

Closed

Description

@LumiaGG

Issue Type: Performance Issue

When I use remote ssh to control the server, drag a binary file from the local to the server. vscode will always try to open this file. If my network condition is not good at this time, the ssh connection will crash.

VS Code version: Code 1.59.1 (3866c35, 2021-08-19T11:56:46.957Z)
OS version: Windows_NT x64 10.0.17763
Restricted Mode: No
Remote OS version: Linux x64 5.4.0-42-generic

System Info
Item Value
CPUs Intel(R) Core(TM) i5-7300U CPU @ 2.60GHz (4 x 2712)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 3.92GB (1.79GB free)
Process Argv --crash-reporter-id 04214beb-25c7-422f-8a03-c6acab12e9fd
Screen Reader no
VM 0%
Item Value
Remote SSH: dell
OS Linux x64 5.4.0-42-generic
CPUs Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (12 x 800)
Memory (System) 31.13GB (25.32GB free)
VM 0%
Process Info
CPU %	Mem MB	   PID	Process
    1	    88	  1924	code main
    1	   160	  1072	   gpu-process
    3	    53	  1392	   window (问题报告程序)
    0	    60	  6740	   shared-process
    0	    56	  9944	     ptyHost
    0	     6	  1596	       winpty-process
    0	     4	  1160	         C:\Windows\System32\cmd.exe /c (type "C:\Users\JwG\AppData\Local\Temp\vscode-linux-multi-line-command-dell-596493629.sh" | ssh -T -D 50054 dell bash) & exit /b 0
    0	     8	  9764	           ssh  -T -D 50054 dell bash
    0	    10	  2840	         console-window-host (Windows internal process)
    0	     6	  3468	       winpty-process
    0	    10	  8172	         console-window-host (Windows internal process)
    0	     4	  9064	         C:\Windows\System32\cmd.exe /c (type "C:\Users\JwG\AppData\Local\Temp\vscode-linux-multi-line-command-dell-677846429.sh" | ssh -T -D 53177 dell bash) & exit /b 0
    0	     8	  3140	           ssh  -T -D 53177 dell bash
    0	     6	  5936	       winpty-process
    0	     4	  7620	         C:\Windows\System32\cmd.exe /c (type "C:\Users\JwG\AppData\Local\Temp\vscode-linux-multi-line-command-dell-139057044.sh" | ssh -T -D 51126 dell bash) & exit /b 0
    0	     8	  6296	           ssh  -T -D 51126 dell bash
    1	    10	  9316	         console-window-host (Windows internal process)
    0	     6	  6804	       winpty-process
    0	     4	  9032	         C:\Windows\System32\cmd.exe /c (type "C:\Users\JwG\AppData\Local\Temp\vscode-linux-multi-line-command-dell-313229738.sh" | ssh -T -D 59140 dell bash) & exit /b 0
    0	     8	  5984	           ssh  -T -D 59140 dell bash
    0	    10	  9972	         console-window-host (Windows internal process)
    0	     6	  7192	       winpty-process
    0	     4	  2704	         C:\Windows\System32\cmd.exe /c (type "C:\Users\JwG\AppData\Local\Temp\vscode-linux-multi-line-command-dell-607055470.sh" | ssh -T -D 55612 dell bash) & exit /b 0
    0	     8	  8020	           ssh  -T -D 55612 dell bash
    1	    10	  9672	         console-window-host (Windows internal process)
    0	     6	  7236	       winpty-process
    0	    10	  1676	         console-window-host (Windows internal process)
    0	     4	 10044	         C:\Windows\System32\cmd.exe /c (type "C:\Users\JwG\AppData\Local\Temp\vscode-linux-multi-line-command-dell-490902812.sh" | ssh -T -D 64079 dell bash) & exit /b 0
    0	     8	  5144	           ssh  -T -D 64079 dell bash
    0	     6	  9704	       winpty-process
    0	     4	  3900	         C:\Windows\System32\cmd.exe /c (type "C:\Users\JwG\AppData\Local\Temp\vscode-linux-multi-line-command-dell-302767693.sh" | ssh -T -D 55589 dell bash) & exit /b 0
    0	     8	  3196	           ssh  -T -D 55589 dell bash
    0	    10	  4604	         console-window-host (Windows internal process)
    0	     9	  6840	   crashpad-handler
    0	    21	  7440	   utility
    0	   141	  8720	   window (Extern [SSH: dell] - Visual Studio Code)
    0	    73	  6096	     extensionHost

Remote: SSH: dell
CPU %	Mem MB	   PID	Process
    0	     0	 26507	remote agent
    0	     0	 26546	   ptyHost
    0	     0	 27452	   extensionHost
    0	     0	 27494	     /home/gg/.vscode-server/bin/3866c3553be8b268c8a7f8c0482c0c0177aa8bfa/node /home/gg/.vscode-server/extensions/intellsmi.comment-translate-1.5.0/server/out/server.js --node-ipc --clientProcessId=27452
    0	     0	 27459	   watcherService
    0	     0	 27536	   /bin/sh -c /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command=
    0	     0	 27537	     /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command=
Workspace Info

|  Remote: SSH: dell|    Folder (Extern): 97 files|      File types: cpp(11) h(11) cmake(8) o(8) jpg(6) txt(4) make(4) bin(3)
|                  c(2) out(2)
|      Conf files: cmake(8) settings.json(1) makefile(1);
Extensions (15)
Extension Author (truncated) Version
vscode-language-pack-zh-hans MS- 1.59.3
remote-containers ms- 0.191.1
remote-ssh ms- 0.65.7
remote-ssh-edit ms- 0.65.7
remote-wsl ms- 0.58.2
vscode-remote-extensionpack ms- 0.21.0
material-theme zhu 3.11.4
code-runner for 0.11.5
comment-translate int 1.5.0
vscode-language-pack-zh-hans MS- 1.60.3
python ms- 2021.9.1191016588
vscode-pylance ms- 2021.9.1
jupyter ms- 2021.8.2041215044
jupyter-keymap ms- 1.0.0
cpptools ms- 1.6.0
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
pythonvspyt602:30300191
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
pythonvspyt639:30300192
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
pythonvsuse255:30340121
vscod805cf:30301675
pythonvspyt200:30340761
vscextlangct:30333562
binariesv615:30325510
pythonvssor306:30344512
bridge0708:30335490
pygetstartedt2:30360495
bridge0723:30353136
pythonf5test824cf:30361778
pythonvspyt187:30362782
pydsgsc2:30361791
vscus224:30358039
vssid140cf:30363604

Activity

  1. roblourens commented on Sep 9, 2021

    @roblourens
    Member

    Are you expecting it to be moved, but not opened? I don't see how that helps when your network connection is not good and the file has to be transferred anyway.

  2. added
    info-needed
    on Sep 9, 2021
  3. LumiaGG commented on Sep 11, 2021

    @LumiaGG
    Author

    Are you expecting it to be moved, but not opened? I don't see how that helps when your network connection is not good and the file has to be transferred anyway.

    For example, when I drag a local file (.zip) to the VSCODE Explorer window, when the file is transferred, VSCODE will try to open the file (.zip), at this point, my ssh connection will crash

  4. roblourens commented on Sep 14, 2021

    @roblourens
    Member

    Logan Ramos (@lramos15) are the contents of a binary file transferred to the local side when it is only being opened in the generic binary file editor? I wouldn't think so?

  5. lramos15 commented on Sep 16, 2021

    @lramos15
    Member

    Well to show the binary warning message we do need to at least open the file. We don't tokenize and do all the other slower features. Benjamin Pasero (@bpasero) Do you have any more context?

  6. bpasero commented on Sep 16, 2021

    @bpasero
    Contributor

    For editors we use this method to figure out if the file seems to be binary by checking the first chunk of the file for 0-bytes:

    export function detectEncodingFromBuffer(readResult: IReadResult, autoGuessEncoding?: false): IDetectedEncodingResult;

  7. vscode-triage-bot commented on Sep 24, 2021

    @vscode-triage-bot

    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!

  8. removed
    info-needed
    on Sep 24, 2021
  9. lramos15 commented on Oct 13, 2021

    @lramos15
    Member

    roblourens I don't believe this is my area or I have the applicable knowledge to fix this. It seems like what is wanted here is an ability to have remote SSH not auto open certain files. Maybe over x MB for weak connections

  10. 6 remaining items

  11. bpasero commented on Dec 10, 2021

    @bpasero
    Contributor

    I think the fix for #138805 addresses this issue too, but needs verification. Now that the file system implementation is also remote even in the local case (main process <-> window process), the issue is more apparent.

    We now cancel the operation as soon as we detect file is binary and this should bubble through to the remote to stop reading, but it might take some time so it is possible that a few chunks of data are still being sent.

  12. changed the title [-]Don't try to open binary files, especially remote control[/-] [+]Cancel reading binary files to prevent reading all data[/+] on Dec 10, 2021
  13. added
    verification-needed
    on Dec 10, 2021
  14. added
    bug
    and removed
    feature-request
    verification-needed
    on Dec 14, 2021
  15. added
    author-verification-requested
    on Jan 4, 2022
  16. locked and limited conversation to collaborators on Jan 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

author-verification-requestedbugfile-ioremoteverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions