nornagon / saxi

Tools & library for driving the AxiDraw pen plotter
GNU Affero General Public License v3.0
469 stars 54 forks source link

Saxi becomes unresponsive while plotting, and Axidraw starts/stops too #194

Closed lostPixels closed 11 months ago

lostPixels commented 11 months ago

I'm running Saxi remotely on a RPI and experiencing some odd behavior when plotting. The UI becomes unresponsive, and the Axidraw sputters. The oddest thing is that the machine will return to normal function if the UI is closed. This has led me to quickly closing the tab once I hear the stepper engage, which doesnt always eliminate the possibility that the steppers will sputter and lose alignment.

Ive experienced this with many different SVGs of various complexities.

In the attached image you can see the http response time grow to be quite large.

Also included is a video of the Axidraw as it sputters: https://imgur.com/a/pq8US58

Saxi version: 0.15.0 Node Version: v18.16.1 Using NVM: Yes Raspberry Pi version: 4 Axidraw: V3/A3 (newest Firmware)

Plot File: 20mb~ SVG

Update: Downgrading to version 0.13.0 will resolve this issue for now.

Screenshot 2023-10-14 at 9 08 46 AM
jedahan commented 11 months ago

As a sanity check, i looked at the length of a serialized plan for the following svg.

svg is 800kb, JSON.stringify().length / 1024 / 1024 = 9.26 Megabytes

I generally expect the rendered paths to be much larger than the svg (vector to raster, all that jazz), but this seems a bit excessive.

If its a matter of timing and blocking on the server, there might be simple fixes, like enabling gzip support.

If its a memory usage thing, we might want to try more compact representations.

This might be a red herring, but its a start.

test

jedahan commented 11 months ago

Note that I have experienced this issue, and was able to stop it completely by removing WebSerial support from the repo. It would be ideal to fix webserial though, see alexrudd2/saxi#89

alexrudd2 commented 11 months ago

I think this is the same as https://github.com/nornagon/saxi/issues/131

It's harder to reproduce on more powerful hardware, but most people on RPi's usually see it intermittently

alexrudd2 commented 11 months ago

@lostPixels

Can you try the code in this pull request: https://github.com/alexrudd2/saxi/pull/113 and see if it helps any?

lostPixels commented 11 months ago

Hey @alexrudd2 , I spent a while this morning getting the dev version on to my RPI but couldnt get it to run, I kept getting Error: listen EADDRINUSE: address already in use :::9080

I can report though that moving back down to 0.13.0 had resolved my glitching issue for now.

alexrudd2 commented 11 months ago

Hey @alexrudd2 , I spent a while this morning getting the dev version on to my RPI but couldnt get it to run, I kept getting Error: listen EADDRINUSE: address already in use :::9080

OK, that's usually pretty straightforward. Something is running on your computer on port 9080, either another instance of saxi or some other program. You can either restart the machine or pass e.g. --port 9081.

jedahan commented 11 months ago

Next steps might be to figure out how to profile memory usage after loading a plan, and then see what changes help.

Following https://nodejs.org/en/docs/guides/diagnostics/memory .