Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mosquitto broker disconnects local client prematurely - claiming keepalive timeout has occurred. #3138

Open
RobLeighton67 opened this issue Oct 16, 2024 · 1 comment

Comments

@RobLeighton67
Copy link

Setup.
Mosquitto broker v2.0.19 built/running on Pi Zero W .
Operating system is Dietpi (Raspbian variant of Debian Bookworm).
2 clients running on the same device are connected , one is based on the Paho Java Client (keepalive 60s) , the other is mqtt.js based (also keepalive 60s).
Broker also acting as bridge to a remote cloud based broker.
No persistence.

Issue.
Intermittently (after several hours or so, although it can take longer) the Paho client gets suddenly disconnected by the broker which logs a keepalive timeout as the reason for disconnection.
In each case the last pub and sub to Mosquitto have been within the most recent keepalive period (i.e. much less then the 1.5 * keepalive timeout).

Log excerpt:

1728664952: Received PINGREQ from 180645f5
1728664952: Sending PINGRESP to 180645f5
1728664953: Received PUBLISH from 180645f5 (d0, q1, r0, m422, 'gateway2/00000000180645F5/bridge/request/health_check', ... (0 bytes))
1728664953: Sending PUBLISH to mqttjs_625841e0 (d0, q0, r0, m0, 'gateway2/00000000180645F5/bridge/request/health_check', ... (0 bytes))
1728664953: Sending PUBACK to 180645f5 (m422, rc0)
1728664953: Received PUBLISH from mqttjs_625841e0 (d0, q0, r1, m0, 'gateway2/00000000180645F5/bridge/devices', ... (22060 bytes))
1728664953: Sending PUBLISH to 180645f5 (d0, q0, r0, m0, 'gateway2/00000000180645F5/bridge/devices', ... (22060 bytes))
1728664953: Sending PUBLISH to mqttjs_625841e0 (d0, q0, r0, m0, 'gateway2/00000000180645F5/bridge/devices', ... (22060 bytes))
1728664953: Received PUBLISH from mqttjs_625841e0 (d0, q0, r0, m0, 'gateway2/00000000180645F5/bridge/logging', ... (174 bytes))
1728664953: Sending PUBLISH to mqttjs_625841e0 (d0, q0, r0, m0, 'gateway2/00000000180645F5/bridge/logging', ... (174 bytes))
1728664953: Received PUBLISH from mqttjs_625841e0 (d0, q0, r0, m0, 'gateway2/00000000180645F5/bridge/response/health_check', ... (39 bytes))
1728664953: Sending PUBLISH to 180645f5 (d0, q0, r0, m0, 'gateway2/00000000180645F5/bridge/response/health_check', ... (39 bytes))
1728664953: Sending PUBLISH to mqttjs_625841e0 (d0, q0, r0, m0, 'gateway2/00000000180645F5/bridge/response/health_check', ... (39 bytes))
1728664956: Received PINGREQ from mqttjs_625841e0
1728664956: Sending PINGRESP to mqttjs_625841e0
1728664956: Received PUBLISH from mqttjs_625841e0 (d0, q0, r0, m0, 'gateway2/00000000180645F5/bridge/logging', ... (608 bytes))
1728664956: Sending PUBLISH to mqttjs_625841e0 (d0, q0, r0, m0, 'gateway2/00000000180645F5/bridge/logging', ... (608 bytes))
1728664956: Sending PINGREQ to local.00000000180645F5
1728664956: Received PUBLISH from mqttjs_625841e0 (d0, q1, r0, m2109, 'gateway2/00000000180645F5/device/XXXXXXX', ... (426 bytes))
1728664956: Sending PUBLISH to mqttjs_625841e0 (d0, q0, r0, m0, 'gateway2/00000000180645F5/device/XXXXXXXX', ... (426 bytes))
1728664956: Sending PUBLISH to local.00000000180645F5 (d0, q1, r0, m806, 'gateway2/00000000180645F5/device/XXXXXXX', ... (426 bytes))
1728664956: Sending PUBACK to mqttjs_625841e0 (m2109, rc0)
1728664956: Received PINGRESP from local.00000000180645F5
1728664956: Received PUBACK from local.00000000180645F5 (Mid: 806, RC:0)
1728664956: Received PUBLISH from mqttjs_625841e0 (d0, q1, r0, m2110, 'gateway2/00000000180645F5/device/XXXXXXX', ... (426 bytes))
1728664956: Sending PUBLISH to mqttjs_625841e0 (d0, q0, r0, m0, 'gateway2/00000000180645F5/device/XXXXXX', ... (426 bytes))
1728664956: Sending PUBLISH to local.00000000180645F5 (d0, q1, r0, m807, 'gateway2/00000000180645F5/device/XXXXXX', ... (426 bytes))
1728664956: Sending PUBACK to mqttjs_625841e0 (m2110, rc0)
1728664956: Received PUBACK from local.00000000180645F5 (Mid: 807, RC:0)
1728664956: Received PINGREQ from mqttjs_625841e0
1728664956: Sending PINGRESP to mqttjs_625841e0
1728664956: Client 180645f5 has exceeded timeout, disconnecting.
1728665091: mosquitto version 2.0.19 terminating

As this log excerpt shows, the timeout is about 4s after the previous PINGREQ from the client...?
This happens with no warnings or anything else seemingly as the cause.

@RobLeighton67
Copy link
Author

Just to add, it's occurred with every version I have used - 2.0.11, 2.0.12. 2.0.18 - whether installed through APT or built on the device.

@RobLeighton67 RobLeighton67 changed the title Mosquitto broker disconnects local client prematurely - assuming keep a;ive timeout Mosquitto broker disconnects local client prematurely - claiming keepalive timeout has occurred. Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant