Skip to content

Fix orphan blob accumulation on firmware upgrade#26

Open
weebl2000 wants to merge 4 commits intodevfrom
fix/onetime-blob-cleanup
Open

Fix orphan blob accumulation on firmware upgrade#26
weebl2000 wants to merge 4 commits intodevfrom
fix/onetime-blob-cleanup

Conversation

@weebl2000
Copy link
Owner

Fixes meshcore-dev#1519

Related: meshcore-dev#1495

What's this about?

PR meshcore-dev#1495 fixed the blob leak going forward, but devices upgrading from older firmware (like v1.11.0) still have thousands of orphan blobs sitting in /bl/ eating up storage space.

This adds a one-time cleanup that runs on first boot after upgrade - it just walks through /bl/, checks each blob against the contacts list, and deletes any that don't belong to an actual contact. A marker file prevents it from running again.

Only affects ESP32 and RP2040 (the platforms that use the /bl/ directory).

This code can probably be removed after a few releases once most users have upgraded past this version.

Note

I also experimented with an LRU approach that caps blob count and evicts oldest files periodically - works well as an ongoing safety net, but this simpler approach should be enough for the upgrade cleanup.

Testing

  • Flash on a device with existing orphan blobs
  • Check cleanup runs once and cleans up the orphans
  • Reboot and verify it doesn't run again
  • Make sure legit contact blobs are still there

Build firmware: Build from this branch


Mirror of meshcore-dev#1601

@weebl2000 weebl2000 force-pushed the fix/onetime-blob-cleanup branch from fca93c7 to 8e71508 Compare February 28, 2026 18:17
liamcottle and others added 3 commits March 4, 2026 01:39
Before PR#1495, blobs were written for every advert regardless of
whether the advertiser became a contact. Nodes upgrading from older
firmware (e.g., v1.11.0) have thousands of orphan blobs consuming
storage space.

This adds a one-time cleanup on first boot that:
- Iterates all blob files in /bl/
- Deletes any blob that doesn't match a current contact's pub_key
- Creates a marker file to prevent running again

Affects ESP32 and RP2040 platforms (which use /bl/ directory).
@weebl2000 weebl2000 force-pushed the fix/onetime-blob-cleanup branch from 8e71508 to 8325a40 Compare March 3, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants