cncjs-pi-raspbian icon indicating copy to clipboard operation
cncjs-pi-raspbian copied to clipboard

Install on RPI 3 B Plus causing issues with JS memory heap

Open thatSFguy opened this issue 3 years ago • 11 comments

The current NodeJS 12 version is causing issues with the CNCJS installation throwing a JS memory heap / running out of memory error. (Sorry didn't copy the exact error)

After following the instructions several times found at https://cnc.js.org/docs/rpi-setup-guide/ , I found this install script. However, it had the same issue. Finally I found the issue opened with the RPI Zero, which seems to have a similar NodeJS problem.

The solution presented there also worked for me by first installing Nodejs 10 with:

mkdir node cd node wget https://unofficial-builds.nodejs.org/download/release/v10.24.1/node-v10.24.1-linux-armv6l.tar.xz tar xvfJ node-v10.24.1-linux-armv6l.tar.xz sudo cp -R node-v10.24.1-linux-armv6l/* /usr/local cd .. rm -rf node

Then run the rest of the script as described on the main page, but deselect the Node install/upgrade option :

URL="https://raw.githubusercontent.com/cncjs/cncjs-pi-raspbian/master/cncjs_install.sh" curl -sSL ${URL} | bash

image

thatSFguy avatar Jan 08 '23 23:01 thatSFguy

Just to confirm, NodeJS 12 is causing you issues and crashing? I have not encountered this issue. Will try to do some more testing if time permits. Thanks for posting a work around here in the meantime.

AustinSaintAubin avatar Jan 09 '23 02:01 AustinSaintAubin

Correct. I tried NodeJS 12, 16,18, and 19. all ended up with a memory heap crash.

thatSFguy avatar Jan 09 '23 03:01 thatSFguy

BTW, Thanks so much for putting together this amazing piece of software! I've used Octoprint for several years and was looking for something similar in CNC. Although I've not made my first cuts yet with my modded 1998 Denford micromill, I think CNCJS will really ease the transition. Thanks again!

thatSFguy avatar Jan 09 '23 04:01 thatSFguy

@thatSFguy, I can only take credit for some of the raspberry pi integration work. @cheton is the original author, and many others have contributed.

Will try to conduct some testing with an RP3B... but I don't one that is not in use at the moment... when RP4 become available I recommend upgrading to one.

Glad you are enjoying the software, and the raspberry pi install script made some of the work simpler.

AustinSaintAubin avatar Jan 09 '23 05:01 AustinSaintAubin

I just wanted to point out that when the CNCJS install fails the install script still continues on, even if it can't find the cncjs executable for further setup. It maybe good to have a check to ensure the install was successful, prior to continuing the script.

P.S. I also tried export NODE_OPTIONS="--max-old-space-size=8192" to no avail.

thatSFguy avatar Jan 10 '23 03:01 thatSFguy

I am having this same issue with my RPi 2B, I modified your script to install nodejs 10 with "Raspbian" 11 since nodejs 10 seems to work for a lot of people, so I will let you know if that helps at all.

Edit: Nevermind actually, I was always trying to do a CNCjs install by manually getting the NodeJS repo (12/14/16/18) and they all failed with the memory heap issues. I found your script and noticed that it just installs nodejs without adding any repos (as long as the OS is not "Raspbian" 10 or older) so I figured I would try your script without modification and it seemed to work? Tons of deprecated warnings, but that seems common since CNCjs is borderline abandoned due to funding issues as I understand it, but it seems to have installed properly.

There are no real alternatives to CNCjs that are more actively maintained correct? I found some plugins for Octoprint, but in my experience Octoprint can be a buggy mess as well.

Cjkeenan avatar Jan 14 '23 05:01 Cjkeenan

I think this might just be an issue when installing on Raspberry Pi OS with desktop. I have been testing on Raspberry Pi OS Lite with no issues.

I think Raspberry Pi OS with desktop comes pre-installed with a version of Node.js.... Still doing some testing to figure out what is the cause. Might try uninstalling Node.js first, then re-running the script and installing everything...


@Cjkeenan CNCjs is still one of the best options to spite the bugs (in my opinion). Though is heavy and best to run on RP3 or RP4 (or similar), with a fast SD card or flash drive.

It does take a lot of effort to build a project like this. If you like it support it by becoming a backer. I personally do not receive any of these contributions, I just want to see the project grow.

AustinSaintAubin avatar Feb 10 '23 15:02 AustinSaintAubin

Though is heavy and best to run on RP3 or RP4 (or similar), with a fast SD card or flash drive.

I have been running this without many issues on my 2B. How would I identify that I am running into performance issues? The webpage seems plenty snappy. Would I be seeing a difference in cut quality like you sometimes do when using Octoprint on a less powerful system?

Cjkeenan avatar Feb 10 '23 19:02 Cjkeenan

@Cjkeenan, run htop while CNCjs is preforming operations. Video stream is also a heavy load on the CPU.

AustinSaintAubin avatar Feb 11 '23 01:02 AustinSaintAubin

I'm not doing any video streaming

Cjkeenan avatar Feb 11 '23 01:02 Cjkeenan

Fyi- I did not install the desktop version when I got the error on my 3B. Hope that helps.

Everything is working fine with my workaround...including streaming.

Cheers!

thatSFguy avatar Feb 11 '23 01:02 thatSFguy