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 hangs when update dependencies #12042

Closed
michaeljota opened this issue Sep 14, 2016 · 40 comments
Closed

VS Code hangs when update dependencies #12042

michaeljota opened this issue Sep 14, 2016 · 40 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) file-watcher File watcher freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues info-needed Issue requires more information from poster
Milestone

Comments

@michaeljota
Copy link

michaeljota commented Sep 14, 2016

  • VSCode Version: 1.5.2
  • OS Version: Windows 10 (AU)

Steps to Reproduce:

  1. Open a proyect fresh cloned.
  2. Run npm install in a (external) terminal.

VS Code stop responding. I ran it with the integrated terminal and an external one with the same results.

Edit typo.

@bpasero
Copy link
Member

bpasero commented Sep 15, 2016

@michaeljota does this produce a top level node_modules folder? can you share your settings?

@bpasero bpasero added the info-needed Issue requires more information from poster label Sep 15, 2016
@bpasero bpasero added this to the Backlog milestone Sep 15, 2016
@bpasero bpasero self-assigned this Sep 15, 2016
@michaeljota
Copy link
Author

I notice this with top level node_modules only. Have not tried with any other. What settings do you need? I don't have settings changed from the editor, just few extensions.

I got Sync Settings, I can give you the gist url, but it's just the list of extensions.

@bpasero
Copy link
Member

bpasero commented Sep 15, 2016

I am wondering if this is file event related and you changed the built in files.watcherExclude setting in any way?

@michaeljota
Copy link
Author

It happens to me with differents projects, not just one.

@bpasero
Copy link
Member

bpasero commented Sep 15, 2016

@michaeljota can you share your user settings and workspace settings or at least see if you once configured this setting files.watcherExclude?

@michaeljota
Copy link
Author

I don't have any user settings not workspace settings. I have not configured files.watcherExclude.

You can see my settings here

@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 Sep 15, 2016
@bpasero
Copy link
Member

bpasero commented Sep 15, 2016

@michaeljota does this reproduce with any kind of npm install? I am wondering if the amount of modules getting installed has an impact. E.g. can we try with a small package.json that maybe only has one dependency to see if it reproduces?

@bpasero bpasero added the info-needed Issue requires more information from poster label Sep 15, 2016
@michaeljota
Copy link
Author

michaeljota commented Sep 15, 2016

With this files hangs

{
  "name": "angular2",
  "version": "0.0.1",
  "dependencies": {
    "@angular/common": "2.0.0-rc.7",
    "@angular/compiler": "2.0.0-rc.7",
    "@angular/core": "2.0.0-rc.7",
    "@angular/forms": "2.0.0-rc.7",
    "@angular/http": "2.0.0-rc.7",
    "@angular/platform-browser": "2.0.0-rc.7",
    "@angular/platform-browser-dynamic": "2.0.0-rc.7",
    "@angular/router": "3.0.0-rc.3",
    "core-js": "^2.4.1",
    "rxjs": "5.0.0-beta.12",
    "zone.js": "^0.6.21"
  }
}

Let me try something smaller.

EDIT:
This small does NOT hang

{
  "name": "angular2-desktop",
  "version": "0.0.1",
  "dependencies": {
    "@angular/common": "2.0.0-rc.7",
    "@angular/compiler": "2.0.0-rc.7",
    "@angular/core": "2.0.0-rc.7"
  }
}

Neverless, they are random package. But, I reproduce the problem with the first one.

@bpasero
Copy link
Member

bpasero commented Sep 19, 2016

@michaeljota
I wonder if this issue is being caused by an installed extension. Can you try to run VS Code without extensions? From the command line, execute: code --disable-extensions and try your steps again to see if it reproduces. If you see it is an issue with the extension, please file it against the extension repository itself.

@ghost
Copy link

ghost commented Sep 19, 2016

I have the same issue. When running npm i VScode freezes and npm fails because of file/folder lock caused by VScode.

Normal start vs. --disable-extensions
When starting VScode in normal mode, VScode shows a popup asking about Keep waiting or closing the windows. Regardless of my choice VScode never recovers.

When starting VScode with --disable-extensions it's very laggy. Moving the cursor from row to row feels like running VScode on an old 486 CPU or something. But at least it doesn't die.

The following issues persist regardless of enabled or disabled extensions.

