I’m in the middle of trying to resolve out of memory issues on the roboRIO.
Adding a swap partition on a USB drive is working as a quick fix.
In spite of the swap partition being listed in /etc/fstab, the swap partition is not being used at system startup; I need to hand issue a swapon -a
. I suspect the swapon -a
in the startup procs is being issued before the USB is fully up.
In the old days, I could put stuff into /etc/rc.local on my Unices. Is the equivalent available on the roboRIO, or do I have to write my owner rcS.d script?
These days a udev rule to take action is probably the most proper. Something along the lines of this is what I’m thinking. Add a udev rule to run a script when usb is un/plugged - Debian User Forums
Would it be possible to allocate some of the storage of the rio as swap, I feel like USB’s can get unplugged during matches which would be really unfortunate if it led to a dead code.
yes, swapping to onboard flash is possible.
the flash memory only has a limited number of writes in it’s lifetime, and swapping has the ability to tear through those pretty fast. I’d hate to kill a roboRIO because I wore out the flash.
2 Likes
Hmm, thats fair, but not playing a match is about $200 plus opportunity cost while rios are about $500 so I think that might be a sacrifice I am willing to make instead of risking matches.
yeah, I agree.
but this is just a workaround until I get to the root cause of the issue; hopefully resolved before first match.
Recommend disabling the NI web server to reclaim some memory. The RoboRIO Team Number Setter can do this: roboRIO Team Number Setter — FIRST Robotics Competition documentation
I did this and then the work around by changing the script running lvrt, however that ended up forcing me to run robot code from the terminal :(.
Unfortunately, I am still often running out of memory.
roboRIO 2’s generally don’t have memory issues. They have double the memory, and the storage is on the SD card. If you’re willing to sacrifice the $500, you can buy a roboRIO 2, which likely won’t have low memory issues, and also you could put swap on the SD card, which is easily replacable.
We can, and we may. I am reluctant to use it for competition; saw lot’s of trouble with them at the events I CSAd at. I’ll use them if I can’t get a roboRIO to be reliable.
1 Like
Done as admin:
Wrote /etc/init.d/addswap.sh:
#!/bin/sh
### BEGIN INIT INFO
# Provides: swap
# Required-Start: udev
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Add swap space
# Description:
### END INIT INFO
[ -x /sbin/swapon ] && swapon --summary
echo "Adding Swap"
[ -x /sbin/swapon ] && swapon --all --ifexists --verbose
[ -x /sbin/swapon ] && swapon --summary
: exit 0
Added to the sysv init scheme: update-rc.d -v addswap.sh defaults
Added a line to bottom of /etc/fstab:
/dev/sda1 none swap sw 0 0
Put a thumb drive in that has a swap partition as the first one.
Reboot.
I have swap space.