You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Kai Hudalla (JIRA)" <ji...@apache.org> on 2008/03/12 11:36:41 UTC

[jira] Created: (AMQ-1617) XA transaction fails to prepare commit

XA transaction fails to prepare commit
--------------------------------------

                 Key: AMQ-1617
                 URL: https://issues.apache.org/activemq/browse/AMQ-1617
             Project: ActiveMQ
          Issue Type: Bug
          Components: Broker, Transport
    Affects Versions: 4.1.2, 5.1.0
         Environment: Windows XP, glassfish v2 UR1
            Reporter: Kai Hudalla


I am trying to do a database update and send a message to ActiveMQ via JMS in a single XA transaction. When tha JTA transaction manager tries to prepare the commit I get the following in the ActiveMQ log and the transaction is rolled back.

2008-03-12 11:09:01,713 [/127.0.0.1:2399] DEBUG TransportConnection            - Setting up new connection: /127.0.0.1:2399
2008-03-12 11:09:01,713 [/127.0.0.1:2399] DEBUG AbstractRegion                 - Adding consumer: ID:FE-Z2965-2033-1205312064755-0:30:-1:1
2008-03-12 11:09:01,728 [/127.0.0.1:2399] DEBUG AMQMessageStore                - Journalled transacted message add for: ID:FE-Z2965-2033-1205312064755-0:30:1:1:1, at: offset = 3213, file = 1, size = 557, type = 1
2008-03-12 11:09:01,728 [/127.0.0.1:2399] DEBUG AbstractRegion                 - Removing consumer: ID:FE-Z2965-2033-1205312064755-0:30:-1:1
2008-03-12 11:09:01,728 [/127.0.0.1:2399] DEBUG Service                        - Error occured while processing sync command: java.lang.NullPointerException: Context is null
java.lang.NullPointerException: Context is null
	at org.apache.activemq.broker.TransportConnection.processPrepareTransaction(TransportConnection.java:375)
	at org.apache.activemq.command.TransactionInfo.visit(TransactionInfo.java:98)
	at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:291)
	at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:181)
	at org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
	at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:134)
	at org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:204)
	at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:84)
	at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:196)
	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:183)
	at java.lang.Thread.run(Thread.java:595)
2008-03-12 11:09:01,744 [/127.0.0.1:2399] DEBUG TransportConnection            - Setting up new connection: /127.0.0.1:2399
2008-03-12 11:09:01,744 [/127.0.0.1:2399] DEBUG AbstractRegion                 - Adding consumer: ID:FE-Z2965-2033-1205312064755-0:30:-1:2
2008-03-12 11:09:01,760 [/127.0.0.1:2399] DEBUG XATransaction                  - XA Transaction rollback: XID:4871251:0f000000549135a246452d5a323936352c7365727665722c5033373030:46452d5a323936352c7365727665722c50333730302c01
2008-03-12 11:09:01,760 [/127.0.0.1:2399] DEBUG AMQMessageStore                - Transacted message add rollback for: ID:FE-Z2965-2033-1205312064755-0:30:1:1:1, at: offset = 3213, file = 1, size = 557, type = 1

The problem seems to be that the current connection is unregistered from the org.apache.activemq.broker.TransportConnectionStateRegister once the message is written to the journal and no new connection is registered before the processPrepareTransaction invocation. However, I have no idea where to look in the code to fix this.

Regards,
Kai

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


[jira] Resolved: (AMQ-1617) XA transaction fails to prepare commit

Posted by "Kai Hudalla (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-1617?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kai Hudalla resolved AMQ-1617.
------------------------------

    Resolution: Won't Fix

The problem is that the application server (glassfish) triggers the ManagedConnection's cleanup() method after XA.end and BEFORE XA.prepare (and not AFTER the XA.commit  as mandated by the JCA spec). Thus the broker does not have any transactional context anymore when the XA.prepare is issued ...

Kai

