Nolan Simpson
Nolan Simpson

Reputation: 1

Is there something wrong with this noflo component?

This is my noflo component, HelloWorld.js - it just takes the string passed in and sends it out.

const noflo = require('noflo');

exports.getComponent = () => {
  if (!input.hasData('in')) {
    return;
  }

  const c = new noflo.Component();

  c.inPorts.add('in', { datatype: 'string' });
  c.outPorts.add('out', { datatype: 'string' });

  c.process((input, output) => {
    const data = input.getData('in');
    output.sendDone({
      out: data,
    });
  });

  return c;
};

I built the sample graph from the Getting started with NoFlo docs, and it works just fine. But now trying my own component (see above), when I try to run a graph that uses it, my system just spins, chews up about 4GB of memory, then spits out:

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

I've already gone through the advice you find about this issue (all the NODE_OPTIONS, memory limit stuff). In fact, I had this "heap" issue on my Linux system and the advice worked then. But now I get the above error (for this noflo project only) on both of my 2 Windows systems, and my Linux system.

Have I coded something incorrectly in the component? Here is my graph, HelloWorld.fbp:

Hello(HelloWorld) OUT -> IN Display(core/Output)

'say it' -> IN Hello

And my npm script:

"flo-hello": "noflo-nodejs --graph graphs/HelloWorld.fbp --batch --debug",

Upvotes: 0

Views: 65

Answers (1)

bergie
bergie

Reputation: 930

The input.hasData('in') part needs to be in the processing function, not in getComponent

Upvotes: 0

Related Questions