rabbitmq / rabbitmq-mqtt

RabbitMQ MQTT plugin
https://www.rabbitmq.com/mqtt.html
Other
174 stars 67 forks source link

MQTT Publishes at QOS2 causes a connection failure for the publisher. #155

Closed grassy-noel closed 6 years ago

grassy-noel commented 6 years ago

Hi, I posted this to the user group but got no response.

According to the MQTT documentation on the Rabbit web-site I was expecting QOS2 publishes to be accepted but that Rabbit would downgrade them internally to QOS1
For QOS2 publishes it receives, is Rabbit supposed to reply with a PUBREC as per the spec? - https://www.hivemq.com/blog/mqtt-essentials-part-6-mqtt-quality-of-service-levels I get a PUBACK for QOS1

But my experience is that publishes on QOS2 cause the publishers connection to be dropped.

I've tested Rabbit 3.6.14 on Windows and 3.7.0 on Linux using MQTT.fx and mosquitto_pub and the results are the same.

From MQTT.fx which is using Java Paho 1.10 I have also seen this in my own code using Paho 1.20

2017-12-14 10:21:29,900 INFO --- MqttFX ClientModel : MqttClient with ID MQTT_FX_Client assigned. 2017-12-14 10:21:40,850 INFO --- PublishController : publish 2017-12-14 10:21:40,853 INFO --- MqttFX ClientModel : attempt to add PublishTopic 2017-12-14 10:21:40,854 INFO --- MqttFX ClientModel : sucessfully published message Test @ QOS2 to topic home.garden.fountain (QoS 1, Retained false) 2017-12-14 10:24:09,249 INFO --- PublishController : publish 2017-12-14 10:24:09,262 INFO --- MqttFX ClientModel : attempt to add PublishTopic 2017-12-14 10:24:09,263 INFO --- MqttFX ClientModel : sucessfully published message Test @ QOS1 to topic home.garden.fountain (QoS 1, Retained false) 2017-12-14 10:24:10,304 INFO --- PublishController : publish 2017-12-14 10:24:10,309 INFO --- MqttFX ClientModel : attempt to add PublishTopic 2017-12-14 10:24:10,310 INFO --- MqttFX ClientModel : sucessfully published message Test @ QOS1 to topic home.garden.fountain (QoS 1, Retained false) 2017-12-14 10:24:10,532 INFO --- PublishController : publish 2017-12-14 10:24:10,537 INFO --- MqttFX ClientModel : attempt to add PublishTopic 2017-12-14 10:24:10,537 INFO --- MqttFX ClientModel : sucessfully published message Test @ QOS1 to topic home.garden.fountain (QoS 1, Retained false) 2017-12-14 10:24:10,738 INFO --- PublishController : publish 2017-12-14 10:24:10,744 INFO --- MqttFX ClientModel : attempt to add PublishTopic 2017-12-14 10:24:10,745 INFO --- MqttFX ClientModel : sucessfully published message Test @ QOS1 to topic home.garden.fountain (QoS 1, Retained false) 2017-12-14 10:26:41,477 INFO --- PublishController : publish 2017-12-14 10:26:41,489 INFO --- MqttFX ClientModel : attempt to add PublishTopic 2017-12-14 10:26:41,490 INFO --- MqttFX ClientModel : sucessfully published message Test @ QOS1 to topic home.garden.fountain (QoS 1, Retained false) 2017-12-14 10:27:01,529 INFO --- PublishController : publish 2017-12-14 10:27:01,534 INFO --- MqttFX ClientModel : Broker connection lost: Retrying... 2017-12-14 10:27:01,534 ERROR --- MqttFX ClientModel : Error publishing to topic: home.garden.fountain org.eclipse.paho.client.mqttv3.MqttException: Connection lost at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:146) ~[org.eclipse.paho.client.mqttv3-1.1.0.jar:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_131] Caused by: java.io.EOFException at java.io.DataInputStream.readByte(Unknown Source) ~[?:1.8.0_131] at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:65) ~[org.eclipse.paho.client.mqttv3-1.1.0.jar:?] at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:107) ~[org.eclipse.paho.client.mqttv3-1.1.0.jar:?] ... 1 more