> XA transaction fails to prepare commit
> --------------------------------------
>
>                 Key: AMQ-1617
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1617
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, Transport
>    Affects Versions: 4.1.2, 5.1.0
>         Environment: Windows XP, glassfish v2 UR1
>            Reporter: Kai Hudalla
>
> I am trying to do a database update and send a message to ActiveMQ via JMS in a single XA transaction. When tha JTA transaction manager tries to prepare the commit I get the following in the ActiveMQ log and the transaction is rolled back.
> 2008-03-12 11:09:01,713 [/127.0.0.1:2399] DEBUG TransportConnection            - Setting up new connection: /127.0.0.1:2399
> 2008-03-12 11:09:01,713 [/127.0.0.1:2399] DEBUG AbstractRegion                 - Adding consumer: ID:FE-Z2965-2033-1205312064755-0:30:-1:1
> 2008-03-12 11:09:01,728 [/127.0.0.1:2399] DEBUG AMQMessageStore                - Journalled transacted message add for: ID:FE-Z2965-2033-1205312064755-0:30:1:1:1, at: offset = 3213, file = 1, size = 557, type = 1
> 2008-03-12 11:09:01,728 [/127.0.0.1:2399] DEBUG AbstractRegion                 - Removing consumer: ID:FE-Z2965-2033-1205312064755-0:30:-1:1
> 2008-03-12 11:09:01,728 [/127.0.0.1:2399] DEBUG Service                        - Error occured while processing sync command: java.lang.NullPointerException: Context is null
> java.lang.NullPointerException: Context is null
> 	at org.apache.activemq.broker.TransportConnection.processPrepareTransaction(TransportConnection.java:375)
> 	at org.apache.activemq.command.TransactionInfo.visit(TransactionInfo.java:98)
> 	at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:291)
> 	at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:181)
> 	at org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
> 	at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:134)
> 	at org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:204)
> 	at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:84)
> 	at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:196)
> 	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:183)
> 	at java.lang.Thread.run(Thread.java:595)
> 2008-03-12 11:09:01,744 [/127.0.0.1:2399] DEBUG TransportConnection            - Setting up new connection: /127.0.0.1:2399
> 2008-03-12 11:09:01,744 [/127.0.0.1:2399] DEBUG AbstractRegion                 - Adding consumer: ID:FE-Z2965-2033-1205312064755-0:30:-1:2
> 2008-03-12 11:09:01,760 [/127.0.0.1:2399] DEBUG XATransaction                  - XA Transaction rollback: XID:4871251:0f000000549135a246452d5a323936352c7365727665722c5033373030:46452d5a323936352c7365727665722c50333730302c01
> 2008-03-12 11:09:01,760 [/127.0.0.1:2399] DEBUG AMQMessageStore                - Transacted message add rollback for: ID:FE-Z2965-2033-1205312064755-0:30:1:1:1, at: offset = 3213, file = 1, size = 557, type = 1
> The problem seems to be that the current connection is unregistered from the org.apache.activemq.broker.TransportConnectionStateRegister once the message is written to the journal and no new connection is registered before the processPrepareTransaction invocation. However, I have no idea where to look in the code to fix this.
> Regards,
> Kai

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


[jira] Reopened: (AMQ-1617) XA transaction fails to prepare commit

Posted by "Alexei Akimov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-1617?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Akimov reopened AMQ-1617:
--------------------------------

    Regression: [Regression]

I do think this is an ActiveMQ bug. The mentioned behaviour violates Java Connector Architecture (JCA) and Java Transaction Architecture (JTA) specifications. XAResource must have opportunity to commit one transaction being already used in another one. In a typical scenario described in specs managed connection is cleaned up before the transaction commits. Being cleaned the connection is returned to pool and can be supplied to another client. In the current ActiveMQ implementation this leads to invalid connection context when the first transaction commits. XAResource implementatiom must not depend on the connection client specific data which is cleaned before returning the connection to pool.

Hera are the references to specs:
1. Scenario: Connection Close and JTA Transactional Cleanup (JCA 7.6.5)
2. Scenario: Connection Event Notifications and Connection Close (JCA 6.8.3)
3. Resource Sharing (JTA 3.6.4)

Best regards
Alexei Akimov

