Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raspberry Pi 3 node app aborted #24

Open
cesarGlz91 opened this issue Sep 14, 2017 · 2 comments
Open

Raspberry Pi 3 node app aborted #24

cesarGlz91 opened this issue Sep 14, 2017 · 2 comments

Comments

@cesarGlz91
Copy link

cesarGlz91 commented Sep 14, 2017

Hi! Im trying to interface a relay board interfaced by a ftdi chip. At this moment i can manage to install everything correctly, read the list of ftdi devices connected, open the device and write to it. After several writes to the device im getting this errors causing my node app to abort:

*** Error in `node': free(): invalid pointer: 0x6fc004ff ***
Aborted

Also some times it outputs this:

*** Error in `node': munmap_chunk(): invalid pointer: 0x6fb0042b ***
Aborted

I tried to run this app with both scenarios: node 8.4.0 with npm 5.3.0 and node 6.11.3 with npm 3.10.10 but still i get the same results.

Im using Raspbian Stretch image on my Raspberry Pi 3

This is my test application where i simply write a random byte to the 8 relay board each second:

const ftdi = require('ftdi');
const crypto = require('crypto');
let device;

const setRandomRelays = () => {
    const buffer = crypto.randomBytes(1);
    device.write(buffer, err => {
        if (err) console.log('FTDI Write Error: ' + err);
        else console.log('FTDI Write successful: ' + buffer.toString('hex'));
    });
    setTimeout(() => setRandomRelays(), 1000);
};

ftdi.find((err, devices) => {

    if (devices.length === 0) {
        console.log("No FTDI devices found");
    } else {

        device = new ftdi.FtdiDevice(devices[0]);
        console.log(device);

        device.on('error', e => {
            console.log('FTDI error ' + e);
        });

        device.open({
                baudrate: 921600,
                databits: 8,
                stopbits: 1,
                parity: 'none',
                bitmode: 'sync', // for bit bang
                bitmask: 0xff    // for bit bang
            },
            err => {

                if (err) {
                    console.log(err);
                    return;
                }

                device.on('data', data => {
                    console.log('FTDI on data: ' + data.toString('hex'));
                });

                setRandomRelays();

            });
    }
});

this is an output of the node app:

FtdiDevice {
  domain: null,
  _events: {},
  _eventsCount: 0,
  _maxListeners: undefined,
  deviceSettings: 
   { description: 'FT245R USB FIFO',
     serialNumber: 'A700D6Y1',
     locationId: 262,
     index: 0,
     vendorId: 1027,
     productId: 24577 },
  FTDIDevice: FtdiDevice {} }
FTDI Write successful: 40
FTDI on data: 18
FTDI Write successful: 26
FTDI on data: 40
FTDI Write successful: f3
FTDI on data: 26
FTDI Write successful: b5
FTDI on data: f3
FTDI Write successful: bf
FTDI on data: b5
FTDI Write successful: 37
FTDI on data: bf
FTDI Write successful: 82
FTDI on data: 37
FTDI Write successful: 8e
FTDI on data: 82
FTDI Write successful: 6e
FTDI on data: 8e
FTDI Write successful: b5
FTDI on data: 6e
FTDI Write successful: b2
FTDI on data: b5
FTDI Write successful: ff
FTDI on data: b2
FTDI Write successful: 4b
FTDI on data: 00
*** Error in `node': free(): invalid pointer: 0x6fc004ff ***
Aborted

Maybe it has something to do with the node addon build and my version of node-gyp. Does someone know how to fix this?

@twr7
Copy link

twr7 commented Nov 8, 2018

Is there any update on this topic? I am having the same issue.
I am sending characters from terminal that should be processed and printed on node.js. After a couple of characters the buffer is corrupted and I receive one of the the problems mentioned above.

Thanks and Br,
// Tibor

@wired8
Copy link

wired8 commented Oct 8, 2020

Getting exactly the same issue. @cesarGlz91 did you manage to find a solution?

PID 14485 received SIGSEGV for address: 0x36312044
/noisemeter-collector/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x242c)[0x7638842c]
/lib/arm-linux-gnueabihf/libc.so.6(__default_rt_sa_restorer_v2+0x0)[0x76c251a0]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants