You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Gu...@instinet.com on 2005/11/29 20:11:53 UTC

XA-capable MCF for MySQL and connection leak?

I did the following:

1. Unzipped one of the xa- derby rars from tranql

2. Edited META-INF/ra.xml and changed the name of the MCF class (I wrote 
my own)

3. Wrote MysqlMCF which extends AbstractXADataSourceMCF, instantiates 
MysqlXADataSource (from alpha version of driver,
with my own fixes) and implements accessors and mutators for 
ConnectionURL, UserName and Password (don't need anything else.)
I am not sending the code for now because it's work-for-hire, but I just 
described what it does.

4. Zipped up the whole thing again.

It deploys fine. I am able to run 10 xa transactions that do updates in 
the database, and then I get an exception.
The maximum size of my pool in the plan is 10, so this looks like each 
connection is systematically not being closed.

Part of the log is below. You can see the sql statements, including 
special MySQL statements "XA START" etc. which implement
the xa support (this is the part which was broken in the driver - they 
used dots instead of commas, which doesn't work.)

At the bottom you can see the exception "dequeue is full".

I do call UserTransaction.commit(), and I do call Connection.close() 
during the COMMIT phase - off the top of my head I am not
sure if this is right. It has always worked in WebLogic, but WebLogic has 
good detection of connection leaks, so it may be too smart.
I wonder if I should call Connection.close() at the end of the ACTIVE 
phase (I inherited the code in question.)

com.mysql.jdbc.jdbc2.optional.MysqlXAConnection@18b1699 -> dispatching 
command: XA START 720575940379279360, 144115188075855872, 1197822575
SELECT NODE.TYPE, NODE.ID, NODE.VER, NODE.IS_CURRENT, 
NODE.REVISED_BY_USER_TYPE, NODE.REVISED_BY_USER_ID, 
NODE.REVISED_BY_USER_VER, NODE.REVISION_DATETIME, NODE.NAME, 
NODE.SUBNODE_TYPE, NODE.SUBNODE_ID, NODE.NODE_TO_NODE_ID FROM NODE WHERE 
(IS_CURRENT = 'Y' ) 
UPDATE NODE SET IS_CURRENT = 'N' WHERE ID = (8915721020536143062) AND 
IS_CURRENT = (Y)
INSERT INTO NODE VALUES ((NODE), (8915721020536143062), (23), (Y), (USER), 
(3), (0), (2005-11-29 13:45:47.933), (node 0), (null), (null), (null))
UPDATE NODE SET IS_CURRENT = 'N' WHERE ID = (8915721020536143063) AND 
IS_CURRENT = (Y)
INSERT INTO NODE VALUES ((NODE), (8915721020536143063), (23), (Y), (USER), 
(3), (0), (2005-11-29 13:45:47.933), (node 1), (null), (null), (null))
[...]
UPDATE NODE SET IS_CURRENT = 'N' WHERE ID = (8915721020599924308) AND 
IS_CURRENT = (Y)
INSERT INTO NODE VALUES ((NODE), (8915721020599924308), (9), (Y), (USER), 
(3), (0), (2005-11-29 13:45:47.933), (node 64), (null), (null), (null))
com.mysql.jdbc.jdbc2.optional.MysqlXAConnection@18b1699 -> dispatching 
command: XA END 720575940379279360, 144115188075855872, 1197822575
com.mysql.jdbc.jdbc2.optional.MysqlXAConnection@18b1699 -> dispatching 
command: XA PREPARE 720575940379279360, 144115188075855872, 1197822575
com.mysql.jdbc.jdbc2.optional.MysqlXAConnection@18b1699 -> dispatching 
command: XA COMMIT 720575940379279360, 144115188075855872, 1197822575
java.lang.IllegalStateException: deque is full: contents: 
[org.apache.geronimo.connector.outbound.ManagedConnectionInfo@7d30b3, 
org.apache.geronimo.connector.outbound.ManagedConnectionInfo@7d30b3, 
org.apache.geronimo.connector.outbound.ManagedConnectionInfo@7d30b3, 
org.apache.geronimo.connector.outbound.ManagedConnectionInfo@7d30b3, 
org.apache.geronimo.connector.outbound.ManagedConnectionInfo@7d30b3, 
org.apache.geronimo.connector.outbound.ManagedConnectionInfo@7d30b3, 
org.apache.geronimo.connector.outbound.ManagedConnectionInfo@7d30b3, 
org.apache.geronimo.connector.outbound.ManagedConnectionInfo@7d30b3, 
org.apache.geronimo.connector.outbound.ManagedConnectionInfo@7d30b3, 
org.apache.geronimo.connector.outbound.ManagedConnectionInfo@7d30b3]
                 at 
org.apache.geronimo.connector.outbound.SinglePoolConnectionInterceptor$PoolDeque.add(SinglePoolConnectionInterceptor.java:206)
                 at 
org.apache.geronimo.connector.outbound.SinglePoolConnectionInterceptor.internalReturn(SinglePoolConnectionInterceptor.java:128)
                 at 
org.apache.geronimo.connector.outbound.AbstractSinglePoolConnectionInterceptor.returnConnection(AbstractSinglePoolConnectionInterceptor.java:106)
                 at 
org.apache.geronimo.connector.outbound.TransactionEnlistingInterceptor.returnConnection(TransactionEnlistingInterceptor.java:94)
                 at 
org.apache.geronimo.connector.outbound.TransactionCachingInterceptor.internalReturn(TransactionCachingInterceptor.java:109)
                 at 
org.apache.geronimo.connector.outbound.TransactionCachingInterceptor.returnHandle(TransactionCachingInterceptor.java:127)
                 at 
org.apache.geronimo.connector.outbound.TransactionCachingInterceptor.afterCompletion(TransactionCachingInterceptor.java:116)
                 at 
org.apache.geronimo.transaction.context.InheritableTransactionContext.connectorAfterCommit(InheritableTransactionContext.java:256)
                 at 
org.apache.geronimo.transaction.context.InheritableTransactionContext.complete(InheritableTransactionContext.java:208)
                 at 
org.apache.geronimo.transaction.context.InheritableTransactionContext.commit(InheritableTransactionContext.java:146)
                 at 
org.apache.geronimo.transaction.context.OnlineUserTransaction.commit(OnlineUserTransaction.java:63)
                 at 
org.apache.jsp.test2_jsp._jspService(org.apache.jsp.test2_jsp:103)
                 at 
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
                 at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
                 at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
                 at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
                 at 
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
                 at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
                 at 
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
                 at 
org.apache.geronimo.jetty.JettyServletHolder.handle(JettyServletHolder.java:99)
                 at 
org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:832)
                 at 
org.mortbay.jetty.servlet.JSR154Filter.doFilter(JSR154Filter.java:171)
                 at 
org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:823)
                 at 
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:473)
                 at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
                 at 
org.mortbay.http.HttpContext.handle(HttpContext.java:1565)
                 at 
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:635)
                 at 
org.mortbay.http.HttpContext.handle(HttpContext.java:1517)
                 at 
org.mortbay.http.HttpServer.service(HttpServer.java:954)
                 at 
org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
                 at 
org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:983)
                 at 
org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
                 at 
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
                 at 
org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
                 at 
org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)


*****************************************************************
<<<Disclaimer>>>

In compliance with applicable rules and regulations, Instinet
reviews and archives incoming and outgoing email communications,
copies of which may be produced at the request of regulators.
This message is intended only for the personal and confidential
use of the recipients named above.  If the reader of this email
is not the intended recipient, you have received this email in
error and any review, dissemination, distribution or copying is
strictly prohibited. If you have received this email in error,
please notify the sender immediately by return email and
permanently delete the copy you received.  

Instinet accepts no liability for any content contained in the
email, or any errors or omissions arising as a result of email
transmission. Any opinions contained in this email constitute
the sender's best judgment at this time and are subject to change
without notice.   Instinet does not make recommendations of a
particular security and the information contained in this email
should not be considered as a recommendation, an offer or a
solicitation of an offer to buy and sell securities.

*****************************************************************