> XA transaction fails to prepare commit
> --------------------------------------
>
>                 Key: AMQ-1617
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1617
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, Transport
>    Affects Versions: 4.1.2, 5.1.0
>         Environment: Windows XP, glassfish v2 UR1
>            Reporter: Kai Hudalla
>
> I am trying to do a database update and send a message to ActiveMQ via JMS in a single XA transaction. When tha JTA transaction manager tries to prepare the commit I get the following in the ActiveMQ log and the transaction is rolled back.
> 2008-03-12 11:09:01,713 [/127.0.0.1:2399] DEBUG TransportConnection            - Setting up new connection: /127.0.0.1:2399
> 2008-03-12 11:09:01,713 [/127.0.0.1:2399] DEBUG AbstractRegion                 - Adding consumer: ID:FE-Z2965-2033-1205312064755-0:30:-1:1
> 2008-03-12 11:09:01,728 [/127.0.0.1:2399] DEBUG AMQMessageStore                - Journalled transacted message add for: ID:FE-Z2965-2033-1205312064755-0:30:1:1:1, at: offset = 3213, file = 1, size = 557, type = 1
> 2008-03-12 11:09:01,728 [/127.0.0.1:2399] DEBUG AbstractRegion                 - Removing consumer: ID:FE-Z2965-2033-1205312064755-0:30:-1:1
> 2008-03-12 11:09:01,728 [/127.0.0.1:2399] DEBUG Service                        - Error occured while processing sync command: java.lang.NullPointerException: Context is null
> java.lang.NullPointerException: Context is null
> 	at org.apache.activemq.broker.TransportConnection.processPrepareTransaction(TransportConnection.java:375)
> 	at org.apache.activemq.command.TransactionInfo.visit(TransactionInfo.java:98)
> 	at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:291)
> 	at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:181)
> 	at org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
> 	at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:134)
> 	at org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:204)
> 	at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:84)
> 	at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:196)
> 	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:183)
> 	at java.lang.Thread.run(Thread.java:595)
> 2008-03-12 11:09:01,744 [/127.0.0.1:2399] DEBUG TransportConnection            - Setting up new connection: /127.0.0.1:2399
> 2008-03-12 11:09:01,744 [/127.0.0.1:2399] DEBUG AbstractRegion                 - Adding consumer: ID:FE-Z2965-2033-1205312064755-0:30:-1:2
> 2008-03-12 11:09:01,760 [/127.0.0.1:2399] DEBUG XATransaction                  - XA Transaction rollback: XID:4871251:0f000000549135a246452d5a323936352c7365727665722c5033373030:46452d5a323936352c7365727665722c50333730302c01
> 2008-03-12 11:09:01,760 [/127.0.0.1:2399] DEBUG AMQMessageStore                - Transacted message add rollback for: ID:FE-Z2965-2033-1205312064755-0:30:1:1:1, at: offset = 3213, file = 1, size = 557, type = 1
> The problem seems to be that the current connection is unregistered from the org.apache.activemq.broker.TransportConnectionStateRegister once the message is written to the journal and no new connection is registered before the processPrepareTransaction invocation. However, I have no idea where to look in the code to fix this.
> Regards,
> Kai

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


[jira] Closed: (AMQ-1617) XA transaction fails to prepare commit

Posted by "Kai Hudalla (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-1617?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kai Hudalla closed AMQ-1617.
----------------------------


Not a bug in ActiveMQ

> XA transaction fails to prepare commit
> --------------------------------------
>
>                 Key: AMQ-1617
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1617
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, Transport
>    Affects Versions: 4.1.2, 5.1.0
>         Environment: Windows XP, glassfish v2 UR1
>            Reporter: Kai Hudalla
>
> I am trying to do a database update and send a message to ActiveMQ via JMS in a single XA transaction. When tha JTA transaction manager tries to prepare the commit I get the following in the ActiveMQ log and the transaction is rolled back.
> 2008-03-12 11:09:01,713 [/127.0.0.1:2399] DEBUG TransportConnection            - Setting up new connection: /127.0.0.1:2399
> 2008-03-12 11:09:01,713 [/127.0.0.1:2399] DEBUG AbstractRegion                 - Adding consumer: ID:FE-Z2965-2033-1205312064755-0:30:-1:1
> 2008-03-12 11:09:01,728 [/127.0.0.1:2399] DEBUG AMQMessageStore                - Journalled transacted message add for: ID:FE-Z2965-2033-1205312064755-0:30:1:1:1, at: offset = 3213, file = 1, size = 557, type = 1
> 2008-03-12 11:09:01,728 [/127.0.0.1:2399] DEBUG AbstractRegion                 - Removing consumer: ID:FE-Z2965-2033-1205312064755-0:30:-1:1
> 2008-03-12 11:09:01,728 [/127.0.0.1:2399] DEBUG Service                        - Error occured while processing sync command: java.lang.NullPointerException: Context is null
> java.lang.NullPointerException: Context is null
> 	at org.apache.activemq.broker.TransportConnection.processPrepareTransaction(TransportConnection.java:375)
> 	at org.apache.activemq.command.TransactionInfo.visit(TransactionInfo.java:98)
> 	at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:291)
> 	at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:181)
> 	at org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
> 	at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:134)
> 	at org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:204)
> 	at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:84)
> 	at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:196)
> 	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:183)
> 	at java.lang.Thread.run(Thread.java:595)
> 2008-03-12 11:09:01,744 [/127.0.0.1:2399] DEBUG TransportConnection            - Setting up new connection: /127.0.0.1:2399
> 2008-03-12 11:09:01,744 [/127.0.0.1:2399] DEBUG AbstractRegion                 - Adding consumer: ID:FE-Z2965-2033-1205312064755-0:30:-1:2
> 2008-03-12 11:09:01,760 [/127.0.0.1:2399] DEBUG XATransaction                  - XA Transaction rollback: XID:4871251:0f000000549135a246452d5a323936352c7365727665722c5033373030:46452d5a323936352c7365727665722c50333730302c01
> 2008-03-12 11:09:01,760 [/127.0.0.1:2399] DEBUG AMQMessageStore                - Transacted message add rollback for: ID:FE-Z2965-2033-1205312064755-0:30:1:1:1, at: offset = 3213, file = 1, size = 557, type = 1
> The problem seems to be that the current connection is unregistered from the org.apache.activemq.broker.TransportConnectionStateRegister once the message is written to the journal and no new connection is registered before the processPrepareTransaction invocation. However, I have no idea where to look in the code to fix this.
> Regards,
> Kai

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


