Error 5134 – MQTT Unexpected Hangup and Failure to Reconnect After Inactivity

Error 5134 – MQTT Unexpected Hangup and Failure to Reconnect After Inactivity

713
Created On 11/10/26 10:56 AM - Last Modified 11/10/26 16:02 PM


Symptom


EPM agents fail to connect to the EPM cloud services (specifically related to the Endpoints UI page in the console) after a long period of inactivity or system hibernation. The following errors are observed in the agent logs:

 

CvfAwsIotComm::AWS_COM_KIT: socket: connect completion triggered with error -1073741252 CvfAwsIotComm::AWS_COM_KIT: mqtt5-client: emitting connection failure lifecycle event with error code 5134 (libaws-c-mqtt: AWS_ERROR_MQTT_UNEXPECTED_HANGUP, The connection was closed unexpectedly.) CvfAwsIotComm::AWS_COM_KIT: dns: recording failure for record [IPv6 Address] for agents-<region>.epm.cyberark.com, moving to bad list



Environment


EPM EPM Console;Windows Agent;EPM Agent

Cause


Error 5134 (AWS_ERROR_MQTT_UNEXPECTED_HANGUP) in this context may occur when the EPM Agent fails to properly resume its MQTT connection to the cloud console after the endpoint has been in a state of long-term inactivity or hibernation. This inactivity can cause the agent to be automatically deleted from the server (governed by the Endpoint Detection Timeout setting in the EPM console). 

 

This issue may also occur if the Agent was deleted from the console while remaining installed on the endpoint.

 

Another possible reason is a known issue that was resolved in agent version 25.6.0.

While a fix has been developed to prevent this in newer versions, agents already stuck in this state cannot recover automatically because the communication channel is permanently broken.

 

Additional details on Error 5134:

Error 5134 (AWS_ERROR_MQTT_UNEXPECTED_HANGUP) occurs when the AWS IoT backend (the server) forcefully terminates the TCP connection without sending a standard MQTT disconnection message.

From the server's perspective, this is a defensive mechanism. Instead of cleanly negotiating a shutdown or sending an error code back down the tunnel, AWS IoT immediately drops the socket when the client violates a strict broker rule.

1. AWS IoT Core enforces a strict "one connection per Client ID" rule. If a secondary agent - such as a cloned virtual machine or a restarted service that didn't clean up its previous session - authenticates using the exact same Client ID, the AWS server immediately hangs up on the original connection to allow the new one.

2. Once the TLS connection is established, the agent must still have permission to interact with specific data streams. If the agent attempts to publish or subscribe to an MQTT topic that its server-side IoT Policy does not explicitly allow, AWS does not reply with an "Access Denied." It instantly severs the TCP connection.

3. AWS IoT Core enforces Mutual TLS (mTLS), meaning the server actively validates the device's unique certificate during every single connection attempt.

Even if the certificate on the endpoint is technically valid and unexpired, the AWS backend maintains its own authoritative registry. If the server evaluates the certificate and finds a discrepancy, it does not send a polite error message- it instantly severs the TCP socket, resulting in the 5134 Hang-up.

From the server's perspective, this happens for three specific certificate reasons:

1. Revoked or Inactive Status: The certificate has been marked as "Inactive" or "Revoked" within the AWS IoT Core console (often done by an administrator, an automated security script, or a lifecycle policy). When the agent presents this certificate, the server immediately drops the connection.

2. Missing IoT Policy Attachment: A certificate is useless on AWS without an explicitly attached IoT Policy. If the server sees a valid certificate but finds no policies bound to it in the backend registry, it treats the device as unauthorized and abruptly kills the session.

3. Tenant/Region Mismatch: The agent presents a certificate that belongs to a different AWS IoT tenant or region. The receiving server does not recognize the certificate's cryptographic signature in its local registry and immediately terminates the handshake to protect the broker.



Resolution


To restore connectivity for affected agents, they must be re-registered using one of the following methods:

1. Move the Agent to a Different Set

If you wish to avoid a full re-installation, moving the affected endpoint to a different EPM Set (and then back again, if desired) triggers a re-registration process that can clear the hung state.

Note that this is only possible if the Agent is still visible in the My Computers view in the EPM console.

2. Re-install the EPM Agent

Perform a full uninstall and then a fresh installation of the latest EPM Agent version. This will reset the communication certificate and connection string.

Note that a full uninstall will also reset any file source data stored by the Agent.

 

Prevention

Once connectivity is restored, you should adjust your timeout settings to prevent the issue from recurring during routine endpoint inactivity.

 

Adjust the Endpoint Detection Timeout Setting To prevent endpoints from being automatically deleted from the console during routine inactivity (such as user vacations or planned absences), it is highly recommended to adjust the Endpoint Detection Timeout configuration:

  • Change the setting to "Off" so that no endpoints are ever automatically deleted.

  • Alternatively, set it to an extended value that safely exceeds the duration of any expected absences. This value should reflect the absolute time period after which manual IT intervention would be genuinely required to reconnect a lost endpoint.

Note on Licensing: Modifying the Endpoint Detection Timeout value does not impact how endpoints are counted for billing or licensing purposes. Regardless of this setting, inactive endpoints are automatically removed from your active license count after 7 days of inactivity. This 7-day licensing grace period is a strict system behavior and is not user-configurable.



Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA1hj0000001EyeCAE&lang=en_US&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail