[ 
https://issues.apache.org/jira/browse/ARTEMIS-5481?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17952980#comment-17952980
 ] 

Jelmer commented on ARTEMIS-5481:
---------------------------------

[~clebertsuconic] Below is a code snippet with regard to how we use the 
management queues (changed a bit for clearity). 
{code:java}
public void doRequest(final Connection connection,
                      final ClientMessageSupplier clientMessageSupplier,
                      final Consumer<ClientMessage> replyMessageConsumer) {
    try (final Session jmsSession = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE)) {
       final ClientSession clientSession = ((ActiveMQSession) 
jmsSession).getCoreSession();
       final ClientRequestor requestor = createClientRequestor(clientSession, 
"activemq.management");
       final ClientMessage message = clientMessageSupplier.get(clientSession);
       clientSession.start();
       final ClientMessage reply = requestor.request(message);
       replyMessageConsumer.accept(reply);
    } catch (final Exception e) {
       throw new IllegalStateException(e);
    }
}{code}
The connection used to create the session is provided to this code in a Java 
try-with-resources. This connection can/will be used for multiple calls. The 
supplier and consumer provided to the method guide what the actual call is and 
how to handle the response. The supplier will, ie, do the following (changed a 
bit for clearity): 
{code:java}
public ClientMessage get(final ClientSession clientSession) {
    final ClientMessage clientMessage = clientSession.createMessage(false);

    try {
       ManagementHelper.putOperationInvocation(clientMessage, "broker", 
"getQueueNames", new Object[]{});
    } catch (final Exception e) {
       throw new IllegalStateException(e);
    }
    return clientMessage;
} {code}
The consumer will handle the response using the management-helper 
(ManagementHelper.getResult(clientMessage)).
 

> Accumulation activemq.managment queues and addresses, increase connections
> --------------------------------------------------------------------------
>
>                 Key: ARTEMIS-5481
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-5481
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 2.36.0, 2.37.0, 2.38.0, 2.39.0, 2.40.0, 2.41.0
>            Reporter: Diederick
>            Assignee: Clebert Suconic
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: 8408_2.31_2.37_Elastic.PNG, 
> cjiblx8408_2.31_2.37_ATO_CL1.PNG, image-2025-05-15-13-14-20-461.png, 
> image-2025-05-19-10-03-28-268.png
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> We have a lot of problems with Artemis version 2.36.0 and higher (in a HA 
> setup with shared file system). Our clients use activemq.management requests 
> to see which node is active(primary) etc.
> Now from version 2.36.0 and higher there is a accumulation of these 
> activemq.management queues and addresses.  There is also a big increase in 
> connections (amount of client connections is the same). This accumulation 
> eats all the resources on the node (cpu and memory). Eventually the node give 
> first a out of memory on the GUI and then node it self becomes unresponsive 
> and dies (OOM kill) (no failover).
> As you can see in this graphic below (the green line), for version 2.36.0, 
> there is a increase of connections (around 800). The behaviour is that 
> management queues address slowly accumulate and eating resources (cpu and 
> memory)
> After the gap you see version 2.35.0, which is a 'normal' amount of 
> connections. Also the accumulation of management addresses and queues are 
> cleaned up with default parameters
> !image-2025-05-15-13-14-20-461.png!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to