I have an app that consumes events from a websocket feed. It calls Registry.dispatch/3 to send messages to subscribed genservers, which then in turn prints them to console. The pipelining is handled by genstage. A producer sits on the socket and generates events with receive calls. The consumer then manages a state and dispatches events to processes in a registry if the state is affected in a specific way. The processes subscribed to the registry would log the event when they receive a message via handle_info/2.
After running the app for ~ 20 minutes, the events stop getting logged to the console without anything happening. In the console, I looked at the registry process and saw the processes had unsubscribed as there were no associated registries with that key, but no errors were thrown and everything happened silently. I also was still getting events so the genstage consumer was still consuming events, and its breaking at the registry dispatching point. I can verify the websocket connection did not close, and events were still being read.
This is a replicable issue. The events stop being printed after about the same delay on each run, which is perplexing. That would make me think there’s a leak of some sort somewhere, but the load graphs on the observer seem to indicate that all is fine. Could it be that the registry is getting overloaded? Maybe it’s being tasked to dispatch too many events and can’t send them fast enough, and eventually the process mailbox overflows?