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
We set AutoReconnect to false in our ClientOptions. When the connection to the broker is lost unexpectedly, we see the following error come from this library:
[client] BUG BUG BUG reconnection function is nil
Tracing through the code, this is because disDone is assigned like so.
Since c.options.AutoReconnect is false, that will pass false to c.status.ConnectionLost. Thus the callback that it returns will itself return nil, nil.
The library has quite a few options and I was concerned that I may have missed some possible combinations when rearchitecting the status handling (it was a bit of a mess), hence the "BUG BUG" log entry. Have had a quick look and the log entry should be supressed if c.options.AutoReconnect == false (probably best to add something like reconnectExpected := c.options.AutoReconnect && c.status.ConnectionStatus() > connecting at the top, and then use that value).
Having said that the code looks like it will work OK, it's just an incorrect log entry. Will fix when I get a chance (or would welcome a PR).
We set
AutoReconnect
to false in ourClientOptions
. When the connection to the broker is lost unexpectedly, we see the following error come from this library:Tracing through the code, this is because
disDone
is assigned like so.paho.mqtt.golang/client.go
Line 517 in 714f7c0
Since
c.options.AutoReconnect
is false, that will pass false toc.status.ConnectionLost
. Thus the callback that it returns will itself returnnil, nil
.paho.mqtt.golang/status.go
Lines 278 to 280 in 714f7c0
This in turn triggers the log that "should never happen".
paho.mqtt.golang/client.go
Lines 547 to 552 in 714f7c0
I believe this regression was introduced in v1.4.2. It prevents us from upgrading from v1.3.5.
The text was updated successfully, but these errors were encountered: