eclipse-paho / eclipse-paho/paho.mqtt.java

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

Open
#895 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.3k
Forks
919
PR merge metrics
No merged PRs in 30d

Description

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)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.