mosquitto disconnects arduino client on publish

Bug #528663 reported by Roger Light
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mosquitto
Fix Released
Undecided
Unassigned

Bug Description

The arduino client from http://knolleary.net/arduino-client-for-mqtt/ doesn't seem to play well with mosquitto. On receiving (or not) a publish, it is disconnected.

* arduino connect
* arduino subscribe to topic
* arduino publish message on test topic
* send message on subscribed topic from other client
* message is published to arduino
* error / arduino never receives message

Revision history for this message
Roger Light (roger.light) wrote :

I don't have an arduino so this is difficult to debug. Any help I can get with this would be appreciated.

Revision history for this message
Oliver Smith (oliversmith) wrote :

Right, there is slightly more to this than I've let on....

In its raw state the stated arduino client will connect to RSMB and work correctly, and will connect to mosquitto but instantly error on connection with the following debuge messages:

New client connected from 10.1.1.67.
Received CONNECT from 10.1.1.67 as arduino
Sending CONNACK to arduino (0)
Socket read error on client arduino, disconnecting.

if line 54 of PubSubClient.cpp "_client.stop();" is commented out the client will connect to mosquitto fine and is able to publish messages but the error above still occurs.

Revision history for this message
Nicholas O'Leary (knolleary) wrote :

Have reproduced and identified the issue in my Arduino MQTT Client library.

The code didn't always check there was data available to read before trying to read from the network. This has not been a problem when running against the brokers I test against. However, for some reason, when reading a packet from mosquitto, it is a problem.

Have pushed the fix out as v1.3 - http://knolleary.net/arduino-client-for-mqtt/

Revision history for this message
Oliver Smith (oliversmith) wrote :

Great work thanks, I've tested it and it works fine with mosquitto for me. I guess we can mark this as fixed now then.

Changed in mosquitto:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.