microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.36k stars 12.41k forks source link

Newest version 1.33.1 has electron_node tsserver.js eating up 100% cpu randomly #31341

Closed danboyle8637 closed 5 years ago

danboyle8637 commented 5 years ago

So this seems to be a recurring issue over the years. But there also appears to be no definitive solution either.

Here's what my process manager is showing: Screen Shot 2019-04-19 at 11 14 04 AM

Not entirely sure why. I'm not coding in Typescript... I'm not using any clear extension that's typescript related... unless ESLint does this, which I wouldnt be surprised about.

I have reverted back to version 1.32 and everything runs like a dream.

Intellisense is FAST. No code highlighting issues.

I just wanted to bring this back up.

I'm working on a tight deadline for two sites so once I get these done I will try to get my tslog info... but in the meantime I wanted to see if anybody else has experienced this and found a solution that I have not come across yet.

Thanks!

mjbvz commented 5 years ago

Can you please share some more information about the project, such as the list of dependencies in the package.json

danboyle8637 commented 5 years ago

Hey @mjbvz here's my dependencies...

Screen Shot 2019-05-07 at 8 20 53 PM

It's a gatsby site and nothing special. At this point, it's a plain static site... though that will change in future iterations and updates.

Maybe prettier?

mjbvz commented 5 years ago

Can you please share that as text instead

danboyle8637 commented 5 years ago

@mjbvz Here you go... thanks!

"dependencies": {
    "babel-plugin-styled-components": "^1.10.0",
    "gatsby": "^2.3.34",
    "gatsby-image": "^2.0.41",
    "gatsby-plugin-google-tagmanager": "^2.0.13",
    "gatsby-plugin-manifest": "^2.0.29",
    "gatsby-plugin-react-helmet": "^3.0.12",
    "gatsby-plugin-remove-serviceworker": "^1.0.0",
    "gatsby-plugin-sharp": "^2.0.35",
    "gatsby-plugin-styled-components": "^3.0.7",
    "gatsby-plugin-transition-link": "^1.12.3",
    "gatsby-plugin-typography": "^2.2.13",
    "gatsby-source-filesystem": "^2.0.33",
    "gatsby-source-graphql": "^2.0.18",
    "gatsby-transformer-remark": "^2.3.12",
    "gatsby-transformer-sharp": "^2.1.18",
    "gsap": "^2.1.2",
    "prop-types": "^15.7.2",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-helmet": "^5.2.0",
    "react-transition-group": "^2.9.0",
    "react-typography": "^0.16.19",
    "styled-components": "^4.2.0",
    "typeface-montserrat": "0.0.54",
    "typeface-quicksand": "0.0.71",
    "typography": "^0.16.19"
  },
  "keywords": [
    "gatsby"
  ],
  "license": "MIT",
  "scripts": {
    "build": "gatsby build",
    "develop": "gatsby develop",
    "start": "npm run develop",
    "format": "prettier --write \"src/**/*.js\"",
    "test": "echo \"Write tests! -> https://gatsby.app/unit-testing\""
  },
  "devDependencies": {
    "prettier": "^1.17.0"
  },
mjbvz commented 5 years ago

Thanks. I tested this but can't repo the perf issue using VS Code insiders on a new gatsby site with those dependencies. Sometimes the memory usage would climb but it drops back down once garbage collection kicks in

Can you please test this on VS Code insiders. If you can share the logs or the project itself, I can also investigate this better

AasmundEndresen commented 5 years ago

@mjbvz I've been having the same issue on my projects ever since upgrading to 1.33.0 and have been crawling through answers looking for a solution. There seems to be ALOT of people experiencing this and closing or tagging all of them with needs more info is not very helpful, and makes it extremely hard to look for useful information.

If this issue is tracked somewhere could you please either link where it's tracked, or stop closing all the issues?

It's not very good that the only solution I've found so far is having to disable TypeScript/Javascript Features which essentially disables Intellisense too...

danboyle8637 commented 5 years ago

@mjbvz My code is public on my profile. It's the thistimefitness repo.

I did test the insiders and still got the same problem. I looked at my logs but there wasn't much there.

To make sure I was grabbing the right logs, I used the quick navigation... typed logs... and looked at main logs.

But there was nothing going on there.

Are there other logs I should be looking at?

mjbvz commented 5 years ago

Thanks. I could repo some sluggish performance with the following steps:

  1. git clone https://github.com/danboyle8637/thistimefitness.git
    cd thistimefitness
    npm i
  2. Open folder in vscode and go to CallToActionSection.js

This looks like the same issue as #31302 since I usually see the poor performance in files that reference styled-components

danboyle8637 commented 5 years ago

Just curious... why would version 1.32.3 be so fast with styled-components?

Do you recommend something else like Emotion?

mjbvz commented 5 years ago

See https://github.com/microsoft/TypeScript/issues/30819 for details about the root cause. You can change the TS version used in VSCode by following these instructions

ahejlsberg commented 5 years ago

Best I can tell this is fixed by #31354. I tried the setup described above with #31354, and other than 10-15 seconds of CPU activity right after opening the folder, I'm not seeing much CPU load and statement completion is pretty much instantaneous.

John-Yue commented 5 years ago

快被这个问题折磨疯了!!! 从网上看有3中方法,

  1. 设置files.exclude 和files.watcherExclude,关于内容你们肯定都看过。
  2. rm -r /home/(user name)/Library/Cache/typescript/* 这个我试了一下,时灵时不灵
  3. disable TypeScript/Javascript Features,这是最管用的...