Skip to content

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

Description

@RobLeighton67

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: mosquitto-brokerStatus: CompletedNothing further to be done with this issue, it can be closed by the requestor or committer.

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions