eclipse / paho.mqtt.java

Eclipse Paho Java MQTT client library. Paho is an Eclipse IoT project.
https://eclipse.org/paho
Other
2.1k stars 880 forks source link

Bad behavior with packet size limitation #987

Open freyssin opened 1 year ago

freyssin commented 1 year ago

Please fill out the form below before submitting, thank you!

With MQTTv5 the client can set during the Connect the maximum size that the broker can send to it. In return, the broker informs in the Connack of the maximum size that the client can send to it.

It looks like Paho mixes up these 2 values and prevents the client from emitting packets larger than what was specified in the Connect and disconnects the client if it trie to sent a bigger packet.

The reported exception is:

03/03/2023 14:05:17.379 org.eclipse.paho.mqttv5.client.internal.CommsSender SEVERE: clientId-pub2: exception Outgoing packet too large. (51002) at org.eclipse.paho.mqttv5.common.ExceptionHelper.createMqttException(ExceptionHelper.java:25) at org.eclipse.paho.mqttv5.client.wire.MqttOutputStream.write(MqttOutputStream.java:83) at org.eclipse.paho.mqttv5.client.internal.CommsSender.run(CommsSender.java:145) at java.base/java.lang.Thread.run(Thread.java:829)