title: Understanding ActiveMQ Artemis AMQ222061 & AMQ222107 warnings
body: <p>Currently I am receiving very low traffic to my application 1-2 req/sec which are sent to an JMS queue. However in the <code>artemis.log</code> I am seeing the following <code>WARN</code> messages.</p>
  <pre><code>2021-06-23 10:51:49,433 WARN  [org.apache.activemq.artemis.core.server] AMQ222061: Client connection failed, clearing up resources for session d798a4d3-d3f7-11eb-86d7-005056b536f0
  2021-06-23 10:51:49,434 WARN  [org.apache.activemq.artemis.core.server] AMQ222107: Cleared up resources for session d798a4d3-d3f7-11eb-86d7-005056b536f0
  2021-06-23 10:51:49,434 WARN  [org.apache.activemq.artemis.core.server] AMQ222061: Client connection failed, clearing up resources for session d798cbe4-d3f7-11eb-86d7-005056b536f0
  2021-06-23 10:51:49,435 WARN  [org.apache.activemq.artemis.core.server] AMQ222107: Cleared up resources for session d798cbe4-d3f7-11eb-86d7-005056b536f0
  </code></pre>
  <p>The Artemis journal is backed by NFS, and all messages are persisted. I am using Spring's <code>JmsTemplate</code> with a <code>JmsPoolConnectionFactory</code>.</p>
  <pre class="lang-java prettyprint-override"><code>@Bean
  public ConnectionFactory jmsConnectionFactoryOnline() {
      ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(brokerUrl,username,password);
      connectionFactory.setCallTimeout(3000);
      return connectionFactory;
  }
  </code></pre>
  <pre class="lang-java prettyprint-override"><code>@Bean
  @Primary
  public JmsPoolConnectionFactory pooledConnectionFactory() {
      JmsPoolConnectionFactory poolingFactory = new JmsPoolConnectionFactory();
      poolingFactory.setConnectionFactory(jmsConnectionFactoryOnline());
      poolingFactory.setMaxConnections(8);
      poolingFactory.setMaxSessionsPerConnection(20);
      poolingFactory.setConnectionIdleTimeout(0);
      return poolingFactory;
  }
  </code></pre>
  <p>Any ideas why there so many disconnects (they repeat every ~15 minutes) and how to debug it?</p>
  <p>At client level I get the below warning but 3 seconds seems to much since the broker is up and accepting other messages:</p>
  <pre><code>23-06-2021 09:33:15 [Thread-24 (ActiveMQ-client-global-threads)] [WARN ] org.apache.activemq.artemis.core.client - AMQ212037: Connection failure to XXXXXX:61616 has been detected: AMQ219014: Timed out after waiting 3,000 ms for response when sending packet 71 [code=CONNECTION_TIMEDOUT]
  </code></pre>
  <p><strong>EDIT</strong></p>
  <p>I have taken a thread dump every 3 sec. Check <a href="https://fastthread.io/my-thread-report.jsp?p=c2hhcmVkLzIwMjEvMDYvMjQvLS10aHJlYWR1bXBzLnppcC0tMTMtMTAtNQ==" rel="nofollow noreferrer">here</a> for relative information.</p>
  <p>Monitoring the push to queue latency I can clearly see that with 1 req/sec I have spikes of latency whereas with 20 req/sec push to queue latencies seem normal as observed in the image below.</p>
  <p><a href="https://i.stack.imgur.com/D20IZ.png" rel="nofollow noreferrer">Push to Queue latency</a></p>
  <p>Also from tcpdump I can see that there is a pause between client and broker. There seems to be no traffic exchanged between them.
  Therefore as soon as the callTimeout period has elapsed the client closes the connection.</p>
  <p><a href="https://i.stack.imgur.com/4XTHj.png" rel="nofollow noreferrer">tcpdump</a></p>