Question
Why has my client been disconnected ?
Answer
Statement
Client ID: UNKNOWN, IP:x.x.x.x disconnected ungracefully.
Meaning
This statement occurs when the TCP connection is closed, before an MQTT CONNECT packet was ever sent. Therefore the clientID is UNKNOWN. Typically these log statements are caused by TCP based load balancer health checks.
These statements can be ignored and avoided by using the Heartbeat Extension.
Statement
Client ID: abc, IP:x.x.x.x disconnected ungracefully.
Meaning
If you see this statement without a corresponding, additional line, it means that the TCP connection was lost and the broker did not actively initiate this disconnect.
Statement
Client ID: abc, IP:x.x.x.x was disconnected. reason: Client was idle for too long.
Client ID: abc, IP:x.x.x.x disconnected ungracefully.
Meaning
When you see this message, the client got disconnected by the broker because no packet was received within one and a half time the specified keepAlive value for this connection.
See MQTT specification.
If the Keep Alive value is non-zero and the Server does not receive a Control Packet from the Client within one and a half times the Keep Alive time period, it MUST disconnect the Network Connection to the Client as if the network had failed
This indicates that there was a connection loss between client and broker. Isolated or rate incidents of this log statement are no cause for concern.
Statement
Client ID: abc, IP:x.x.x.x was disconnected. reason: Another client connected with the same clientId.
Client ID: abc, IP:x.x.x.x disconnected ungracefully.
Meaning
This means that the broker initiated the disconnected based on the Client Take-Over Mechanism.
Typically this is caused by a client losing its connection and re-connecting before the broker was able to detect the same connection loss.
Statement
Client ID: abc, IP:x.x.x.x was disconnected. reason: Sent too many concurrent PUBLISH messages.
Client ID: abc, IP:x.x.x.x disconnected ungracefully.
Meaning
This disconnect reason does only affect clients using MQTT version 5.
When you see this message, the client got disconnected by the broker because it sent more unacknowledged PUBLISH messages than the Receive Maximum value sent to it by broker in the CONNACK packet.
See MQTT specification.
The Server MUST NOT send more than Receive Maximum QoS 1 and QoS 2 PUBLISH packets for which it has not received PUBACK, PUBCOMP, or PUBREC with a Reason Code of 128 or greater from the Client [MQTT-3.3.4-9]. If it receives more than Receive Maximum QoS 1 and QoS 2 PUBLISH packets where it has not sent a PUBACK or PUBCOMP in response, the Client uses DISCONNECT with Reason Code 0x93 (Receive Maximum exceeded) as described in section 4.13 Handling errors.
Seeing this messages indicates a problem with the MQTT client implementation.