You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In autopahomanagePublishQueue we call PublishWithOptions and if an error is returned wait on the connection to drop before trying again (so we assume that if PublishWithOptions returns an error then it's fatal). This is not a valid assumption because publish may return at other times; for instance if c.PacketTimeout is exceeded.
Solving this is going to require a bit of thought and modifications to paho; consider publishQoS12:
So if we are attempting to send a lot of messages and c.Session.AddToSession blocks for, by default, 10 seconds then publishQoS12 returns an error without actually making an attempt to send the message (due to c.PacketTimeout). This makes it difficult for the caller to know what to do when it receives an error (should it retry or should it expect the connection to drop due to a protocol error).
I think there is a quick fix and a longer term project here:
Quick fix - Autopaho should retry publishing from the queue if PublishWithOptions returns an error (checking the connection status before doing so)
Longer term - Modify Publish such that it's clear if the error is fatal (connection will drop) or can be retried. It would also be good to clarify the meaning of c.PacketTimeout (personally I don't like the way it's used in Publish; the function already takes a Context so adding an additional timeout is a bit confusing).
The fix I have just merged should prevent this from being an issue with autopaho. However it would be good to review this code further and see if there is a better way of handling things (this might include looking at what to do if the client gets stalled due
to receive maximum depletion - should we drop the connection if this happens?).
Describe the bug
In
autopaho
managePublishQueue
we callPublishWithOptions
and if an error is returned wait on the connection to drop before trying again (so we assume that ifPublishWithOptions
returns an error then it's fatal). This is not a valid assumption because publish may return at other times; for instance ifc.PacketTimeout
is exceeded.Solving this is going to require a bit of thought and modifications to
paho
; considerpublishQoS12
:So if we are attempting to send a lot of messages and
c.Session.AddToSession
blocks for, by default, 10 seconds thenpublishQoS12
returns an error without actually making an attempt to send the message (due toc.PacketTimeout
). This makes it difficult for the caller to know what to do when it receives an error (should it retry or should it expect the connection to drop due to a protocol error).I think there is a quick fix and a longer term project here:
PublishWithOptions
returns an error (checking the connection status before doing so)c.PacketTimeout
(personally I don't like the way it's used inPublish
; the function already takes aContext
so adding an additional timeout is a bit confusing).Software used:
@master
The text was updated successfully, but these errors were encountered: