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

VS Code freezes when removing 'node_modules' folder from external terminal, forcing to close #20480

Closed
tinesoft opened this issue Feb 11, 2017 · 17 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues
Milestone

Comments

@tinesoft
Copy link

  • VSCode Version: Code 1.9.1 (f9d0c68, 2017-02-09T00:26:45.394Z)
  • OS Version: Windows_NT ia32 6.3.9600
  • Extensions:
Extension Author Version
vscode-stylesheet-formatter dbalage 0.2.0
vscode-instant-markdown dbankier 1.0.0
vscode-material2-snippets deerawan 1.0.1
auto-close-tag formulahendry 0.3.9
Angular2 johnpapa 1.0.2
debugger-for-chrome msjsdiag 2.5.3
autoimport steoates 1.2.2
bootstrap-3-snippets wcwhitehead 0.0.9

Steps to Reproduce:

  1. open a NPM project (with a node_modules folder) from root folder
  2. remove the entire node_modules folder with (rm -rf node_modules or rmdir /s /q node_modules)

From there, the only working option is to choose Close VS Code, when the "not responding" window pops up.

Note that disabling "file watching" on node_modules in settings (as suggested by #12042) DOES work (the application no longer hangs on deletion, but we loose automatic assistance of newly installed packages).

"files.watcherExclude": {
    "**/.git/objects/**": true,
    "**/node_modules/**": true
}

But is there not a better solution?

Thanks in advance

@michaeljota
Copy link

This may be related to #12042.

@tinesoft
Copy link
Author

Hi @michaeljota ,

Yes i know the two issues might be related (i mentioned it in my post)
I'm asking if there is a better solution than deactivating file watching on node_modules ?

@michaeljota
Copy link

Oh! Sorry. Did not read that part. :P. But, as far as I can tell: No. 😢

@bpasero
Copy link
Member

bpasero commented Feb 19, 2017

@tinesoft can you share the full workspace with me? At least the package.json to reproduce?

@bpasero bpasero added freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues info-needed Issue requires more information from poster labels Feb 19, 2017
@bpasero bpasero added this to the Backlog milestone Feb 19, 2017
@tinesoft
Copy link
Author

Hi @bpasero ,

It appears on any node-based project really...
You can try with that one for example: https://github.com/tinesoft/ng2-sharebuttons

@bpasero
Copy link
Member

bpasero commented Feb 19, 2017

@tinesoft thanks, will try.

@bpasero bpasero modified the milestones: February 2017, Backlog Feb 19, 2017
@bpasero bpasero removed the info-needed Issue requires more information from poster label Feb 19, 2017
@bpasero
Copy link
Member

bpasero commented Feb 19, 2017

@tinesoft can you share more details about your machine? Is this a VM? CPU, memory, etc?

@tinesoft
Copy link
Author

Yep,

It's an Alienware X51(R2) Desktop with :
OS: Window 8.1 64Bits
Processor: Intel Core i5-4460 CPU@ 3.20 Ghz, 4 Cores
RAM : 16 Go

@bpasero
Copy link
Member

bpasero commented Feb 20, 2017

@tinesoft I tried to reproduce and failed. Here is what I did on Windows 10:

  • git clone https://github.com/tinesoft/ng2-sharebuttons.git
  • npm install
  • opened the folder with VS Code
  • from the integrated terminal (powershell) executed Remove-Item -Recurse -Force .\node_modules\
  • scrolled in the editor for a while to get to know about the freeze (it would stop scrolling if it ever froze)

=> I could not get the freeze to reproduce

Some things to try:

And yes, sounds very much like a duplicate of #12042

@bpasero bpasero modified the milestones: Backlog, February 2017 Feb 20, 2017
@bpasero bpasero added the info-needed Issue requires more information from poster label Feb 20, 2017
@tinesoft
Copy link
Author

tinesoft commented Feb 20, 2017

Hi @bpasero ,

Thanks for taking the time to look into this.

You mentioned in your post that you deleted the node_modules folder from within the integrated terminal. I don't know if that matters, but in my scenario, i was deleting the folder from outside VSCode:

  • from a Git (bash) terminal, using rm -rf node_modules
  • from a Window command prompt, using: rmdir /s /q node_modules

and in both cases, the freezing problem would appear...

@bpasero
Copy link
Member

bpasero commented Feb 20, 2017

@tinesoft ok, shouldn't make a bit difference though. Can you try what I suggested (insiders, no extensions, my steps) to see if it reproduces?

@tinesoft
Copy link
Author

@bpasero Ok i'll try that tonight (i don't have access to my machine right now)

2 questions through:

  • is the file watching ("files.watcherExclude") on node_modules/ disabled in your settings? Because if i do (as mentioned above), no more freezing... (but no more automatic detection of new packages either :( )
  • can VS Code Insiders be installed side by side with a regular VSCode ? or do i have to uninstall the later first?

@bpasero
Copy link
Member

bpasero commented Feb 20, 2017

@tinesoft yes, side by side install is possible!

On Windows by default changes to node_modules are actually not ignored, we only do this on macOS and Linux where our file watcher is less powerful for large directories.

I just verified I still do not see any freeze using Code stable 1.9.1 and deleting the node_modules folder from a command prompt outside.

I wonder if this is just a matter of your disk being slower than mine and the resulting file events are more "spammy" compared to on my machine. It is easy to find this out by running "code --verbose" from the command line and then checking what kind of file events are being generated by opening the developer tools console (from Help menu).

Here is my output: https://gist.githubusercontent.com/bpasero/ee240c33ba7d6cda6f5eab9cd25e34c1/raw/a581a0a01a0c9a0f740c619f4e36f172ebddcc8b/gistfile1.txt

What is interesting to look at is how often >> normalized [DELETED] shows up because this is the event that actually reaches the main side. The idea here is to wait for some time (I think 50ms) before sending over a delete-event in case a directory is deleted recursively. If a folder contains 1000 files and the folder gets deleted, we only want 1 file event for this folder and not 1000 events for all the files within.

However, due to this timeout being short, on slower disks it can well be that we end up running into a case where we spam the main side with 1 event for each delete, simply because the delete runs slow.

@tinesoft
Copy link
Author

Hi @bpasero ,

Again, thanks for taking the time to perform those tests.
Your theory seems very valid. I'll test tonight and post my output as well (along with my disk details)

Cheers!

@bpasero
Copy link
Member

bpasero commented Feb 20, 2017

Worth mentioning that I just tried with a version of the file watcher that spams each and every event to the main side and I could reproduce a lag when scrolling. However, eventually this recovered and I could continue to use Code normally.

@tinesoft
Copy link
Author

Hi @bpasero ,

I did the tests (on regular vscode with --verbose enabled).
And first , i forgot to mention in my "Steps to reproduce" that when i was running the rmdir /s /q node_modules command , it was followed by a npm install.

So the full command was actually: rmdir /s /q node_modules && npm install

Test 1:
I tested on a desktop pc, with Window 8.1 64Bits, 16 Gb RAM, HDD Disk SATA I @ 1.5Gb/s
I could not create a gist out of the devtools log file, because the file is too big (37 Mb)
But weirdly enough, the application no longer freezes.... I tried many times

Test 2:
I tested on a laptop, with Windows 10 64Bits, 4Gb RAM, and SSD Disk SATA III @ 6Gb/s
Here is the log from VScode devtools: https://gist.github.com/tinesoft/8b8353f4d414512ef62c92039872ef3b (the file is only about 3Mb).
Even if VSCode did freeze during the npm install phase, at the end the app was still responding normally...

@bpasero
Copy link
Member

bpasero commented Feb 23, 2017

Ok that is a different story then and I would argue #12042

I suggest we continue talking in there and close this as duplicate.

@bpasero bpasero closed this as completed Feb 23, 2017
@bpasero bpasero added *duplicate Issue identified as a duplicate of another issue(s) and removed info-needed Issue requires more information from poster labels Feb 23, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues
Projects
None yet
Development

No branches or pull requests

3 participants