MeshCore: contacts snapshot fires before ensure_contacts() completes, causing known contacts to be missed on startup #200

Closed
opened 2026-10-04 23:04:04 +02:00 by adam · 0 comments
Owner

When the MeshCore ingestor starts, _try_send_snapshot() in daemon.py is called
immediately after connected_event.set() in runner.py. However, ensure_contacts()
is called after connected_event.set(), meaning the snapshot fires before the
contacts dict is populated. As a result, known contacts (including repeaters and
companion nodes) are not upserted to PotatoMesh on startup.

Steps to Reproduce

  1. Run the MeshCore ingestor with PROTOCOL=meshcore against a companion device
    that has existing contacts
  2. Observe that known contacts do not appear in the PotatoMesh dashboard on startup
  3. Stop and re-run the ingestor manually — contacts appear correctly

Root Cause

In runner.py:

  • connected_event.set() is called at line ~114
  • ensure_contacts() is called at line ~119 after the event is set

In daemon.py:

  • _try_send_snapshot() fires as soon as connected_event is set
  • At this point iface._contacts is still empty
  • initial_snapshot_sent is set to True and never retried

Expected Behaviour

ensure_contacts() should complete before connected_event is set, or the snapshot
should be deferred until contacts have been fetched.

Environment

  • PotatoMesh version: v0.6.3+2-705f15c
  • MeshCore library version: 2.3.7
  • Connection type: Serial (/dev/ttyACM0)
  • OS: Debian/Ubuntu
When the MeshCore ingestor starts, `_try_send_snapshot()` in `daemon.py` is called immediately after `connected_event.set()` in `runner.py`. However, `ensure_contacts()` is called *after* `connected_event.set()`, meaning the snapshot fires before the contacts dict is populated. As a result, known contacts (including repeaters and companion nodes) are not upserted to PotatoMesh on startup. ## Steps to Reproduce 1. Run the MeshCore ingestor with `PROTOCOL=meshcore` against a companion device that has existing contacts 2. Observe that known contacts do not appear in the PotatoMesh dashboard on startup 3. Stop and re-run the ingestor manually — contacts appear correctly ## Root Cause In `runner.py`: - `connected_event.set()` is called at line ~114 - `ensure_contacts()` is called at line ~119 *after* the event is set In `daemon.py`: - `_try_send_snapshot()` fires as soon as `connected_event` is set - At this point `iface._contacts` is still empty - `initial_snapshot_sent` is set to `True` and never retried ## Expected Behaviour `ensure_contacts()` should complete before `connected_event` is set, or the snapshot should be deferred until contacts have been fetched. ## Environment - PotatoMesh version: v0.6.3+2-705f15c - MeshCore library version: 2.3.7 - Connection type: Serial (`/dev/ttyACM0`) - OS: Debian/Ubuntu <!-- github-sync-id:4429614492 -->
adam closed this issue 2026-10-04 23:04:04 +02:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/potato-mesh#200