You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by "Hiranya Jayathilaka (JIRA)" <ji...@apache.org> on 2013/07/21 03:21:46 UTC

[jira] [Assigned] (SYNAPSE-871) Connection Leaks When Using DBReport Mediator with XADataSources

     [ https://issues.apache.org/jira/browse/SYNAPSE-871?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hiranya Jayathilaka reassigned SYNAPSE-871:
-------------------------------------------

    Assignee: Hiranya Jayathilaka
    
> Connection Leaks When Using DBReport Mediator with XADataSources
> ----------------------------------------------------------------
>
>                 Key: SYNAPSE-871
>                 URL: https://issues.apache.org/jira/browse/SYNAPSE-871
>             Project: Synapse
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1
>         Environment: Tomcat 7, Atomikos 3.7.0, Synapse 2.1.0, MySQL 5.1.0.
>            Reporter: Anjana Fernando
>            Assignee: Hiranya Jayathilaka
>         Attachments: SYNAPSE-871-Patch.txt
>
>
> When using Synapse inside Tomcat with the Atomikos transaction manager, when DBReport is participating in a distributed transaction, the connections it is created are not getting returned back to the connection pool, and the connections eventually runs out. By looking at the code, it seems to be that, the mediator gets a new connection from the data source, and it also looks up the connection for a second time using a Statement object it created, it seems, this getting the connection again from the Statement is faulty in some cases, where when used with MySQL, it ends up with connection leaks. So I'm proposing to just create the connection at one time and pass the connection to others methods that are needed, i.e. AbstractDBMediator#getPreparedStatement.
> * The entry in Tomcat's context.xml for defining the data source is as follows:
> =======================================================
>     <Resource
> name="jdbc/db1"
> auth="Container"
> type="com.atomikos.jdbc.AtomikosDataSourceBean"
> factory="com.atomikos.tomcat.BeanFactory"
> uniqueResourceName="java:comp/env/jdbc/db1"
> xaDataSourceClassName="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"
> xaProperties.databaseName="SEQUENCE_DB"
> xaProperties.serverName="localhost"
> xaProperties.port="3306"
> xaProperties.user="root"
> xaProperties.password="123"
> xaProperties.url="jdbc:mysql://localhost:3306/SEQUENCE_DB?pinGlobalTxToPhysicalConnection=true"
> />
> =======================================================
> * The database used above contains a single table called "SEQUENCE" which only has a auto increment integer as the primary key. 
> * Atomikos has been integrated with Tomcat as it is mentioned here: http://www.atomikos.com/Documentation/Tomcat7Integration35
> * The DBReport mediator definition:-
> =======================================================
> <dbreport useTransaction="true">
>                      <connection>
>                         <pool>
>                            <password>123</password>
>                            <user>root</user>
>                            <dsName>java:comp/env/jdbc/db1</dsName>
>                            <url>jdbc:mysql://localhost:3306/SEQUENCE_DB</url>
>                            <icClass>org.apache.naming.java.javaURLContextFactory</icClass>
>                         </pool>
>                      </connection>
>                      <statement>
>                         <sql>INSERT INTO SEQUENCE VALUES ()</sql>
>                      </statement>
>                   </dbreport>
> =======================================================
> * Execute the above DBReport mediator to reproduce the connection leak scenario. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org