-
Notifications
You must be signed in to change notification settings - Fork 754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QoS 2 publishing always fails (split of issue #200) #201
Comments
OK, to clarify:
Since I'm not familiar with Mosquitto inner workings, I don't know if it is not logging because it is not receiving messages or because it is not receiving proper messages. Wireshark would provide me (a low-level thinking old man) with more clues. Anyway, perhaps defining MQTT_DEBUG will do for now. Can you do it and get some trace out of your device ? Otherwise you should put some breakpoints and follow the QoS2 msg along functions to see where it gets lost or gets trashed. |
Am posting some examples of the mosquiito log (actually written to syslog for convenience): I have a Linux box that runs mosquitto and also runs a watchdog that 'pings' a message using the libmosquitto library via localhost and the MQTT broker at QoS2 . The log for a typical watchdog transaction is as follows: Jan 24 08:58:33 arundel mosquitto[1219]: New connection from 127.0.0.1 on port 1883. Note that I get the full suite of PUBLISH-PUBREC-PUBREL-PUBCOMP. These transactions work fine. A typical log for an interaction with the Paho client running on a NodeMCU and communicating over a wireless access point is: Jan 24 13:32:46 arundel mosquitto[1219]: New connection from 192.168.0.100 on port 1883. Notice here that i) the transaction seems to be tagged with "q2" which I assume means mosquitto thinks the message is at QoS2, ii) the mosquitto broker sends PUBREC in response to the Paho client's PUBLISH, iii) the transaction never completes! There is no PUBREL received from the Paho client. (The next logged item in this case is a connection to my within-Linux watchdog system.) Sergio - Does this give you enough information, or shall I try running with MQTT_DEBUG defined?
In fact, the C++ client is a thin wrapper around the C library. Peter |
Seeing the log, I still don't know if missing messages are lost or trashed. However, the second connection seems to indicate either a short timeout or an error in handling. AFAIK the remaining part of the QoS2 conversation should (must?) follow on the very same connection, something is wrong here. |
Hi
I have been using Paho C++ via MQTTClient within PlatformIO to produce a NodeMCU-based system to communicate synchronously with a mosquitto broker on a Linux Mint PC.
I can publish from the PC to the NodeMCU at QoS2 no problem. However, I am unable to publish from the NodeMCU board to the PC (mosquitto_sub) at QoS2. Inspecting the mosquitto log, I can see that I am getting a PUBLISH message and the broker is responding with PUBREC. But the PUBREL and PUBCOMP parts of the QoS2 transaction are always absent. It seems like Paho is not producing the PUBREL response and so the transaction dies. Unsurprisingly, no message gets delivered! Publishing from the NodeMCU at QoS0 or QoS1 works – the messages do appear on the PC.
One thing I did notice in MQTTClient.h is that unless MQTTCLIENT_QOS2 is defined (as 2?) then MQTTCLIENT_QOS2 is set to zero. In other words, QoS2 downgrades to QoS0; so it appears that the subsequent code that generates the (missing) PUBREL message is never executed?
Anybody any comments/suggestions on this?
Peter
The text was updated successfully, but these errors were encountered: