aws / aws-iot-device-sdk-java

Java SDK for connecting to AWS IoT from a device.
https://aws.amazon.com/iot/sdk/
Apache License 2.0
211 stars 168 forks source link

MQTT Connection not lost when keepAlive is set to 1 minute but happening when set to 20 mins #175

Closed anilkamaraju closed 2 years ago

anilkamaraju commented 2 years ago

AWS SDK version: aws-iot-device-sdk-java:1.3.9

Problem statement MQTT Connection getting disconnected every ~20 mins and auto reconnecting when keepAlive is set for ~22 mins, but it's not the same case, when keepAlive is set for 1 min. I hardly see connection lost and retry logs.

Is this an expected behaviour ?

Also, I believe MQTT broker disconnects the client when the keepAlive setting exceeds 1.5 times of the original value. In our case, since we set for 22 mins, I expect the connection should lost for every 30 mins. But, we see this is happening for every ~22 mins.

jmklix commented 2 years ago

How exactly are you reproducing this and how repeatable is it? The previous keepAlive message might have been sent a few minutes prior to your disconnect so that might be causing the apparent time to be shorted than expected.