[jira] Updated: (AMQ-1617) XA transaction fails to prepare commit

Posted by "Gary Tully (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-1617?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Tully updated AMQ-1617:
----------------------------

      Component/s:     (was: Broker)
                       (was: Transport)
                   JCA Container
    Fix Version/s:     (was: 5.3.0)
                   5.4.0

A test case would help make this concrete. There have been some mods the the JCA connector to defer connection close till a transaction completes, allowing a connection to be pooled when a transaction is still in need of completion. 
With a test case we could verify the expected behavior against trunk. If the test still fails with trunk or a 5.3-SNAPSHOT we will have something to work on.

> XA transaction fails to prepare commit
> --------------------------------------
>
>                 Key: AMQ-1617
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1617
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: JCA Container
>    Affects Versions: 4.1.2, 5.1.0
>         Environment: Windows XP, glassfish v2 UR1
>            Reporter: Kai Hudalla
>             Fix For: 5.4.0
>
>
> I am trying to do a database update and send a message to ActiveMQ via JMS in a single XA transaction. When tha JTA transaction manager tries to prepare the commit I get the following in the ActiveMQ log and the transaction is rolled back.
> 2008-03-12 11:09:01,713 [/127.0.0.1:2399] DEBUG TransportConnection            - Setting up new connection: /127.0.0.1:2399
> 2008-03-12 11:09:01,713 [/127.0.0.1:2399] DEBUG AbstractRegion                 - Adding consumer: ID:FE-Z2965-2033-1205312064755-0:30:-1:1
> 2008-03-12 11:09:01,728 [/127.0.0.1:2399] DEBUG AMQMessageStore                - Journalled transacted message add for: ID:FE-Z2965-2033-1205312064755-0:30:1:1:1, at: offset = 3213, file = 1, size = 557, type = 1
> 2008-03-12 11:09:01,728 [/127.0.0.1:2399] DEBUG AbstractRegion                 - Removing consumer: ID:FE-Z2965-2033-1205312064755-0:30:-1:1
> 2008-03-12 11:09:01,728 [/127.0.0.1:2399] DEBUG Service                        - Error occured while processing sync command: java.lang.NullPointerException: Context is null
> java.lang.NullPointerException: Context is null
> 	at org.apache.activemq.broker.TransportConnection.processPrepareTransaction(TransportConnection.java:375)
> 	at org.apache.activemq.command.TransactionInfo.visit(TransactionInfo.java:98)
> 	at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:291)
> 	at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:181)
> 	at org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
> 	at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:134)
> 	at org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:204)
> 	at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:84)
> 	at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:196)
> 	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:183)
> 	at java.lang.Thread.run(Thread.java:595)
> 2008-03-12 11:09:01,744 [/127.0.0.1:2399] DEBUG TransportConnection            - Setting up new connection: /127.0.0.1:2399
> 2008-03-12 11:09:01,744 [/127.0.0.1:2399] DEBUG AbstractRegion                 - Adding consumer: ID:FE-Z2965-2033-1205312064755-0:30:-1:2
> 2008-03-12 11:09:01,760 [/127.0.0.1:2399] DEBUG XATransaction                  - XA Transaction rollback: XID:4871251:0f000000549135a246452d5a323936352c7365727665722c5033373030:46452d5a323936352c7365727665722c50333730302c01
> 2008-03-12 11:09:01,760 [/127.0.0.1:2399] DEBUG AMQMessageStore                - Transacted message add rollback for: ID:FE-Z2965-2033-1205312064755-0:30:1:1:1, at: offset = 3213, file = 1, size = 557, type = 1
> The problem seems to be that the current connection is unregistered from the org.apache.activemq.broker.TransportConnectionStateRegister once the message is written to the journal and no new connection is registered before the processPrepareTransaction invocation. However, I have no idea where to look in the code to fix this.
> Regards,
> Kai

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