Romain Manni-Bucau created AMQ-6051:
---------------------------------------

             Summary: ActiveMQConnection leaking thread when resources are not 
well closed
                 Key: AMQ-6051
                 URL: https://issues.apache.org/jira/browse/AMQ-6051
             Project: ActiveMQ
          Issue Type: Bug
    Affects Versions: 5.12.0
            Reporter: Romain Manni-Bucau


ActiveMQConnection starts a session task thread but doesnt close it if close() 
is called and the broker doesnt respond

{code}
                    try {
                        if (isConnectionInfoSentToBroker) {
                            // If we announced ourselves to the broker.. Try to 
let the broker
                            // know that the connection is being shutdown.
                            RemoveInfo removeCommand = 
info.createRemoveCommand();
                            
removeCommand.setLastDeliveredSequenceId(lastDeliveredSequenceId);
                            try {
                                doSyncSendPacket(removeCommand, closeTimeout);
                            } catch (JMSException e) {
                                if (e.getCause() instanceof 
RequestTimedOutIOException) {
                                    // expected
                                } else {
                                    throw e;
                                }
                            }
                            doAsyncSendPacket(new ShutdownInfo());
                        }
                    } finally {
                        // ensure we clean up this connection anyway even if 
previous send fail
                        // which can happen if we lost the connection with the 
broker

                        started.set(false);

                        // TODO if we move the TaskRunnerFactory to the 
connection
                        // factory
                        // then we may need to call
                        // factory.onConnectionClose(this);
                        if (sessionTaskRunner != null) {
                            sessionTaskRunner.shutdown();
                        }
                        closed.set(true);
                        closing.set(false);
                    }
{code}

solves it

tested on 5.12.0 but 5.12.x has the same code so I guess it has the same issue



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to