nRF52 / 28 KB InternalFS: FileStore stores grow far past segment_size × segment_count until the filesystem is full; pool growth stops with RNS_PERSIST_*=0
Follow-up to #109 with new data.
Setup
- Heltec T114 (nRF52840, InternalFS 28 KB, 128 B blocks), env
heltec_t114, TNC/transport mode, LoRa 869.525 MHz BW 250k SF8 - Fed by a home rnsd gateway with the AT-Vienna TCP backbone (hundreds of announces/hour on LoRa)
- microReticulum 0.5.1 (microStore as pulled by PlatformIO)
- TLSF pool 128 KB (
RNS_HEAP_POOL_BUFFER_SIZE=131072),RNS_DEBUG_HEAP
1. Stores do not respect their size limits
Store sizes measured on the node (file sizes, not littlefs blocks):
| config | path_store | known_store | hashlist_store |
|---|---|---|---|
| path 4×2048, known 2×1024, hash 2×512 | 4.9 KB / 4 files | 7.8 KB / 3 files | 5.1 KB / 3 files |
| path+hash in RAM, known 2×1024 on flash | – | ~22 KB within 40 min of a clean boot | – |
With ~24 KB free after boot, known_store alone filled the filesystem in 30–50 minutes, despite a 2 KB nominal limit. With all three stores on flash, the filesystem went from ~10 KB free to <3 KB in about 3 minutes.
Likely cause: in FileStore::put() the result of rotate_segment_if_needed() is ignored on purpose ("Don't fail to put just because rotation fails"). When compact() fails, or during the 60 s USTORE_COMPACT_RETRY_MS cooldown, rotation falls back to current_segment = _segment_count - 1 and the record is appended to the last segment anyway, with no upper bound. On a small filesystem compaction also needs room for compact.tmp, so once space is short it keeps failing and the store keeps growing: a feedback loop.
Consequence: once littlefs has no free blocks, writes fail; on 15 Nov this ended with the RNode eeprom file lost (device unprovisioned, red LED). Reticulum.cpp only clears a store when less than 1024 B are free at init.
Possible fixes (your call): refuse or evict in put() when the last segment is already over _segment_size (for example, drop the oldest segment); a hard cap on total store bytes; or skip persistence by default on targets with only a few KB of free filesystem.
2. Pool growth stops when persistence is off
- With the stores on flash (14 Nov, also on plain upstream
heltec_t114): the pool loses 4–28 KB/h,dflt_active+~175 objects/h (~88 B each), untilbad_alloc. - With
-DRNS_PERSIST_PATHS=0 -DRNS_PERSIST_HASHLIST=0 -DRNS_PERSIST_KNOWN_DESTINATIONS=0 -DRNS_PATH_TABLE_MAX=50 -DRNS_KNOWN_DESTINATIONS_MAX=50(18–19 Nov): 25 h without a reboot, pool used 96–100 KB, largest free block steady at ~16.9 KB for hours,dflt_activeoscillating 1020–1090 with no upward trend.
So the growth looks tied to the FileStore path (index, rotation or compaction), not to transport itself. I have not pinned down the exact allocation.
Current workaround
All three stores in RAM, path and known destinations capped at 50. RAM cost: a path entry keeps the announce packet (up to ~400 B), so 100 path entries in RAM cost ~40 KB of pool; 50 are fine.
Logs and MEM snapshots available if useful.