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

[VSC] Editor freeze on deleted image #69334

Closed
levrik opened this issue Feb 25, 2019 · 29 comments
Closed

[VSC] Editor freeze on deleted image #69334

levrik opened this issue Feb 25, 2019 · 29 comments
Assignees
Labels
freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues verified Verification succeeded
Milestone

Comments

@levrik
Copy link

levrik commented Feb 25, 2019

Issue Type: Bug

The whole editor freezes if I click on a deleted image in the changes view of VSC (Git).

kapture 2019-02-25 at 10 30 37
(GIF)

image

This is really annoying if you click on it by accident and have to wait for one/two minutes till you can restart the editor.

VS Code version: Code 1.31.1 (1b8e830, 2019-02-12T02:16:38.656Z)
OS version: Darwin x64 18.2.0

System Info
Item Value
CPUs Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz (4 x 2600)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: enabled
rasterization: enabled
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 3, 4, 3
Memory (System) 16.00GB (0.55GB free)
Process Argv -psn_0_7645002
Screen Reader no
VM 0%
Extensions (12)
Extension Author (truncated) Version
gitignore cod 0.6.0
vscode-eslint dba 1.8.0
gitlens eam 9.5.0
EditorConfig Edi 0.12.8
prettier-vscode esb 1.8.1
vscode-pull-request-github Git 0.4.0
vscode-styled-components jpo 0.0.25
vscode-language-pack-de MS- 1.31.4
vscode-kubernetes-tools ms- 0.1.16
python ms- 2019.1.0
vscode-yaml red 0.2.1
code-settings-sync Sha 3.2.4

(1 theme extensions excluded)

With all extensions disabled it hangs for about 10 seconds, then the image loads.
With extensions enabled it hangs a one or two minutes before getting the prompt.

@vscodebot
Copy link

vscodebot bot commented Feb 25, 2019

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@levrik levrik changed the title [VSC] Freeze on deleted image [VSC] Editor freeze on deleted image Feb 25, 2019
@joaomoreno
Copy link
Member

@bpasero I thought we had size limits here?

@bpasero
Copy link
Member

bpasero commented Feb 27, 2019

@joaomoreno are you opening these files via the data-URI trick? The size should be encoded as META_DATA_SIZE which then (if large enough) would cause the image to not be rendered inline. But I am not sure that is happening here.

@levrik do you see a text editor opening eventually or the image shown inline?

@bpasero bpasero added the info-needed Issue requires more information from poster label Feb 27, 2019
@levrik
Copy link
Author

levrik commented Feb 27, 2019

@bpasero Already explained in the original issue.
Without any extensions enabled the image opens normally after about 10 seconds. With all my extensions enabled it loads one or two minutes before getting the unresponsive message.

@joaomoreno
Copy link
Member

@levrik How big, in bytes, is that JPEG?

@levrik
Copy link
Author

levrik commented Feb 27, 2019

@joaomoreno 293.398 bytes

@joaomoreno
Copy link
Member

Any chance you can send it to me?

@levrik
Copy link
Author

levrik commented Feb 27, 2019

@joaomoreno You can download it here: https://hypatos.ai/content/6-imprint/og-image.jpg

@bpasero
Copy link
Member

bpasero commented Feb 27, 2019

@levrik can you point out the extension that is causing it e.g. by disabling the extensions one by one?

@joaomoreno
Copy link
Member

@bpasero I can repro this without extensions.

  1. Add the file to a git repo, commit
  2. Delete the file
  3. Open the file in SCM, opens fast
  4. Close it and open it again, opens very slowly

@levrik
Copy link
Author

levrik commented Feb 27, 2019

@joaomoreno Yep. Exactly this. With extensions enabled it doesn't load at all. It just shows the unresponsive warning at some point.

@bpasero
Copy link
Member

bpasero commented Feb 27, 2019

@joaomoreno can you check if memory goes beserk?

@joaomoreno
Copy link
Member

joaomoreno commented Feb 27, 2019

@bpasero Pretty weird profile:

image

Profile-20190227T105432.json.zip

@bpasero
Copy link
Member

bpasero commented Feb 27, 2019

@joaomoreno yeah it looks like V8 is spending a very long time in this._models[modelId]; where modelId is the entire data URI which is probably very long.

image

Maybe I can make that call smarter and not do the getModel lookup when I have a data resource in hand. It only seems to be used to render a proper icon for the editor.

@bpasero bpasero added freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues and removed info-needed Issue requires more information from poster labels Feb 27, 2019
@joaomoreno
Copy link
Member

Yeah could be a good idea. Another couple ideas:

  • Maybe try using ES6 map? I wonder...
  • Maybe store modelId hashes in the map instead of modelIds themselves.

@bpasero
Copy link
Member

bpasero commented Feb 27, 2019

@alexandrudima on #69334 (comment). The idea would be to change to a Map for getModel or a different approach that does not take the entire URI as hash lookup key. Though I am not sure that would work given this is in the standalone editor part.

@bpasero bpasero added the bug Issue identified by VS Code Team member as probable bug label Mar 2, 2019
@bpasero bpasero added this to the March 2019 milestone Mar 2, 2019
@bpasero
Copy link
Member

