bugfix: zmq system stalls out if there are no subscribers to ZMQSenderUnit
Closed this issue · 2 comments
Sending messages to ZMQSenderUnit
when it does not have any subscribers will cause it to go into an infinite loop. As messages accumulate, eventually the whole system will stall out.
It's fairly normal in ZMQ applications to publish when there are no subscribers. The messages simply go nowhere. I understand the use case of making sure the first few messages do not get lost while waiting for a consumer to pop up, so I get the need for some mechanism to not lose messages in some cases.
One easy short-term solution is to add a setting to wait_for_subscriber: bool = True
and include a check for that in the while
condition. Personally, I think default should be False
to be consistent with normal zmq operation.
YEAH this causes some really concerning behavior. @pperanich do you have thoughts on this?