eclipse-paho / eclipse-paho/paho.mqtt.java
Keep-alive not working correctly after reconnect
- Dominant language
- Java
- Stars
- 2.3k
- Forks
- 919
- PR merge metrics
- No merged PRs in 30d
Description
Please fill out the form below before submitting, thank you!
- [x ] Bug exists Release Version 1.2.5 ( Master Branch)
It appears there are situations (specifically after a reconnect) when the keep-alive timouts are not calculated correctly. I see the following line in my logfile:
```
Timed out as no write activity, keepAlive=3,000,000,000 lastOutboundActivity=10,261,298,582,708,262 lastInboundActivity=10,261,302,063,032,555 time=10,261,305,064,036,687 lastPing=10,261,294,101,441,119
```
As far as i understand it, the last out- and inbound activities have happened 7 (CONNECT) and 3 (CONNACK) seconds ago respectively. I use a keep-alive interval of 3s, so this would be ok. But the last ping has happened about 11s ago, which was before the reconnect.
So instead of shutting down the connection, the client should instead send its first ping to the server, as this is a new connection and its pings should be independent of the old connection.
Contributor guide
Assessment
This issue has not been assessed yet.