Crashes For Me With DHT22
FlorianWendelborn opened this issue · comments
My Code
var Sensor = require('raspi-sensors').Sensor;
var DHT22 = new Sensor({
type: 'DHT22',
pin: 8
});
var log = function (err, data) {
if (!err) {
console.log(data);
} else {
console.error(err);
}
}
DHT22.fetch(log);
DHT22.fetchInterval(log, 4);
Log output
[nodemon] starting `node dht22.js`
FATAL ERROR: v8::HandleScope::CreateHandle() Cannot create a handle without a HandleScope
Aborted
[nodemon] app crashed - waiting for file changes before starting...
Software
➜ server git:(master) ✗ npm -v
2.14.7
➜ server git:(master) ✗ node -v
v4.2.1
➜ server git:(master) ✗ npm list | grep raspi-sensors
├── raspi-sensors@0.2.6
➜ server git:(master) ✗ uname -a
Linux raspberrypi 4.1.19-v7+ #853 SMP Wed Mar 9 18:09:16 GMT 2016 armv7l GNU/Linux
Hardware
Raspberry Pi 3
Actually I was using an older version of node, and it seems that now the handle scope should be always created, but wasn't in an async callback, causing the V8 crash. This is now fixed and should work !
Thanks, also a question regarding your module - is it truly asynchronous? Some other libraries I tried with my DHT22 actually paused execution for ~500ms every time I read something, yours looks promising judging by the example code. Could you confirm if it's async or not? Thanks
Yeah it's true async, I've used libuv which is what nodejs for its event loop and worker threads.