Transaction Exception due to ServiceMix JMS Provider
----------------------------------------------------

                 Key: SM-981
                 URL: https://issues.apache.org/activemq/browse/SM-981
             Project: ServiceMix
          Issue Type: Bug
          Components: servicemix-jms
    Affects Versions: 3.1
         Environment: All platforms. The bug was encountered on ServiceMix 3.1 
running in JBoss against JBossMQ.
            Reporter: Martin Landua
             Fix For: 3.2
         Attachments: servicemix-jms.patch

Hi all,

under heavy load, we have encountered a problem when writing messages using the 
JMS provider in a synchronous, transactional flow.

The problem is that in the code (lines 100 and up)

            producer.send(msg);
            exchange.setStatus(ExchangeStatus.DONE);
            channel.send(exchange);
        } finally {
            if (session != null) {
                session.close();
            }
            if (connection != null) {
                connection.close();
            }
        }

it is possible that the DONE state would return to the originator faster than 
the session and the connection is closed in the finally section. If this 
happens, the originator (and therefore owner of the transaction) will first 
commit and after this the provider would close the connection.

This results in a transaction exception.

>From what we can tell, it should read like this:

            producer.send(msg);
        } finally {
            if (session != null) {
                session.close();
            }
            if (connection != null) {
                connection.close();
            }
        }

            exchange.setStatus(ExchangeStatus.DONE);
            channel.send(exchange);

due to which we guarantee that the connection is safely closed before we send 
the confirmation back to the consumer.

All of our load tests succeeded after this change.

Best regards

Martin Landua

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to