[jboss-jira] [JBoss JIRA] (WFLY-3619) XA END / un-enlist for database connection called to early

Andreas Liebscher (JIRA) issues at jboss.org
Thu Jul 24 17:49:30 EDT 2014


    [ https://issues.jboss.org/browse/WFLY-3619?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12987819#comment-12987819 ] 

Andreas Liebscher edited comment on WFLY-3619 at 7/24/14 5:48 PM:
------------------------------------------------------------------

                <xa-datasource jndi-name="java:/jdbc/***2" pool-name="***2" enabled="true" spy="true">
                    <xa-datasource-property name="URL">
                        jdbc:sqlserver://127.0.0.1:1433;DatabaseName=***
                    </xa-datasource-property>
                    <xa-datasource-property name="DatabaseName">
                        ***
                    </xa-datasource-property>
                    <xa-datasource-property name="PortNumber">
                        1433
                    </xa-datasource-property>
                    <xa-datasource-property name="ApplicationName">
                        ***
                    </xa-datasource-property>
                    <xa-datasource-property name="LoginTimeout">
                        60
                    </xa-datasource-property>
                    <xa-datasource-property name="LockTimeout">
                        60000
                    </xa-datasource-property>
                    <xa-datasource-property name="SelectMethod">
                        cursor
                    </xa-datasource-property>
                    <xa-datasource-property name="ResponseBuffering">
                        full
                    </xa-datasource-property>
                    <xa-datasource-property name="User">
                        product-mip-dev-ali
                    </xa-datasource-property>
                    <xa-datasource-property name="Password">
                        xxx
                    </xa-datasource-property>
                    <xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
                    <driver>sqljdbc4xa</driver>
                    <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
                    <xa-pool>
                        <min-pool-size>5</min-pool-size>
                        <max-pool-size>30</max-pool-size>
                        <use-strict-min>false</use-strict-min>
                        <interleaving>false</interleaving>
                        <pad-xid>false</pad-xid>
                        <wrap-xa-resource>false</wrap-xa-resource>
                    </xa-pool>
                    <security>
                        <user-name>***</user-name>
                        <password>***</password>
                    </security>
                    <validation>
                        <validate-on-match>false</validate-on-match>
                        <background-validation>false</background-validation>
                    </validation>
                    <timeout>
                        <xa-resource-timeout>3600</xa-resource-timeout>
                    </timeout>
                    <statement>
                        <share-prepared-statements>false</share-prepared-statements>
                    </statement>
                </xa-datasource>
                <drivers>
                    <driver name="h2" module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                    </driver>
                    <driver name="sqljdbc4xa" module="com.microsoft.sqlserver">
                        <xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
                    </driver>
                </drivers>



was (Author: aliebscher):
                <xa-datasource jndi-name="java:/jdbc/centerware2" pool-name="centerware2" enabled="true" spy="true">
                    <xa-datasource-property name="URL">
                        jdbc:sqlserver://127.0.0.1:1433;DatabaseName=ProductDevALiMIP
                    </xa-datasource-property>
                    <xa-datasource-property name="DatabaseName">
                        ProductDevALiMIP
                    </xa-datasource-property>
                    <xa-datasource-property name="PortNumber">
                        1433
                    </xa-datasource-property>
                    <xa-datasource-property name="ApplicationName">
                        mobileX MIP - Centerware2 XA
                    </xa-datasource-property>
                    <xa-datasource-property name="LoginTimeout">
                        60
                    </xa-datasource-property>
                    <xa-datasource-property name="LockTimeout">
                        60000
                    </xa-datasource-property>
                    <xa-datasource-property name="SelectMethod">
                        cursor
                    </xa-datasource-property>
                    <xa-datasource-property name="ResponseBuffering">
                        full
                    </xa-datasource-property>
                    <xa-datasource-property name="User">
                        product-mip-dev-ali
                    </xa-datasource-property>
                    <xa-datasource-property name="Password">
                        xxx
                    </xa-datasource-property>
                    <xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
                    <driver>sqljdbc4xa</driver>
                    <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
                    <xa-pool>
                        <min-pool-size>5</min-pool-size>
                        <max-pool-size>30</max-pool-size>
                        <use-strict-min>false</use-strict-min>
                        <interleaving>false</interleaving>
                        <pad-xid>false</pad-xid>
                        <wrap-xa-resource>false</wrap-xa-resource>
                    </xa-pool>
                    <security>
                        <user-name>product-mip-dev-ali</user-name>
                        <password>mobilex</password>
                    </security>
                    <validation>
                        <validate-on-match>false</validate-on-match>
                        <background-validation>false</background-validation>
                    </validation>
                    <timeout>
                        <xa-resource-timeout>3600</xa-resource-timeout>
                    </timeout>
                    <statement>
                        <share-prepared-statements>false</share-prepared-statements>
                    </statement>
                </xa-datasource>
                <drivers>
                    <driver name="h2" module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                    </driver>
                    <driver name="sqljdbc4xa" module="com.microsoft.sqlserver">
                        <xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
                    </driver>
                </drivers>


> XA END / un-enlist for database connection called to early
> ----------------------------------------------------------
>
>                 Key: WFLY-3619
>                 URL: https://issues.jboss.org/browse/WFLY-3619
>             Project: WildFly
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: EJB, JCA, JPA / Hibernate, Transactions
>    Affects Versions: 8.0.0.Final
>         Environment: Windows 7 64-bit
> JDK 1.8.0_05-b13 64-Bit
> MS SQL Server 2012 database
> Latest MS JDBC driver
> XA datasource
>            Reporter: Andreas Liebscher
>            Assignee: Scott Marlow
>            Priority: Blocker
>         Attachments: server.jca.log, server_MSSQL_Trace.log
>
>
> While trying to port an EE application from JBoss5 to WF8 the following problem occurred:
> EJBs (@Required) using JPA to do some data changes.
> Some changes get already written to the database, others reside in the session cache.
> After the top EJB call returns, a Hibernate Session flush is triggered in beforeCompletion.
> Then more changes are flushed to the database, but I run in a reproduceable database locking problem.
> After some time an update of a row fails with lock wait timeout. This row has been inserted prior during the EJB call.
> There should be exactly one xa transaction active processing all data changes.
> But the database shows two active session, one is an xa transaction with sessionId -2 (orphaned), the other session is a local transaction.
> After analyzing all database communication with the help of the JDBC driver logging I found the following behaviour:
> - a connection is enlisted and xa start called
> - the same connection is used for several select / insert / update statements
> - after return of the top EJB call on the same connection xa end and connection un-enlist is called
> - the same connection is used for session flush (beforeCompletion) but with local transaction because the connection is no longer associated with the xa transaction, so locks can be expected.
> Shouldn't xa end be called AFTER beforeCompletion / session flush!?!



--
This message was sent by Atlassian JIRA
(v6.2.6#6264)


More information about the jboss-jira mailing list