bpasero commented Mar 2, 2019

My fix is to avoid the getModel() call for data URIs and use the metadata encoded in the URI instead.

@bpasero bpasero closed this as completed Mar 2, 2019
bpasero added a commit that referenced this issue Mar 2, 2019
@alexdima
Copy link
Member

alexdima commented Mar 4, 2019

@bpasero I suggest we remove the data-uri hack rather than blaming v8 or rewriting our code for the hack.

@kieferrm kieferrm reopened this May 29, 2019
@kieferrm
Copy link
Member

According to #74515 still happening in 1.34.

@bpasero
Copy link
Member

bpasero commented May 31, 2019

@levrik can you give some exact steps how to reproduce this? I tried with the original image (which I guess I still had) and could not:

before

Also maybe try to reproduce in our insiders release.

@bpasero bpasero added info-needed Issue requires more information from poster and removed verified Verification succeeded bug Issue identified by VS Code Team member as probable bug labels May 31, 2019
@bpasero bpasero removed this from the March 2019 milestone May 31, 2019
@levrik
Copy link
Author

levrik commented Jun 3, 2019

@bpasero Happened with a different image this time but I also tried with the original one and it happened there as well. But there was a difference. With all extensions disabled it didn't happen anymore. I could track it down to the Kubernetes extension. It's a bit weird that this extension is causing this since it shouldn't do anything with version control.
I opened an issue over there anyway: vscode-kubernetes-tools/vscode-kubernetes-tools#558

@vscodebot
Copy link

vscodebot bot commented Jun 3, 2019

This issue is caused by an extension, please file it with the repository (or contact) the extension has linked in its overview in VS Code or the marketplace for VS Code. See also our issue reporting guidelines.

Happy Coding!

@itowlson
Copy link

itowlson commented Jun 6, 2019

I'm the maintainer of the Kubernetes extension that @levrik has identified as suffering from this issue. The thing is that having the extension present results in the hang even if the extension has not activated. Even if I delete all of our extension's activation events, the hang still happens!

From hacking around our package.json, it looks like the issue is a particular filenamePattern in a language contribution. I feel this is a VS Code issue, as this is a legitimate pattern and I don't see any reason why it should affected deleted image previews. I've raised an issue on VS Code, and provided a minimal extension that reproduces the issue at https://github.com/itowlson/git-deleted-image-hang-o-matic. Hope this helps!

@bpasero bpasero reopened this Jun 6, 2019
@bpasero
Copy link
Member

bpasero commented Jun 6, 2019

We should not test these URIs in our language detection (mime.ts?). Happy for a PR if someone has cycles.

@bpasero bpasero removed *caused-by-extension Issue identified to be caused by an extension info-needed Issue requires more information from poster labels Jun 6, 2019
@bpasero bpasero added this to the June 2019 milestone Jun 6, 2019
@bpasero
Copy link
Member

bpasero commented Jun 6, 2019

@mjbvz did we recently increase the max-size for images? I wonder if this also means we now have much larger data URIs in our system. It used to be 1MB I think.

@bpasero bpasero added the help wanted Issues identified as good community contribution opportunities label Jun 6, 2019
@joaomoreno
Copy link
Member

From #74926


Issue Type: Bug

This relates to #69334, which was resolved but recurs in this specific situation. See also vscode-kubernetes-tools/vscode-kubernetes-tools#558 which is how it came to me.

Steps to reproduce:

  1. Create a git repo. Add an image (e.g. JPEG) to it and commit. Delete the image and do not commit. If you click on the deleted file diff in the SCM explorer, VS Code will show the deleted image. This is all as expected so far.

  2. Create a new VS Code extension and add the following contribution:

        "languages": [
            {
                "id": "hanglywangly",
                "filenamePatterns": [
                    "**/foo/*.hanglywangly"
                ]
            }
        ]

(I have provided an extension which reproduces the problem at https://github.com/itowlson/git-deleted-image-hang-o-matic.)

  1. Run the extension in the Extension Development Host.

  2. In the Extension Development Host, open the git repo from step 1, go to the SCM view and click on the deleted image.

VS Code freezes up as described in #69334.

VS Code version: Code 1.35.0 (553cfb2, 2019-06-04T01:17:12.481Z)
OS version: Windows_NT x64 10.0.18362

bpasero added a commit that referenced this issue Jun 9, 2019
@bpasero bpasero removed the help wanted Issues identified as good community contribution opportunities label Jun 9, 2019
@bpasero bpasero closed this as completed Jun 11, 2019
@levrik
Copy link
Author

levrik commented Jun 11, 2019

@bpasero Any plans when the fix is getting shipped? I'm running into that issue on a daily basis and it's kinda annoying having to wait for the dialog to come up, reload, and that stuff.

@bpasero
Copy link
Member

bpasero commented Jun 11, 2019

@levrik in around 1 hour in our insiders build: You can give our preview releases a try from: https://code.visualstudio.com/insiders/

@levrik
Copy link
Author

levrik commented Jun 11, 2019

@bpasero I can confirm that this issue is fixed now! Thanks a lot!

@bpasero bpasero added the verified Verification succeeded label Jun 11, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Jul 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

7 participants