Node-Red on Omega2+: Segfault on low memory even /w swap active



  • @Theodore-Borromeo

    I would think / hope that the install using the opkg tool would only deliver a version of the code that is for the Omega2? The opkg update shows it's talking to Onion repositories.

    I did follow the instructions from that page, downloaded and extracted the package. Found the location that was the best match (/overlay/upper/usr/bin/onion-node-red/node_modules/node-red/node_modules/ws/) and replaced the contents.

    Node-red started OK, but failed in the exact same way

    Tx!
    Bas



  • @Bas-Rijniersce now that I actually look at the error messages it seems that you need to reduce the size of your base image. Even still, node red might just be taking up the remainder of your 64MB of memory despite that.



  • @Bas-Rijniersce
    http://nodered.org/docs/hardware/raspberrypi.html

    The article above talks about starting node red on a pi such that memory is culled at 256MB! There's also mention of how you can (and should) set the limit at which node.js and node-red begin memory reclamation.

    @Lazar-Demin @Boken-Lin : do you all intend to set the node.js memory limit in the omega openwrt package itself?



  • @Theodore-Borromeo I am reading this message correctly as RAM, correct? We are not talking about free space on the root partition?
    There was plenty of SWAP available to allocate memory for the process. Will give the other article a read later.

    TX!



  • @Bas-Rijniersce no problem. I did mean ram, as I don't know what the swap space size is set at for the omega 2. also, turns out that node red is only built out for omega2, so it's def not an architectural issue. This all makes me wonder why yours is not working when the tutorial seems to imply this should work out of the box. . .



  • @Bas-Rijniersce also, swap space only moves data out of ram based on LRU, it doesn't take away the fact that while in operation, an entire program generally needs to be resident in memory. this would mean that node.js, libv8, and node red at least ( and that's not counting whatever lib you are going to put on to run the web front-end, if at all)



  • @Theodore-Borromeo That is actually untrue. Swapping is per-page, and a program of any size to be an issue is going to have multiple code pages as well as data pages. If execution reaches a page that is not currently in memory, a page fault occurs and execution pauses while it is loaded, the same as would happen if access were attempted to a data page that was not resident in memory.

    This is important, because a large program will have portions which are rarely needed. Going a step further, it varies by implementation, but ideally the program won't even all necessarily be loaded from disk into RAM at the start, but rather portions may only be loaded as needed, even though to the process itself, it will look as if it is all there - it's just those parts won't actually be there until an attempt is made to access them.

    However swapping, especially writeable memory data to an SD scard (or even worse, the build-in SPI flash) is a poor solution. Likely the task is either being done with unnecessary inefficiency, or the wrong platform has been selected, or both.



  • @Chris-Stratton That how I have always understood the use of SWAP by the OS. I can report however that starting node red with:

    node --max-old-space-size=56 red.js

    Has now kept it up for several hours of playing. The 56 was picked by looking at the output of free

    With regards to picking the wrong platform for what I'm trying to do. Completely possible šŸ™‚
    I had not heard of Node Red until a few days ago. I'm trying see if can use the Omega2+ as a cheap sensor platform that can:

    • Interaction with sensors for temp, humidity, voltage, current. It seems that with I2C and ControlEverything products I can do all that
    • Report said data to a central control system for graphing etc
    • Trigger relay closures from a central control system easily
    • Operate without internet connection

    Between Node Red and MQTT it looks like I can do most of that without spending a minute in writing something custom.

    Bas



  • IMHO, more RAM is always a good thing, say 512KB or even 1MB.
    Don't know if there is a production plan and hope the price won't jump too much.

    ccs_hello



  • @Chris-Stratton I have never seen swap pushed that far, or assumed to be that efficient on any embedded system. I think, though, that you've seemed to answer the question with your suspicion on SD card performance. Have you tried class 10 cards on a 2plus? the other option is the max size command, which seems to work for some.



  • @ccs-hello said in Node-Red on Omega2+: Segfault on low memory even /w swap active:

    IMHO, more RAM is always a good thing, say 512KB or even 1MB.
    Don't know if there is a production plan and hope the price won't jump too much.

    it so happens that the smaller and larger configurations of these modules ship with 128 times the memory ranges you propose šŸ˜‰

    This is plenty to do reasonable things efficiently; but it won't be enough for software stacks that assume unlimited resources and consume them even for simple tasks.



  • I must have been sleep typing :} I meant 512MB or 1GB RAM.

    ccs_hello



  • Then you really want a fundamentally different system - the point of these is that router chips have a lot of additional usage possibilities.



  • Per MT7688AN datasheet (yes, it's an AN chip, not KN), it can support up to 256MB DDR2 RAM max.
    Currently it's using a single 16M x 16 bit/word DDR2 SDRAM.(which is equivalent to 128MB RAM.)
    A redesign can use two pieces of MT5TU128M8HE chips in parallel to get to 256MB.
    Naturally the board will be slightly longer.

    ccs_hello



  • @Bas-Rijniersce thanks .. work with me


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.