Skip to content

Problem with connection closure on MQ queues #95

Open
@jkoguciuk

Description

@jkoguciuk

mq-jms-spring-boot-starter:3.0.0
Java17

Description of the problem
Our company has found a problem related to termination of connection to MQ queues. The problem appears when we try to connect to existing queue and there are temporary problems with network infrastructure and application can`t connect to queue manager. We can also reproduce that problem during connection to non-existent queue.

We try to attach JMS Listener to MQ queue using @JmsListener annotation in order to receive messages. The library throws an Exception that queue is not found and closes the connection. Then application try once again to establish a connection to the queue. The situation is repeated many times. Majority of the connections is successfully closed but some of them not.
In our opinion this is a few percent of connections that are not closed.
The big problem for us is when connection pool to MQServer is exhausted because the only way to correct application operation is to restart it.

Code example of JmsListener

@Component
public class QueueMessageListener {
    static final String TESTQUEUE2 = "TESTQ2";
    private final static Logger LOGGER =
            Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);

    @JmsListener(id = "listener2", destination = TESTQUEUE2, concurrency = "10-20")
    void receive(String textMessage) throws Exception {
        LOGGER.log(Level.INFO, "Queue: " + TESTQUEUE2 + " received
    }
}

In order to check the quantity of connections established from our application to queue manager we prepared batch file:

@echo off
SET  MQSERVER=CHANNEL/TCP/SERVER_IP(PORT) 
echo MQ connections count: 
:here
echo DISPLAY CHSTATUS(CHANNEL) CONNAME | runmqsc QUEUEMANAGER | find /c "CONNAME(IP_ADDRESS)"
goto here

CHANNEL, SERVER_IP, PORT, CHANNEL, QUEUEMANAGER are replaced by real values of course.

Testing the problem
We have test application using JmsListener as above. TESTQUEUE2 is the queue which does not exist on MQ SERVER. The number of connections shown by batch file should be constant but after some minutes it grows slowly. In about one hour number of connections exceeds limit in queue manager and application terminates because of inability of queue connection creation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions