Hi.

Have now investigated more into this issue...

It turns out, if a client sets up the connecton+session FROM SCRATCH for
EVERY message sent, and then closes them right after the commit, this
warning message will appear in the client logs every now and then:

  08:01:19.199 [ActiveMQ Transport: tcp:///127.0.0.1:61616@51388] WARN
org.apache.activemq.transport.failover.FailoverTransport - Transport (tcp://
127.0.0.1:61616) failed, not attempting to automatically reconnect
  java.io.EOFException: null

I'm aware this is (for performance reasons) likely not the "recommended
approach" but I would also say it's NOT an ERROR to do so?  ...even WITH
this approach, each msg only takes a few milliseconds to send....

Otherwise, in spite of these warnings, everything seems to work fine.

Was just a bit worrying to find this in the logs, and the client is now
rewritten to avoid this.

Below is a simple testcase to reproduce the issue.

If you let it run for a while, in our environment we consistently see this
warning  (seemingly randomly) a few times for every million messages sent.

-------------------------------------

package test;
import java.time.LocalDateTime;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.MapMessage;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
import org.apache.activemq.ActiveMQConnectionFactory;

public class LoopJms {

    public static void main(String[] args) {
        new LoopJms().sendMessages();
    }

    private long msgId = 10000000L;

    private void sendMessages() {
        while (true) {
            try {
                String now = "" + LocalDateTime.now();
                System.out.println(now + " - sending message " + msgId);
                ConnectionFactory connectionFactory = new
ActiveMQConnectionFactory("failover:(tcp://127.0.0.1:61616
,tcp://127.0.0.1:61616
)?initialReconnectDelay=2000&maxReconnectDelay=2000&jms.redeliveryPolicy.maximumRedeliveries=0");
                Connection connection =
connectionFactory.createConnection();
                Session session = connection.createSession(true,
Session.AUTO_ACKNOWLEDGE);
                MapMessage mm = session.createMapMessage();
                mm.setString("id", "" + (msgId++));
                mm.setString("time", now);
                Queue destination = session.createQueue("queue.test");
                MessageProducer producer =
session.createProducer(destination);
                producer.send(mm);
                session.commit();
                producer.close();
                session.close();
                connection.close();
                producer = null;
                session = null;
                connection = null;
                connectionFactory = null;
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }
}



On Mon, Oct 21, 2024 at 12:22 PM rop <rop...@gmail.com> wrote:

> We are running an application using ActiveMQ (currently, version 5.18.3)
>   with multiple queues and listeners since several years.
> Has worked fine, so far --- only, in the last week
>   we are sometimes seeing Warnings like this in the log-files:
>
> 2024-10-18 14:23:07,844 [ActiveMQ Transport: 
> tcp:///127.0.0.1:61616@44966][FailoverTransport:283]
> WARN  org.apache.activemq.transport.failover.FailoverTransport - Transport
> (tcp://127.0.0.1:61616) failed, not attempting to automatically reconnect
> java.io.EOFException: null
>         at
> java.base/java.io.DataInputStream.readFully(DataInputStream.java:210)
>         at
> java.base/java.io.DataInputStream.readInt(DataInputStream.java:385)
>         at
> org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:280)
>         at
> org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:240)
>         at
> org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:232)
>         at
> org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:215)
>         at java.base/java.lang.Thread.run(Thread.java:1583)
>
> Evertyhing still seems to work fine without issues.
> I'm just a bit concerned what is causing these warnings?
>
> Anyone can explain what's going on?
>

Reply via email to