activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stan Lewis (JIRA)" <>
Subject [jira] Updated: (AMQ-2880) Exception thrown during commit leads to message loss
Date Tue, 07 Sep 2010 20:48:40 GMT


Stan Lewis updated AMQ-2880:

    Attachment: xa-test-case.txt

Here's a test for XATransaction.  I'm finding however that catching the exception within commit
and calling rollback() from there doesn't seem to fix the issue.  Instead it seems like the
message is effectively lost, as when the dummy persistent store throws it's exception the
message is out of the database, I wouldn't have expected that.  Also to properly rollback
in the client I had to call XAResource.start() for some reason, also a bit unexpected.  Anyway,
am also attaching the changes I had done to

> Exception thrown during commit leads to message loss
> ----------------------------------------------------
>                 Key: AMQ-2880
>                 URL:
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.4.0
>            Reporter: Stan Lewis
>            Assignee: Gary Tully
>             Fix For: 5.4.1
>         Attachments: patch_for_xa_transaction.txt, test-case.txt, test-case.txt, xa-test-case.txt
> In cases where JDBC persistence is used and the database server is under a fair bit of
load it's sometimes possible for table/row locks to time out, which means you'll see exceptions
such as:
> java.sql.BatchUpdateException: Lock wait timeout exceeded; try restarting transaction
> at com.mysql.jdbc.PreparedStatement.executeBatchSerially(
> at com.mysql.jdbc.PreparedStatement.executeBatch(
> at org.apache.commons.dbcp.DelegatingStatement.executeBatch(
> at org.apache.commons.dbcp.DelegatingStatement.executeBatch(
> at
> at
> at
> at
> at$Tx.commit(
> at
> at org.apache.activemq.transaction.XATransaction.commit(
> at
> at
> at
> at org.apache.activemq.command.TransactionInfo.visit(
> at
> at$1.onCommand(
> at org.apache.activemq.transport.TransportFilter.onCommand(
> at org.apache.activemq.transport.WireFormatNegotiator.onCommand(
> at org.apache.activemq.transport.InactivityMonitor.onCommand(
> at org.apache.activemq.transport.TransportSupport.doConsume(
> at org.apache.activemq.transport.tcp.TcpTransport.doRun(
> at
> at
> In this case the connection to the database is fine and what we should do is retry the
transaction as it's a temporary failure condition.  Instead what happens is the broker moves
to the next message in the queue, leaving the current message in the database.  The message
won't show up in the web console and cannot be consumed by any consumers until the broker
is restarted.
> Attached is a test case that simulates the error condition in a controlled fashion by
using a subclassed JDBCPersistenceAdapter that will throw an exception in commitTransaction
as necessary.  So the producer sends 10 messages and then the consumer tries to consume them,
during this time the persistence adapter will throw an exception during commitTransaction.
 Then the condition is cleared and the consumer can consume all 10 messages, however the consumer
only consumes 9 messages, the 1st message in the sequence is still in the database.  Hopefully
the logging makes this clear.

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

View raw message