When trying to request one large message (~100 MB) from mqtt broker, connection is reset with MQTT_ERR_KEEPALIVE error when chunk cannot be received within double of configured keepalive interval.
Using following pseudo code:
import paho.mqtt.client as mqtt
client = mqtt.Client()
client.connect(my_url, keepalive=30)
When chunk is not received within 60 seconds, MQTT_ERR_KEEPALIVE will occur.
Reason: Keep-Alive timeout detection is done by _check_keepalive() function using self._last_msg_out and self._last_msg_in.
self._last_msg_in is properly updated after a full packed has been received and after reading 100 parts of a huge packet. However there might happen a BlockingIOError when calling self._sock_recv(). This happens with my setup regularly. In this case self._last_msg_in is not updated, resulting in keepalive error.
Suggested fix: update self._last_msg_in regularly whenever data is received from socket.
When trying to request one large message (~100 MB) from mqtt broker, connection is reset with MQTT_ERR_KEEPALIVE error when chunk cannot be received within double of configured keepalive interval.
Using following pseudo code:
When chunk is not received within 60 seconds, MQTT_ERR_KEEPALIVE will occur.
Reason: Keep-Alive timeout detection is done by _check_keepalive() function using
self._last_msg_outandself._last_msg_in.self._last_msg_inis properly updated after a full packed has been received and after reading 100 parts of a huge packet. However there might happen aBlockingIOErrorwhen callingself._sock_recv(). This happens with my setup regularly. In this caseself._last_msg_inis not updated, resulting in keepalive error.Suggested fix: update
self._last_msg_inregularly whenever data is received from socket.