Questo contenuto non è disponibile nella lingua selezionata.

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

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.

[Finalizer] 20:14:43,244 WARNING [org.apache.activemq.artemis.core.client.impl.DelegatingSession]  I'm closing a JMS Conection you left open. Please make sure you close all connections explicitly before let
ting them go out of scope!
[Finalizer] 20:14:43,244 WARNING [org.apache.activemq.artemis.core.client.impl.DelegatingSession]  The session you didn't close was created here:
java.lang.Exception
   at org.apache.activemq.artemis.core.client.impl.DelegatingSession.<init>(DelegatingSession.java:83)
   at org.acme.yourproject.YourClass (YourClass.java:666) //
Copy to Clipboard Toggle word wrap

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

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

  1. Edit <broker_instance_dir>/etc/broker.xml by adding the connection-ttl-override configuration element and providing a value for the time to live, as in the example below.

    <configuration>
     <core>
      ...
      <connection-ttl-override>30000</connection-ttl-override> //
      <connection-ttl-check-interval>1000</connection-ttl-check-interval> //
      ...
     </core>
    </configuration>
    Copy to Clipboard Toggle word wrap
    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

  • To learn how to configure the AMQ Core Protocol JMS client to detect dead connections, see Detecting dead connections in the AMQ Core Protocol JMS documentation.
  • To learn how to configure a connection time-to-live in the AMQ Core Protocol JMS client, see Configuring time-to-live in the AMQ Core Protocol JMS documentation.

9.3. Disabling asynchronous connection execution

Most packets received on the broker side are executed on the remoting thread. These packets represent short-running operations and are always executed on the remoting thread for performance reasons. However, some packet types are executed using a thread pool instead of the remoting thread, which adds a little network latency.

The packet types that use the thread pool are implemented within the Java classes listed below. The classes are all found in the package org.apache.actiinvemq.artemis.core.protocol.core.impl.wireformat.

  • RollbackMessage
  • SessionCloseMessage
  • SessionCommitMessage
  • SessionXACommitMessage
  • SessionXAPrepareMessage
  • SessionXARollbackMessage

Procedure

  1. To disable asynchronous connection execution, add the async-connection-execution-enabled configuration element to <broker_instance_dir>/etc/broker.xml and set it to false, as in the example below. The default value is true.

    <configuration>
     <core>
      ...
      <async-connection-execution-enabled>false</async-connection-execution-enabled>
      ...
     </core>
    </configuration>
    Copy to Clipboard Toggle word wrap
Torna in cima
Red Hat logoGithubredditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi. Esplora i nostri ultimi aggiornamenti.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita il Blog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

Theme

© 2025 Red Hat