[jira] [Comment Edited] (AMQ-7067) KahaDB Recovery can experience a dangling transaction when prepare and commit occur on different pagefiles.

2018-10-04 Thread Jamie goodyear (JIRA)


[ 
https://issues.apache.org/jira/browse/AMQ-7067?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16638417#comment-16638417
 ] 

Jamie goodyear edited comment on AMQ-7067 at 10/4/18 5:40 PM:
--

Please see the amq7067 unit test.

This patch is for AMQ 5.15.x branch.

You can execute using the following command:
 mvn -Dtest=AMQ7067Test test


Keeping original comment for history:

I've attached a stand alone test case to reproduce the issue.

Here's how to use the test case:

0. Setup AMQ 5.15.6 broker on local system. Use default configuration, no 
special settings required. Start broker.
 1. Extract AMQ7067 zip file.
 2. Run XATransactionTest while Broker is live using :  mvn clean compile 
exec:java -Dexec.mainClass="XATransactionTest"

The test case will output:

[INFO] — exec-maven-plugin:1.6.0:java (default-cli) @ transaction —
 SLF4J: Class path contains multiple SLF4J bindings.
 SLF4J: Found binding in 
[jar:file:/Users/icbts/.m2/repository/org/apache/activemq/activemq-all/5.15.6/activemq-all-5.15.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
 SLF4J: Found binding in 
[jar:file:/Users/icbts/.m2/repository/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
 SLF4J: See [http://www.slf4j.org/codes.html#multiple_bindings] for an 
explanation.
 SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
 createDanglingTransaction txid: 
XID:[55,globalId=ffe9ffb8fff7ffa1,branchId=ffe9ffb8fff7ffa1]
 createXATransaction txid: XID:[55,globalId=15333ec,branchId=15333ec]
 Pending Transactions 1: 
[XID:[55,globalId=ffe9ffb8fff7ffa1,branchId=ffe9ffb8fff7ffa1]]
  INFO | I/O exception (org.apache.http.NoHttpResponseException) caught when 
processing request to {}->[http://localhost:8161:] The target server failed to 
respond
  INFO | Retrying request to {}->[http://localhost:8161|http://localhost:8161/]
 Pending Transactions 2: 
[XID:[55,globalId=ffe9ffb8fff7ffa1,branchId=ffe9ffb8fff7ffa1],
 XID:[55,globalId=15333ec,branchId=15333ec]]
 [INFO] 

In the Broker log you'll see:

 INFO | KahaDB is version 6
  INFO | Recovering from the journal @1:741
  INFO | Recovery replayed 429 operations from the journal in 0.081 seconds.
  WARN | Recovered prepared XA TX: 
[XID:[55,globalId=ffe9ffb8fff7ffa1,branchId=ffe9ffb8fff7ffa1]]
  WARN | Recovered prepared XA TX: 
[XID:[55,globalId=15333ec,branchId=15333ec]]
  
 On JConsole you'll see two messages in org.apache.activemq > Broker > 
RecoveredXaTransaction MBean.

Given we commit the transaction, I'd expect there to not be a message in 
Recovered state.

Note:  If we do not send additional messages to force a new page file, than we 
do not see the message in Recovered state after broker restart.

It appears to be that the prepared statement in db-1.log,. and commit in 
db-2.log will result in the commit getting GC'd (hence no pare to match) and 
having the message being seen as being in prepared state, and hence getting 
recovered.


was (Author: jgoodyear):
I've attached a stand alone test case to reproduce the issue.

Here's how to use the test case:

0. Setup AMQ 5.15.6 broker on local system. Use default configuration, no 
special settings required. Start broker.
 1. Extract AMQ7067 zip file.
2. Run XATransactionTest while Broker is live using :  mvn clean compile 
exec:java -Dexec.mainClass="XATransactionTest"

The test case will output:

[INFO] — exec-maven-plugin:1.6.0:java (default-cli) @ transaction —
 SLF4J: Class path contains multiple SLF4J bindings.
 SLF4J: Found binding in 
[jar:file:/Users/icbts/.m2/repository/org/apache/activemq/activemq-all/5.15.6/activemq-all-5.15.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
 SLF4J: Found binding in 
[jar:file:/Users/icbts/.m2/repository/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
 SLF4J: See [http://www.slf4j.org/codes.html#multiple_bindings] for an 
explanation.
 SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
 createDanglingTransaction txid: 
XID:[55,globalId=ffe9ffb8fff7ffa1,branchId=ffe9ffb8fff7ffa1]
 createXATransaction txid: XID:[55,globalId=15333ec,branchId=15333ec]
 Pending Transactions 1: 

[jira] [Comment Edited] (AMQ-7067) KahaDB Recovery can experience a dangling transaction when prepare and commit occur on different pagefiles.

2018-10-04 Thread Jamie goodyear (JIRA)


[ 
https://issues.apache.org/jira/browse/AMQ-7067?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16638417#comment-16638417
 ] 

Jamie goodyear edited comment on AMQ-7067 at 10/4/18 3:53 PM:
--

I've attached a stand alone test case to reproduce the issue.

Here's how to use the test case:

0. Setup AMQ 5.15.6 broker on local system. Use default configuration, no 
special settings required. Start broker.
 1. Extract AMQ7067 zip file.
2. Run XATransactionTest while Broker is live using :  mvn clean compile 
exec:java -Dexec.mainClass="XATransactionTest"

The test case will output:

[INFO] — exec-maven-plugin:1.6.0:java (default-cli) @ transaction —
 SLF4J: Class path contains multiple SLF4J bindings.
 SLF4J: Found binding in 
[jar:file:/Users/icbts/.m2/repository/org/apache/activemq/activemq-all/5.15.6/activemq-all-5.15.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
 SLF4J: Found binding in 
[jar:file:/Users/icbts/.m2/repository/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
 SLF4J: See [http://www.slf4j.org/codes.html#multiple_bindings] for an 
explanation.
 SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
 createDanglingTransaction txid: 
XID:[55,globalId=ffe9ffb8fff7ffa1,branchId=ffe9ffb8fff7ffa1]
 createXATransaction txid: XID:[55,globalId=15333ec,branchId=15333ec]
 Pending Transactions 1: 
[XID:[55,globalId=ffe9ffb8fff7ffa1,branchId=ffe9ffb8fff7ffa1]]
  INFO | I/O exception (org.apache.http.NoHttpResponseException) caught when 
processing request to {}->[http://localhost:8161:] The target server failed to 
respond
  INFO | Retrying request to {}->[http://localhost:8161|http://localhost:8161/]
 Pending Transactions 2: 
[XID:[55,globalId=ffe9ffb8fff7ffa1,branchId=ffe9ffb8fff7ffa1],
 XID:[55,globalId=15333ec,branchId=15333ec]]
 [INFO] 

In the Broker log you'll see:

 INFO | KahaDB is version 6
  INFO | Recovering from the journal @1:741
  INFO | Recovery replayed 429 operations from the journal in 0.081 seconds.
  WARN | Recovered prepared XA TX: 
[XID:[55,globalId=ffe9ffb8fff7ffa1,branchId=ffe9ffb8fff7ffa1]]
  WARN | Recovered prepared XA TX: 
[XID:[55,globalId=15333ec,branchId=15333ec]]
  
 On JConsole you'll see two messages in org.apache.activemq > Broker > 
RecoveredXaTransaction MBean.

Given we commit the transaction, I'd expect there to not be a message in 
Recovered state.

Note:  If we do not send additional messages to force a new page file, than we 
do not see the message in Recovered state after broker restart.

It appears to be that the prepared statement in db-1.log,. and commit in 
db-2.log will result in the commit getting GC'd (hence no pare to match) and 
having the message being seen as being in prepared state, and hence getting 
recovered.


was (Author: jgoodyear):
I've attached a stand alone test case to reproduce the issue.

Here's how to use the test case:

0. Setup AMQ 5.15.6 broker on local system. Use default configuration, no 
special settings required. Start broker.
1. Extract AMQ7067 zip file.
2. Use maven to build the test case.
3. Run XATransactionTest while Broker is live using :  mvn clean compile 
exec:java -Dexec.mainClass="XATransactionTest"

The test case will output:


[INFO] --- exec-maven-plugin:1.6.0:java (default-cli) @ transaction ---
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in 
[jar:file:/Users/icbts/.m2/repository/org/apache/activemq/activemq-all/5.15.6/activemq-all-5.15.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in 
[jar:file:/Users/icbts/.m2/repository/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
createDanglingTransaction txid: 
XID:[55,globalId=ffe9ffb8fff7ffa1,branchId=ffe9ffb8fff7ffa1]
createXATransaction txid: XID:[55,globalId=15333ec,branchId=15333ec]
Pending Transactions 1: 
[XID:[55,globalId=ffe9ffb8fff7ffa1,branchId=ffe9ffb8fff7ffa1]]
 INFO | I/O exception (org.apache.http.NoHttpResponseException) caught when 
processing request to {}->http://localhost:8161: The target