-
Notifications
You must be signed in to change notification settings - Fork 30
Description
Sometimes (maybe 1/4 of the time) when I try to publish message to my mqtt broker (mosquitto version 1.6.9) I just get
FAIL Error publishing: 4
this is caused by:
result, mid = self._mqttc.publish(topic, message, int(qos), retain)
if result != 0:
raise RuntimeError('Error publishing: %s' % result)
in MQTTKeywords.publish returning result == 4. (4 == MQTT_ERR_NO_CONN).
according to https://github.com/eclipse/paho.mqtt.python/blob/master/src/paho/mqtt/client.py
rc is MQTT_ERR_SUCCESS to indicate success or MQTT_ERR_NO_CONN if the
client is not currently connected. mid is the message ID for the
publish request. The mid value can be used to track the publish request
by checking against the mid argument in the on_publish() callback if it
is defined.
If the client is not currently connected should this library try to reconnect or throw error about it from _on_disconnect.
I cannot find reason for the disconnect from my mosquitto logs (I don't see anything with the brokers log with correct timestamp) or from robot logs and I have connected multiple other devices to this broker with different software (using python2 paho_mqtt library) and they don't seem to disconnect randomly.