npm complains about insuficient permissions because it can't rename/move files&folders at the finishing stage.

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\denny.trebbin\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "i"
npm ERR! node v6.6.0
npm ERR! npm  v3.10.8
npm ERR! path C:\code\js\products\sfi.sebn.com\backend\node_modules\.staging\ajv-keywords-38f0ca98
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall rename

npm ERR! Error: EPERM: operation not permitted, rename 'C:\code\js\products\sfi.sebn.com\backend\node_modules\.staging\ajv-keywords-38f0ca98' -> 'C:\code\js\products\sfi.sebn.com\backend\node_modules\ajv-keywords'
npm ERR!     at destStatted (C:\Users\denny.trebbin\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:25:7)
npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\code\js\products\sfi.sebn.com\backend\node_modules\.staging\ajv-keywords-38f0ca98' -> 'C:\code\js\products\sfi.sebn.com\backend\node_modules\ajv-keywords'
npm ERR!     at Error (native)
npm ERR!  { Error: EPERM: operation not permitted, rename 'C:\code\js\products\sfi.sebn.com\backend\node_modules\.staging\ajv-keywords-38f0ca98' -> 'C:\code\js\products\sfi.sebn.com\backend\node_modules\ajv-keywords'
npm ERR!     at destStatted (C:\Users\denny.trebbin\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:25:7)
npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename 'C:\code\js\products\sfi.sebn.com\backend\node_modules\.staging\ajv-keywords-38f0ca98' -> 'C:\code\js\products\sfi.sebn.com\backend\node_modules\ajv-keywords'
npm ERR!     at Error (native) parent: 'sfi_backend' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\code\js\products\sfi.sebn.com\backend\npm-debug.log

But npm can't rename/move files because VScode locked many of them. Maybe for scanning them?
VSCode locked a lot of files.
VScode locked a lot of files

Process Explorer shows interesting stuff.
Process Explorer shows how much CPU time VScode consumes

Notice, I have just 1 VScode app running in Process Explorer I see two apps. The one at the bottom of the image has no sub-processes, not sure what's about it.

@bpasero
Copy link
Member

bpasero commented Sep 19, 2016

@fibric can you hover over the processes in process explorer to find out their command line arguments? this would help finding out which process is hogging CPU

@ghost
Copy link

ghost commented Sep 20, 2016

@bpasero sorry, it took me a while; I have no Windows machine at home.
1
2
3
4
5
6
7
8
9
10

With the Insiders update from today, I don't see the alien process anymore.

@bpasero
Copy link
Member

bpasero commented Sep 24, 2016

@michaeljota you still there?

@fibric in those screenshots I am not seeing a process with high CPU though? you say you cannot reproduce in insiders?

@ghost
Copy link

ghost commented Sep 24, 2016

Oh well, I forgot about it.
I took the before pictures but forgot about the when-it's-happinging pictures. I'll do that on Monday when I'm in office again.

@michaeljota
Copy link
Author

@bpasero I'm here, but I don't know what program is that. Witch you would recommend me?

@bpasero
Copy link
Member

bpasero commented Sep 24, 2016

@michaeljota a tool to see the full command line arguments of the processes (https://technet.microsoft.com/en-us/sysinternals/processexplorer.aspx?f=255&MSPPError=-2147217396). it would allow us to find the process that consumes so much CPU for you.

@ghost
Copy link

ghost commented Sep 26, 2016

I have only two processes which steal a lot of CPU time while running npm i. The freeze+hang situation seems to be gone now.

100
101

In the user preferences, I found a search option

{
...,
  // Configure glob patterns of file paths to exclude from file watching. Changing this setting requires a restart. When you experience Code consuming lots of CPU time on startup, you can exclude large folders to reduce the initial load.
  "files.watcherExclude": {
    "**/.git/objects/**": true
  },
...,
  // Configure glob patterns for excluding files and folders in searches. Inherits all glob patterns from the files.exclude setting.
  "search.exclude": {
    "**/node_modules": true,
    "**/bower_components": true
  },
...
}

I added "**/node_modules": true, to files.watcherExclude just to be save. The CPU consumption is still very high but VScode doesn't freeze&hang anymore; it's just a bit unresponsive while npm i runs.

@bpasero
Copy link
Member

bpasero commented Sep 26, 2016

@fibric yes you definitely want to have node_modules in the excludes and they are by default (maybe you configured it once when it was not yet):

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

@ghost
Copy link

ghost commented Sep 26, 2016

On my VScode installation, node_modules isn't defined by default.
image
image

@bpasero
Copy link
Member

bpasero commented Sep 26, 2016

@fibric sorry you are right, we only exclude it on Mac and Linux where our file watcher is not very efficient for large folders. We do not have seen this issue on Windows yet.

@bpasero
Copy link
Member

bpasero commented Sep 28, 2016

@michaeljota
To find out more about this issue, we need to get at the process that is causing the high load. VS Code creates multiple processes, each with different tasks. Depending on your OS you can get at the full command line of the process and paste it here. On Mac, the Activity Monitor allows to find the PID of the process and from a terminal ps aux | grep <pid> reveals its arguments.

image

On Windows a tool like Process Explorer helps:

image

Once you have the information please update this issue with it. Thanks!

@ghost
Copy link

ghost commented Sep 29, 2016

Sorry, for forking. I was in a hurry. I apologize.
#13024

@bpasero
Copy link
Member

bpasero commented Sep 29, 2016

@fibric ok, now you are forking this issue into something else I think because this originally was about hang when running "npm install". please create a new issue for your CPU issue when opening a large file.

@bpasero bpasero reopened this Oct 5, 2016
@michaeljota
Copy link
Author

michaeljota commented Oct 5, 2016

OK. Just tried to npm install and in VS Code 1.5.3 this is not longer an issue. Seems to be fixed to me. If someone else can confirm would be better, but I'm not able to reproduce this again.

I tried in two different projects, and neither reproduce the issue.

@bpasero
Copy link
Member

bpasero commented Oct 5, 2016

OK please report back then if it happens again. However since this seems to happen sporadically, it seems like an indeterministic issue.

@bpasero bpasero closed this as completed Oct 5, 2016
@michaeljota
Copy link
Author

Sure. Thanks! Sorry for the delay.

@michaeljota
Copy link
Author

@bpasero I'm sorry, but I'm having this same issue with lastes stable Code (1.7.1).

You can run npm install with this repo to reproduce the issue. angular2-ultimate-starter.

The screens from Process Explorer:
captura de pantalla 31
captura de pantalla 32
captura de pantalla 33
captura de pantalla 34
captura de pantalla 35
captura de pantalla 36
captura de pantalla 37
captura de pantalla 38
captura de pantalla 39
captura de pantalla 40
captura de pantalla 41
captura de pantalla 42
captura de pantalla 43

User config:

// Coloque su configuración en este archivo para sobrescribir la configuración predeterminada.
{
    "editor.fontFamily": "Hasklig, Consolas, 'Courier New', monospace"
}

Workspace config:

{
  "typescript.tsdk": "node_modules/typescript/lib/",
  "auto-close-tag.activationOnLanguage": [
    "html"
  ],
  "typescriptHero.resolver.multiLineWrapThreshold": 100
}

Extensions: (Installed. Recommended in workspace as well)

{
  // See http://go.microsoft.com/fwlink/?LinkId=827846
  // for the documentation about the extensions.json format
  "recommendations": [
    // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp

    "abusaidm.html-snippets",
    "christian-kohler.path-intellisense",
    "EditorConfig.EditorConfig",
    "eg2.tslint",
    "formulahendry.auto-close-tag",
    "formulahendry.auto-rename-tag",
    "joelday.docthis",
    "johnpapa.Angular2",
    "msjsdiag.debugger-for-chrome",
    "natewallace.angular2-inline",
    "rbbit.typescript-hero"
  ]
}

@michaeljota
Copy link
Author

If you need anything else, I'll try to help you. This issue is really edge, but with this configuration for some reason keeps happing. I work with that seed in my projects, and in everyone of them it's the same. I have to close VSCode when I'm going to install.

@bpasero
Copy link
Member

bpasero commented Nov 21, 2016

@michaeljota
Can you try to reproduce with our nightly insider builds? You can give our preview releases a try from: http://code.visualstudio.com/Download#insiders

@michaeljota
Copy link
Author

@bpasero it is still reproducible.

@bpasero bpasero reopened this Nov 22, 2016
@bpasero bpasero removed the info-needed Issue requires more information from poster label Nov 22, 2016
@bpasero bpasero modified the milestones: November 2016, Backlog Nov 22, 2016
@bpasero
Copy link
Member

bpasero commented Nov 23, 2016

@michaeljota I tried to reproduce and could not. in your screen shots I am also not seeing a CPU spending high cycles in some task, how does the lag show to you then? does VS Code freeze? Also can you share your settings with me?

@bpasero bpasero modified the milestones: Backlog, November 2016 Nov 23, 2016
@bpasero bpasero added the info-needed Issue requires more information from poster label Nov 23, 2016
@michaeljota
Copy link
Author

michaeljota commented Nov 23, 2016

I already share them, settings and extension set, just after my set of pictures. The VSCode freeze and ask for reload.

The CPU usage does not get high, it just "stop responding".

@michaeljota
Copy link
Author

@bpasero Hi! I reproduce this with another, and smaller, project.

Steps:

  • Open project
  • Small styles edit to the first file that opens
  • (in an external console) npm install nodemon -D. Maybe it's worth to notice how many dependencies nodemon has.
  • Comeback to VSCode to see it freeze.

package.json

{
  "name": "graphql-postgres",
  "version": "1.0.0",
  "description": "An example GraphQL server using a PostgreSQL DB",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "tsc": "tsc"
  },
  "author": "Michael De Abreu",
  "license": "MIT",
  "dependencies": {
    "express": "^4.14.0",
    "express-graphql": "^0.6.1",
    "faker": "^3.1.0",
    "graphiql": "^0.8.1",
    "graphql": "^0.8.2",
    "pg": "^6.1.2",
    "pg-hstore": "^2.3.2",
    "sequelize": "^3.29.0",
    "ts-node": "^2.0.0",
    "typescript": "^2.1.5"
  },
  "devDependencies": {
    "@types/express": "^4.0.35",
    "@types/express-graphql": "0.0.33",
    "@types/faker": "^3.1.32",
    "@types/graphql": "^0.8.6",
    "@types/node": "^6.0.60",
    "@types/pg": "^6.1.34",
    "@types/sequelize": "^4.0.39",
    "nodemon": "^1.11.0",
    "react": "^15.4.2",
    "react-dom": "^15.4.2"
  }
}

tsconfig.json (for reasons)

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "noEmitHelpers": true,
    "strictNullChecks": false,
    "baseUrl": "./src",
    "paths": {
    },
    "lib": [
      "dom",
      "es6",
      "es2017"
    ],
    "noUnusedParameters": true,
    "noUnusedLocals": true,
    "noImplicitReturns": true
  }
}

User settings.json

// Coloque su configuración en este archivo para sobrescribir la configuración predeterminada.
{
    "editor.fontFamily": "Hasklig, Consolas, 'Courier New', monospace",
}

Workspace settings.json

{
    "typescript.tsdk": "./node_modules/typescript/lib"
}

Extensions

johnpapa.Angular2
natewallace.angular2-inline
formulahendry.auto-close-tag
formulahendry.auto-rename-tag
msjsdiag.debugger-for-chrome
joelday.docthis
EditorConfig.EditorConfig
christian-kohler.path-intellisense
eg2.tslint
rbbit.typescript-hero

It's literally a five files project.
graphql-postgres.zip

Explorer Process Screens
captura de pantalla 50
captura de pantalla 51
captura de pantalla 52
captura de pantalla 53
captura de pantalla 54
captura de pantalla 55
captura de pantalla 56
captura de pantalla 57
captura de pantalla 58
captura de pantalla 59
captura de pantalla 60
captura de pantalla 61
captura de pantalla 62
captura de pantalla 63
captura de pantalla 64
captura de pantalla 65
captura de pantalla 66

VSCode frozen
captura de pantalla 67

@bpasero
Copy link
Member

bpasero commented Jan 20, 2017

@michaeljota I wonder if this issue is being caused by an installed extension. Can you try to run VS Code without extensions? From the command line (NOT the integrated terminal in Code), execute: code --disable-extensions and try your steps again to see if it reproduces. If you see it is an issue with the extension, please file it against the extension repository itself.

@bpasero
Copy link
Member

bpasero commented Mar 15, 2017

@michaeljota is this still happening with our latest insider build? You can give our preview releases a try from: http://code.visualstudio.com/Download#insiders

@michaeljota
Copy link
Author

I see what you did there. I'll test it and report. 👍

@bpasero
Copy link
Member

bpasero commented May 14, 2017

Let's merge into #3998

@bpasero bpasero closed this as completed May 14, 2017
@bpasero bpasero added the *duplicate Issue identified as a duplicate of another issue(s) label May 14, 2017
@bpasero bpasero added the file-watcher File watcher label Jun 8, 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) file-watcher File watcher freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants