LabVIEW-Open-Source/MQTT-Client

Connection issue with Mosquitto 2.0.14

bruniii opened this issue · 7 comments

Hello,

I have recently installed on multiple Windows PC the 2.0.14 version of the Mosquitto broker. Now even the minimal client example distributed with the MQTT-client library cannot connect to the broker; up to 2.0.11 everything was working fine. Specifically, I'm getting Error 66 out of the "Connect to Server.vi".

Attached the block diagram; as you can see, the vi is the basic example with a TCP connection.

mqtt_issue

I have looked at the changelog (https://mosquitto.org/ChangeLog.txt) but I'm not an expert, just a user of your nice collection of MQTT library.

Could you please check if you are able to reproduce the same error?

Thank you,
Marco.

@bruniii
Please check if Mosquitto 2.0 runs version 3.1 or 5.0 of the MQTT protocol.

The LV-MQTT library currently only supports 3.1

auge commented

I had similar issues: @bruniii pls check the mosquitto logs.
mosquitto seems to not properly implement keep-alive:0 (which is the default for the LV MQTT Client): eclipse/mosquitto#2462

I simply set a keep-alive other than 0 (60 in my case) which worked nicely.

regards

My assumption is that there is something not supported which resolves to a protocol violation. Error 66 in LabVIEW means that the connection is closed by peer (server in this case). If there are no replies at all, it means that the bytes sent are not accepted as valid format. If it were a refusal because of credentials, you would get a CONNACK packet with a reason for refusal, then a disconnection. The fact that it disconnects right away, without a CONNACK packet, seems to indicate a protocol violation.

I would have expected Mosquitto to support 3.1.1, but I read on their release notes that they reject if keep-alive is not formatted.

thanks for confirming @auge !!!

@auge and @francois-normandin thank you! I can confirm that with a "keep alive" value greater than zero everything is working fine!

For the record, the MQTT Client 4.0.0 upgrade available on VIPM now sets Keep-Alive at 60s by default.

(Be sure to upgrade the whole MQTT Connection stack to 4.0.x at the same time. The stack is unchanged except for inheritance to a more generic "Connection" class. Unless you used the MQTT Connection public methods, no break in code is expected)

I found out that it's still possible to use "keep alive" equal to 0 ( = forever) if the line
max keepalive 0
is added to the mosquitto.conf in C:\Program Files\mosquitto\ (remember to restart the service).