WiringPi / WiringPi-Node

Node.js bindings to wiringPi
334 stars 94 forks source link

V8 fatal error #30

Closed PeterBorisenko closed 8 years ago

PeterBorisenko commented 8 years ago

Hi. While handling interrupt I've got the following error: FATAL ERROR: v8::HandleScope::CreateHandle() Cannot create a handle without a HandleScope

My code is below:

var gpio = require('wiring-pi');
gpio.setup('wpi');

//inputs
var signalStartMovie= 7;
//outputs
var signalMovieEnded= 5;

gpio.pinMode(signalMovieEnded, gpio.OUTPUT);
gpio.pinMode(signalStartMovie, gpio.INPUT);
gpio.pullUpDnControl(signalStartMovie, gpio.PUD_UP);

gpio.wiringPiISR(7, gpio.INT_EDGE_FALLING, function(delta) {
    console.log("Interrupt!", delta);
    //gpio.wiringPiISRCancel(signalStartMovie);
});

setInterval(function () {
    gpio.digitalWrite(signalMovieEnded, gpio.HIGH);
    console.log(gpio.digitalRead(signalStartMovie));
    setTimeout(function () {
        gpio.digitalWrite(signalMovieEnded, gpio.LOW);
    }, 500);
}, 1000);

What is this? How to solve?

nekuz0r commented 8 years ago

Which version of nodejs are you using ?

PeterBorisenko commented 8 years ago
C:\Windows\System32>node --version
v0.12.4
nekuz0r commented 8 years ago

Is it reproducible with your code ? Is it happening directly or random ?

xseignard commented 8 years ago

Hello same error here.

With Raspbian Jessie Lite, node v4.2.1 and 2.1.0 of this module.

Here is a simple code that makes V8 crash, and it seems to be reproducible.

var wpi = require('wiring-pi');
var btnPin = 4;

wpi.setup('wpi');
wpi.pinMode(btnPin, wpi.INPUT);
wpi.pullUpDnControl(btnPin, wpi.PUD_UP);
wpi.wiringPiISR(btnPin, wpi.INT_EDGE_FALLING, function(delta) {
    console.log('btnPin changed to LOW (', delta, ')');
});
benallen-dev commented 8 years ago

I am getting this issue also, it occurs even when using the sample code in the documentation.

A workaround could be implemented using polling instead of interrupts but I haven't tested this approach yet.

benallen-dev commented 8 years ago

PS I'm using Raspbian Wheezy, all up to date.

Illizian commented 8 years ago

:+1: I'm also seeing this issue, with the example code and a simple push button.

$ uname -a
Linux alarmpi 4.1.15-1-ARCH #1 Tue Dec 15 18:28:56 MST 2015 armv6l GNU/Linux

$ node --version
v5.3.0

UPDATE: @taoyuan's fix #34 resolves this for me.

nekuz0r commented 8 years ago

Fixed, closing