rwaldron / galileo-io

Intel Galileo & Intel Edison IO Plugin for Johnny-Five
http://johnny-five.io
MIT License
101 stars 26 forks source link

galileo-io is maxing out the CPU #18

Closed adampasz closed 9 years ago

adampasz commented 9 years ago

SUMMARY

Simply requiring the galileo-io library consumes 90-100% CPU.

STEPS TO REPRODUCE

  1. Install the latest version (0.3.10) of galileo-io on a Galileo Gen. 2 with MRAA.
  2. Create a file with the following code, and run it as a background process:
var Galileo = require("galileo-io");
setInterval(function() {
  console.log('tick');
}, 5000);
  1. Use top to monitor CPU usage, and observe that the CPU for your node process is around 90%.

Note: We are also able to max out the CPU on a Mac running the code above.

rwaldron commented 9 years ago

Thanks for the report. I've been meaning to come back to this, but things pile up.

adampasz commented 9 years ago

0% CPU. Verified on Mac OS and Galielo Gen. 2 w/ IOT build. Thanks for the quick fix!

rwaldron commented 9 years ago

@adampasz excellent, thanks for filing this :)

m0x72 commented 9 years ago

setImmediate requires node >= 0.10, should bump package.json requirment ;)

rwaldron commented 9 years ago

@m0x72 sure thing, but I'm curious to know where you were running this with 0.8?

m0x72 commented 9 years ago

@rwaldron haha, a hackathon where some folks from Intel brought a couple dozen galileos to work with. All were running node on 0.8 and their preparred example depended on your package. Ended up using a 0.3 version of yours or replacing the immediates with timeouts (which worked sufficiently well for us) :)

rwaldron commented 9 years ago

Damn, I'm sorry. It's too bad that some teams at Intel are still pushing that linux image, while others have deemed it effectively retired. I will fix the lib accordingly. Sorry for the pains

datdinh181294 commented 8 years ago

Everybody help me! I had a problem when I was installing galileo-io package. Can you help me the problem? image Thanks all in advance.