Este conteúdo não está disponível no idioma selecionado.
Chapter 9. Detecting dead connections
Sometimes clients stop unexpectedly and do not have a chance to clean up their resources. If this occurs, it can leave resources in a faulty state and result in the broker running out of memory or other system resources. You can configure the duration that AMQ Broker waits before it cleans up inactive server-side resources.
9.1. Detecting dead connections Copiar o linkLink copiado para a área de transferência!
The broker detects that a client’s connection was not properly shut down at garbage collection time. The connection is then closed and a message similar to the one below is written to the log. The log captures the exact line of code where the client session was instantiated. This enables you to identify the error and correct it.
Because the network connection between the client and the server can fail and then come back online, which allows a client to reconnect, AMQ Broker waits to clean up inactive server-side resources. This wait period is called a time to live (TTL). The default TTL for a network-based connection is 60000 milliseconds (1 minute). The default TTL on an in-VM connection is -1, which means the broker never times out the connection on the broker side.
9.2. Configuring a connection time to live on the broker Copiar o linkLink copiado para a área de transferência!
If you do not want clients to specify their own connection TTL, you can set a global value on the broker side. This can be done by specifying the connection-ttl-override element in the broker configuration.
The logic to check connections for TTL violations runs at the interval specified for the connection-ttl-check-interval element.
Procedure
Edit
<broker_instance_dir>/etc/broker.xmlby adding theconnection-ttl-overrideconfiguration element and providing a value for the time to live, as in the example below.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - connection-ttl-override
-
The global TTL for all connections. In the example, the TTL is set to 30000 milliseconds. The default value is
-1, which allows clients to set their own TTL. - connection-ttl-check-interval
- The interval between checks for dead connections. In the example, the interval is set to 1000 milliseconds. By default, the checks are done every 2000 milliseconds.
Additional resources