Troubleshooting MQTT Client Connection Issues

 Problem

This article outlines troubleshooting steps for customers experiencing connection issues with MQTT clients. It focuses on cases where specific client variants fail to connect, despite using the same credentials, topics, and configuration as other functioning clients.

 Solution

  1. Enable Debug Logging:
    To capture detailed information about client connection attempts, you can enable DEBUG level logging on the HiveMQ broker. This can help identify why certain client variants are failing to connect.

    • You can set the environment variable HIVEMQ_LOG_LEVEL=DEBUG or modify the /opt/hivemq/conf/logback.xml file.

    • For more details, refer to the HiveMQ Logging Documentation.
      Note: DEBUG logging generates significantly more disk usage compared to the default INFO log level.

  2. Check HiveMQ Logs:
    Inspect the HiveMQ logs located at /opt/hivemq/log/hivemq*.log for any errors related to the specific client IDs that are experiencing connection issues.

  3. Use Trace Recording:
    If you have identified the problematic client IDs, consider using HiveMQ's Trace Recording feature to capture all MQTT packets (CONNECT, DISCONNECT, SUBSCRIBE, etc.) for these clients. This will provide deeper insights into their connection lifecycle.
    Instructions for enabling Trace Recording can be found here.

 

Ensure that DEBUG logging and Trace Recording are disabled once troubleshooting is complete, as they many times increase disk usage consumption.

 Related articles