paho.mqtt.java icon indicating copy to clipboard operation
paho.mqtt.java copied to clipboard

Server Keep Alive 1/2 of ConnectionOptions.keepAliveInterval causes ClientState to generate WIRTE_TIMEOUT Exception

Open jkamke opened this issue 4 years ago • 0 comments

If Server Keep Alive is set to 1/2 +1 (or more) ClientState.checkForActivity will issue a pingreq and adapts to the change. However, a Server Keep Alive of 1/2 or less of ConnectionOptions.keepAliveInterval will always result in ClientState.checkForActivity throwing, because the timer is set before the client considers the ConnectAck:ServerKeepAlive, but the check is done considering the new value (which indicates tardiness).

According to the spec the client is expected to:

  • If the Server sends a Server Keep Alive on the CONNACK packet, the Client MUST use this value instead of the Keep Alive value the Client sent on CONNECT
  • It is the responsibility of the Client to ensure that the interval between MQTT Control Packets being sent does not exceed the Keep Alive value
  • [x] Bug exists Release Version 1.2.5 ( Master Branch)
  • [ ] Bug exists in MQTTv3 Client on Snapshot Version 1.2.6-SNAPSHOT (Develop Branch)
  • [x] Bug exists in MQTTv5 Client on Snapshot Version 1.2.6-SNAPSHOT (Develop Branch)

jkamke avatar Sep 17 '21 20:09 jkamke