raw

Loam's delivery-node workarounds: what upstream already fixes, and what to fix where

2026-11-13. Compared against logos-delivery master (6403f54) and v0.40.0-rc.3.

Why none of upstream's fixes reach us yet: phones run our patched copy of the delivery library (based on v0.38.1). Desktops are pinned to delivery_module 0.3.0 (wraps v0.39), because 0.3.3 and 0.4.0 still have the dropped-messages bug (logos-delivery-module#169). Until we move to v0.40, every workaround below stays.

1. Already fixed upstream — remove once on v0.40

Loam workaround Upstream now
No-peers watchdog: the phone calls connect() on the entry nodes after 30–60 s at 0 peers; the desktop stops and restarts the whole node. #4569 (in rc.3): entry-node addresses become static peers, re-dialled at least every 30 s with no retry limit. The desktop stop/start matters most: it also drops every subscription.
Peer count read from the node's metrics text every 3–10 s. node_health_change event and getConnectionStatus; #4685 and #4655 made the status reliable for edge and core nodes.
Re-subscribing every topic on a timer (does nothing on a core node). Edge nodes check their filter subscriptions every 30 s and re-subscribe themselves.
Part of our store pulls: catching up after being offline. The messaging API catches up from the store after offline periods (#4246, #3941) and picks store nodes better (#4638, #4725). The pull when a topic is first joined stays until #4739 ("backfill messages sent before a subscribe").

2. Needs a change in the delivery library

  1. Online detection on Android.

    • We patch online_monitor to always report online. Upstream decides it's online with a raw DNS lookup to 1.1.1.1, which fails on Android; while it thinks it's offline the node never dials.
    • The check bypasses the system resolver on purpose, so #4678 (system resolver for normal lookups) doesn't change it.
    • Fix: let the app tell the node "online / offline / network changed". Status asked for the same: item 7 of #3907. If a network change also triggered an immediate re-dial, it would replace our patch, our Android network-state check, and the 30–60 s wait after a Wi-Fi ↔ mobile-data switch.
  2. Native crashes we work around:

    • dialling while offline crashes the node (SIGSEGV);
    • a re-dial and a re-subscribe at the same moment crash it;
    • a second node in the same process crashes it;
    • a store query without a requestId crashes it.

    To reproduce on v0.40 before filing (its new CBOR native interface may change this). Until then, running one native call at a time stays.

  3. Fixed default ports. Plain options default to TCP 60000 / UDP 9000, so a second node on a machine fails to start. In library use, default to a random port or fall back to one.

  4. RLN turns on whenever the preset is "logos.test". To avoid it we copy the preset by hand (cluster, shard count, entry nodes); that copy goes stale (it already lacks the store-node list from #4641). Need "rln: false" alongside the preset, or #4552 (environment overrides for the config).

3. Needs a change in delivery_module

4. Stays in Loam

Loam's shared-node layer (one node serving many apps), not the delivery node's job:

One exception: store queries block the phone's other native calls only because our Android bridge to the library is synchronous. Fix it in the bridge rewrite v0.40 needs anyway.

Suggested order

  1. Rebuild the arm64 library from v0.40.0-rc.3 (the 2026-10-24 build predates #4569).
  2. Rewrite Loam's Android bridge for v0.40's native interface (already a blocker for phones on v0.40).
  3. Put the watchdog and re-subscribe timers behind a switch; rerun "internet off → restart → internet on". Remove the workarounds only if the node heals without them.
  4. File the asks from sections 2 and 3 upstream; comment on #3907 item 7.