Code Monkey home page Code Monkey logo

Comments (20)

DaveyEdwards avatar DaveyEdwards commented on May 20, 2024 4

Was also getting this issue on Windows 10 causing 100% CPU usage
2017-12-27_14-25-33

from import-cost.

overra avatar overra commented on May 20, 2024 4

Same on Mac OS 10.13.1. Interestingly it didn't show high CPU usage in Activity Monitor, I only knew something was up because my CPU temps were about 70c.

from import-cost.

shahata avatar shahata commented on May 20, 2024 4

Hi everybody, terribly sorry for this. The issue was introduced in the last release and I am now working on a fix.

from import-cost.

soanvig avatar soanvig commented on May 20, 2024 1

Confirmed on Fedora 27 x64, VS Code 1.19.0.

Import Cost is eating 100% of CPU plus it stays open after quitting VS Code (which may be another issue, or may be the related to the same problem). Disabling it "fixes" the problem.

from import-cost.

liximomo avatar liximomo commented on May 20, 2024 1

+1

from import-cost.

jnachtigall avatar jnachtigall commented on May 20, 2024 1

Same on Windows 10 with

import difference from 'lodash-es/difference';
import includes from 'lodash-es/includes';

Calculating is shown forever and CPU goes up to 100%.

from import-cost.

shahata avatar shahata commented on May 20, 2024 1

Fixed in version 2.6.2. Plz update if you see more such issues. Thanks and again sorry for this!

from import-cost.

jruif avatar jruif commented on May 20, 2024

I found the cause of the problem, The following code will cause high CPU usage.

import Transition from 'react-transition-group/Transition';

Because the installation directory for the react-transition-group is like this

--node_modules/
|---- react-transition-group/
     |----dist/
     |----utils/
     |----node_modules/
     |----CSSTransition.js
     |----index.js
     |----Transition.js
     |----TransitionGroup.js
     |----README.md
     |----package.json
     |----License

import-cost will lead to result in an error

[Extension Host] debugger inspector at %cmodule.js:472
    throw err;
    ^
Error: Cannot find module '..../node_modules/react-transition-group/Transition/package.json'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at calcSize (.../.vscode/extensions/wix.vscode-import-cost-2.6.0/node_modules/import-cost/dist/src/webpack.js:34:21)
    at handle (..../.vscode/extensions/wix.vscode-import-cost-2.6.0/node_modules/worker-farm/lib/child/index.js:44:8)
    at process.<anonymous> (..../.vscode/extensions/wix.vscode-import-cost-2.6.0/node_modules/worker-farm/lib/child/index.js:51:3)
    at emitTwo (events.js:106:13)
    at process.emit (events.js:194:7)
    at process.nextTick (internal/child_process.js:766:12)

The code segment:
https://github.com/wix/import-cost/blob/master/packages/import-cost/src/webpack.js#L20

  const importedPkg = require(path.join(modulesDirectory, packageInfo.name, 'package.json'));

from import-cost.

hannupekka avatar hannupekka commented on May 20, 2024

Same here on Mac OS 10.13.2, VSCode 1.19.1 and Import Cost 2.6.0

from import-cost.

elboletaire avatar elboletaire commented on May 20, 2024

Ok I commented in the macOs thread, but it's the same...

So here I paste the link to it: #47 (comment)

from import-cost.

ffxsam avatar ffxsam commented on May 20, 2024

Same here on Ubuntu 17.10. Glad I figured out which extension was slowing my machine down. 😠

from import-cost.

ryansully avatar ryansully commented on May 20, 2024

@jruif From your example it looks like it thinks Transition is a directory from the import ('react-transition-group/Transition') and so looks for a package.json file where one does not exist; getting package.json from react-transition-group instead of react-transition-group/Transition would be the desired effect.

Curious why that causes such a CPU spike.

In any case, this seems to be a recent issue as a side effect of b33b3eb, since that line you traced is only introduced with that commit.

from import-cost.

TimeBandit avatar TimeBandit commented on May 20, 2024

I am flagging the issue here as it seems closely related. When VSCode cant find a module that you are requiring it will result it high CPU load instead of a graceful error message. In the screen shot I am requiring individual methods from the 'express-validator' library. Since VSCode cant find it, it seems to go into free-fall and repeatedly throws the same error message as can be seen from the developer view.

screenshot from 2018-01-09 12-08-02

It took me a while to figure out what was going on and I considered going back to Sublime Text after two weeks. The editor should be giving a friendly warning not turning my work station into a fan heater :-)

My work around for now is to simply comment out the code and to restart VSCode.

screenshot from 2018-01-09 12-26-16

from import-cost.

elboletaire avatar elboletaire commented on May 20, 2024

Can someone change the title to Ubuntu instead of Ubunto? I did not find this post the first time due to that (searched for 'Ubuntu', got zero results).

from import-cost.

soanvig avatar soanvig commented on May 20, 2024

from import-cost.

elboletaire avatar elboletaire commented on May 20, 2024

Yeah, and that's why there's already a MacOS issue, and that's why I wrote my problem there (and not here) ... #47

from import-cost.

Tyriar avatar Tyriar commented on May 20, 2024

Hi I'm on the VS Code team, there have been several reports on our repo and on Twitter which mostly seem to point to this extension. @shahata has any progress been made? This is affecting a lot of users.

Also #47 can be merged into this issue.

from import-cost.

mxschmitt avatar mxschmitt commented on May 20, 2024

@shahata do you think that this fix is also relevant to #35? So we can close this too.

from import-cost.

shahata avatar shahata commented on May 20, 2024

@maxibanki actually you reported that memory leak before I released the version with the bug, so that might be something different. Are you no longer seeing the memory leak?

from import-cost.

mxschmitt avatar mxschmitt commented on May 20, 2024

I'm currently not using the extensions anymore, but I will reinstall to test it. Do you think, that 1,7GB of memory usage is normal? Let's use my thread for forther discussions. :)

from import-cost.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.