The Rabbit logs show the error at the time of the drop.

=INFO REPORT==== 14-Dec-2017::10:21:30 === MQTT vhost picked using vhost in username or default

=INFO REPORT==== 14-Dec-2017::10:21:30 === accepting MQTT connection <0.3280.219> (127.0.0.1:55382 -> 127.0.0.1:8883)

=INFO REPORT==== 14-Dec-2017::10:26:29 === MQTT vhost picked using vhost in username or default

=INFO REPORT==== 14-Dec-2017::10:26:29 === accepting MQTT connection <0.3225.219> (127.0.0.1:55530 -> 127.0.0.1:8883)

=INFO REPORT==== 14-Dec-2017::10:27:01 === MQTT protocol error qos2_not_supported for connection 127.0.0.1:55382 -> 127.0.0.1:8883

=INFO REPORT==== 14-Dec-2017::10:27:02 === MQTT vhost picked using vhost in username or default

=INFO REPORT==== 14-Dec-2017::10:27:02 === accepting MQTT connection <0.3148.219> (127.0.0.1:55549 -> 127.0.0.1:8883)

I see the same bahviour for the Mosquitto publisher.

QOS1

"C:\Program Files (x86)\mosquitto\mosquitto_pub.exe" -h localhost -p 1883 -t home.garden.fountain -m "test message" -q 1 -d Client mosqpub/30316-moreilly- sending CONNECT Client mosqpub/30316-moreilly- received CONNACK Client mosqpub/30316-moreilly- sending PUBLISH (d0, q1, r0, m1, 'home.garden.fountain', ... (12 bytes)) Client mosqpub/30316-moreilly- received PUBACK (Mid: 1) Client mosqpub/30316-moreilly- sending DISCONNECT

QOS2 "C:\Program Files (x86)\mosquitto\mosquitto_pub.exe" -h localhost -p 1883 -t home.garden.fountain -m "test message" -q 2 -d Client mosqpub/15304-moreilly- sending CONNECT Client mosqpub/15304-moreilly- received CONNACK Client mosqpub/15304-moreilly- sending PUBLISH (d0, q2, r0, m1, 'home.garden.fountain', ... (12 bytes)) Error: The connection was lost.

The Rabbit logs again show the QOS2 error.

=INFO REPORT==== 14-Dec-2017::10:39:35 === MQTT vhost picked using vhost in username or default

=INFO REPORT==== 14-Dec-2017::10:39:35 === accepting MQTT connection <0.3263.219> (127.0.0.1:55862 -> 127.0.0.1:1883)

=INFO REPORT==== 14-Dec-2017::10:39:35 === MQTT protocol error qos2_not_supported for connection 127.0.0.1:55862 -> 127.0.0.1:1883

Rabbit plugins on Windows c:\RabbitMQ\rabbitmq_server-3.6.14\sbin>rabbitmq-plugins list Configured: E = explicitly enabled; e = implicitly enabled | Status: = running on rabbit@localhost |/ [e] amqp_client 3.6.14 [e] cowboy 1.0.4 [e] cowlib 1.0.2 [ ] rabbitmq_amqp1_0 3.6.14 [ ] rabbitmq_auth_backend_ldap 3.6.14 [ ] rabbitmq_auth_mechanism_ssl 3.6.14 [ ] rabbitmq_consistent_hash_exchange 3.6.14 [ ] rabbitmq_event_exchange 3.6.14 [ ] rabbitmq_federation 3.6.14 [ ] rabbitmq_federation_management 3.6.14 [ ] rabbitmq_jms_topic_exchange 3.6.14 [E] rabbitmq_management 3.6.14 [e] rabbitmq_management_agent 3.6.14 [ ] rabbitmq_management_visualiser 3.6.14 [E] rabbitmq_mqtt 3.6.14 [ ] rabbitmq_random_exchange 3.6.14 [ ] rabbitmq_recent_history_exchange 3.6.14 [ ] rabbitmq_sharding 3.6.14 [ ] rabbitmq_shovel 3.6.14 [ ] rabbitmq_shovel_management 3.6.14 [ ] rabbitmq_stomp 3.6.14 [ ] rabbitmq_top 3.6.14 [ ] rabbitmq_tracing 3.6.14 [ ] rabbitmq_trust_store 3.6.14 [e] rabbitmq_web_dispatch 3.6.14 [ ] rabbitmq_web_mqtt 3.6.14 [ ] rabbitmq_web_mqtt_examples 3.6.14 [ ] rabbitmq_web_stomp 3.6.14 [ ] rabbitmq_web_stomp_examples 3.6.14 [ ] sockjs 0.3.4

Rabbit plugins on Linux

$ sudo rabbitmq-plugins list Configured: E = explicitly enabled; e = implicitly enabled | Status: = running on rabbit@ip-xxx-xxx-xxx-xxx |/ [ ] rabbitmq_amqp1_0 3.7.0 [ ] rabbitmq_auth_backend_cache 3.7.0 [ ] rabbitmq_auth_backend_http 3.7.0 [ ] rabbitmq_auth_backend_ldap 3.7.0 [ ] rabbitmq_auth_mechanism_ssl 3.7.0 [ ] rabbitmq_consistent_hash_exchange 3.7.0 [ ] rabbitmq_event_exchange 3.7.0 [ ] rabbitmq_federation 3.7.0 [ ] rabbitmq_federation_management 3.7.0 [ ] rabbitmq_jms_topic_exchange 3.7.0 [E] rabbitmq_management 3.7.0 [e] rabbitmq_management_agent 3.7.0 [E] rabbitmq_mqtt 3.7.0 [ ] rabbitmq_peer_discovery_aws 3.7.0 [ ] rabbitmq_peer_discovery_common 3.7.0 [ ] rabbitmq_peer_discovery_consul 3.7.0 [ ] rabbitmq_peer_discovery_etcd 3.7.0 [ ] rabbitmq_peer_discovery_k8s 3.7.0 [ ] rabbitmq_random_exchange 3.7.0 [ ] rabbitmq_recent_history_exchange 3.7.0 [ ] rabbitmq_sharding 3.7.0 [ ] rabbitmq_shovel 3.7.0 [ ] rabbitmq_shovel_management 3.7.0 [ ] rabbitmq_stomp 3.7.0 [ ] rabbitmq_top 3.7.0 [ ] rabbitmq_tracing 3.7.0 [ ] rabbitmq_trust_store 3.7.0 [e] rabbitmq_web_dispatch 3.7.0 [E] rabbitmq_web_mqtt 3.7.0 [ ] rabbitmq_web_mqtt_examples 3.7.0 [ ] rabbitmq_web_stomp 3.7.0 [ ] rabbitmq_web_stomp_examples 3.7.0

michaelklishin commented 6 years ago

Thank you for your time.

Team RabbitMQ uses GitHub issues for specific actionable items engineers can work on. This assumes two things:

  1. GitHub issues are not used for questions, investigations, root cause analysis, discussions of potential issues, etc (as defined by this team)
  2. We have a certain amount of information to work with

We get at least a dozen of questions through various venues every single day, often quite light on details. At that rate GitHub issues can very quickly turn into a something impossible to navigate and make sense of even for our team. Because of that questions, investigations, root cause analysis, discussions of potential features are all considered to be mailing list material by our team. Please post this to rabbitmq-users.

Getting all the details necessary to reproduce an issue, make a conclusion or even form a hypothesis about what's happening can take a fair amount of time. Our team is multiple orders of magnitude smaller than the RabbitMQ community. Please help others help you by providing a way to reproduce the behavior you're observing, or at least sharing as much relevant information as possible on the list:

Feel free to edit out hostnames and other potentially sensitive information.

When/if we have enough details and evidence we'd be happy to file a new issue.

Thank you.

michaelklishin commented 6 years ago

RabbitMQ 3.6.x does not support QoS 2 downgrading. #21 that introduced it has 3.7.0 set for Milestone.

Sorry but mailing list responses are voluntary and depend on our team's workload this week. Thank you for providing some details about how this can be reproduce but not getting a response does not mean that an issue automatically adheres to our standards or is confirmed.