Mobile callsign subscribers go silent for the rest of the session after a SpatialPubSub restart #54
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Aprsme.SpatialPubSubis a plain supervised child with in-memory state. If it dies and restarts, every connected socket keeps its Phoenix PubSub subscription but has no registration, so packets stop arriving with no error frame and no disconnect, which means the client's reconnect logic never fires. A client that pushessubscribe_callsignagain getsstatus okplus replayed history and then silence again, because the handler short-circuits on the socket assign. A bounds subscriber only recovers if the user happens to pan, sinceupdate_boundsis the one path that handles{:error, :not_registered}.Evidence
At
2f150f66:lib/aprsme/application.ex:43startsAprsme.SpatialPubSubwith no persistence, andlib/aprsme/spatial_pubsub.ex:89rebuilds%{clients: %{}, spatial_index: %{}}on init.lib/aprsme_web/channels/mobile_channel.ex:810returns{:ok, socket}whencallsign_subscription_active?/1is true, without re-registering.lib/aprsme_web/channels/mobile_channel.ex:774is the{:error, :not_registered}recovery clause, reached only from the bounds update path.lib/aprsme/spatial_pubsub.ex:525treats a missing grid key as an empty client list, so an unregistered socket matches nothing.Expected
A subscribe, or a registration check on the live packet path, re-establishes the registration, so a supervisor restart costs at most one message rather than the rest of the session.
How to verify
In
test/aprsme_web/channels/mobile_channel_test.exs, killAprsme.SpatialPubSub, wait for the restart, pushsubscribe_callsignagain, broadcast a packet, and assert a push arrives. Todayassert_pushfails.Acceptance criteria
Effort: S
Lens: reliability