[
https://issues.jboss.org/browse/JBMESSAGING-1826?page=com.atlassian.jira....
]
Doug Grove updated JBMESSAGING-1826:
------------------------------------
Description:
In JDBCPersistenceManager, when a message is delivered and completed, the message is
removed from DB. It includes two deletes in the DB - the reference in JBM_MSG_REF and the
message in JBM_MSG. The two deletes are currently done in two separate local transactions
as in removeReference() method:
...
new RemoveReferenceRunner().executeWithRetry();
deleteMessage(ref.getMessage().getMessageID());
...
If a server crashes between the two operations, it will leave the tables in an
inconsistent state, i.e. ref removed but the message still there. This may result in
message stuck, as in this case:
1. A server is crashing when a client_ack comes in, the clienk_ack will cause the message
to be cleared from the server. If the client_ack processing goes as far as that the
removing of reference succeeds but failed to delete the message due to the crashing, the
message is left in JBM_MSG table but the corresponding entry in JBM_MSG_REF is gone.
2. Eventually the jms client will get ack failure exception. It then expects the messages
to be re-delivered after server start-up. But that will never happen. When the server
starts up it loads references in JBM_MSG_REF for delivery, but this message's ref is
gone.
Also, this can affect some database replication mechanisms - see Case 00595385. The
customer is running MySQL with replication.
was:
In JDBCPersistenceManager, when a message is delivered and completed, the message is
removed from DB. It includes two deletes in the DB - the reference in JBM_MSG_REF and the
message in JBM_MSG. The two deletes are currently done in two separate local transactions
as in removeReference() method:
...
new RemoveReferenceRunner().executeWithRetry();
deleteMessage(ref.getMessage().getMessageID());
...
If a server crashes between the two operations, it will leave the tables in an
inconsistent state, i.e. ref removed but the message still there. This may result in
message stuck, as in this case:
1. A server is crashing when a client_ack comes in, the clienk_ack will cause the message
to be cleared from the server. If the client_ack processing goes as far as that the
removing of reference succeeds but failed to delete the message due to the crashing, the
message is left in JBM_MSG table but the corresponding entry in JBM_MSG_REF is gone.
2. Eventually the jms client will get ack failure exception. It then expects the messages
to be re-delivered after server start-up. But that will never happen. When the server
starts up it loads references in JBM_MSG_REF for delivery, but this message's ref is
gone.
Removing a reference and deleting a message in DB should be wrapped
in a single transaction in JDBCPersistenceManager
----------------------------------------------------------------------------------------------------------------------
Key: JBMESSAGING-1826
URL:
https://issues.jboss.org/browse/JBMESSAGING-1826
Project: JBoss Messaging
Issue Type: Bug
Components: Messaging Core Persistence
Affects Versions: 1.4.0.SP3.CP10, 1.4.7.GA
Reporter: Yong Hao Gao
Assignee: Yong Hao Gao
Fix For: 1.4.0.SP3.CP15, 1.4.8.SP8
In JDBCPersistenceManager, when a message is delivered and completed, the message is
removed from DB. It includes two deletes in the DB - the reference in JBM_MSG_REF and the
message in JBM_MSG. The two deletes are currently done in two separate local transactions
as in removeReference() method:
...
new RemoveReferenceRunner().executeWithRetry();
deleteMessage(ref.getMessage().getMessageID());
...
If a server crashes between the two operations, it will leave the tables in an
inconsistent state, i.e. ref removed but the message still there. This may result in
message stuck, as in this case:
1. A server is crashing when a client_ack comes in, the clienk_ack will cause the message
to be cleared from the server. If the client_ack processing goes as far as that the
removing of reference succeeds but failed to delete the message due to the crashing, the
message is left in JBM_MSG table but the corresponding entry in JBM_MSG_REF is gone.
2. Eventually the jms client will get ack failure exception. It then expects the messages
to be re-delivered after server start-up. But that will never happen. When the server
starts up it loads references in JBM_MSG_REF for delivery, but this message's ref is
gone.
Also, this can affect some database replication mechanisms - see Case 00595385. The
customer is running MySQL with replication.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira