I can reproduce the problem locally and it's definitely a 
data-source/connection pool problem than an iBATIS problem.   If I start my 
application and then kill all the db sessions in the pool, the JDBCTransaction 
class fails with an "ORA-17410: Io exception: Connection reset by peer: socket 
write error" when it issues the connection close() statement for the connection 
obtained from the pool.  After failing to close all the connections in the 
pool, it starts throwing another error: "java.sql.SQLException: Timed out 
waiting for an available connection after 60 seconds (connection pool reached 
max-connections which was set to 5)"  Since it's an older A/S, there's not much 
I can do with how it handles the pool, other than replace the datasource with 
something that might handle the connections more effectively when the 
database/listener drops them.

Any suggestions?

Do people use the iBATIS SimpleDataSource in production?

Thanks,
Eric
-----Original Message-----
From: Richard Yee [mailto:r...@cruzio.com]
Sent: Saturday, October 03, 2009 1:17 PM
To: user-java@ibatis.apache.org
Subject: Re: Connections and Transactions with JNDI DataSource - possible leak?

Send your row handler.

Sent from my iPhone

On Oct 2, 2009, at 8:13 AM, "Givler, Eric" 
<egiv...@state.pa.us<mailto:egiv...@state.pa.us>> wrote:

I have an OC4J container and am experiencing a connection leak log in my server 
logs:

09/09/29 17:46:10 OrionCMTConnection not closed, check your code!
09/09/29 17:46:10 Logical connection not closed, check your code!
09/09/29 17:46:10 (Use -Djdbc.connection.debug=true to find out where the 
leaked connection was created)

I don't want to point fingers, but when I turn on -Dtransaction.debug trace, it 
will show the stack trace of what caused the leak:

09/10/01 13:04:35 Thr[thread 5]-OrionCMTConnection.isClosed(): 
end---this.closed = false
09/10/01 13:04:35 Thr[thread 5]-OrionCMTConnection.isClosed(): end
09/10/01 13:04:35 Thr[thread 5]-OrionCMTConnection.finalize(): begin---this:: 
com.evermind.sql.orioncmtconnectionfinal...@2dbcf0  is NOT Closed
09/10/01 13:04:35 OrionCMTConnection not closed, check your code!
09/10/01 13:04:35 Logical connection not closed, check your code!
09/10/01 13:04:35 Created at:
09/10/01 13:04:35 java.lang.Throwable: OrionCMTConnection created
09/10/01 13:04:35       at 
com.evermind.sql.OrionCMTConnection.<init>(OrionCMTConnection.java:121)
09/10/01 13:04:35       at 
com.evermind.sql.OrionCMTConnectionFinalize.<init>(OrionCMTConnectionFinalize.java:42)
09/10/01 13:04:35       at 
com.evermind.util.ClassOptimizerFactory.getOrionCMTConnection(ClassOptimizerFactory.java:80)
09/10/01 13:04:35       at 
com.evermind.sql.OrionCMTDataSource.getConnection(OrionCMTDataSource.java:237)
09/10/01 13:04:35       at 
com.evermind.sql.OrionCMTDataSource.getConnection(OrionCMTDataSource.java:217)
09/10/01 13:04:35       at 
com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.init(JdbcTransaction.java:48)
09/10/01 13:04:35       at 
com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:89)
09/10/01 13:04:35       at 
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithRowHandler(GeneralStatement.java:133)
09/10/01 13:04:35       at 
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryWithRowHandler(SqlMapExecutorDelegate.java:649)
09/10/01 13:04:35       at 
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryWithRowHandler(SqlMapSessionImpl.java:156)
09/10/01 13:04:35       at 
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryWithRowHandler(SqlMapClientImpl.java:133)
09/10/01 13:04:35       at 
model.persistence.dao.ApplicationDaoImpl.getUnderminedDetails(ApplicationDaoImpl.java:335)
09/10/01 13:04:35       at 
view.LOVCreator.contextInitialized(LOVCreator.java:52)
09/10/01 13:04:35       at 
com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1009)
09/10/01 13:04:35       at 
com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:549)
09/10/01 13:04:35       at 
com.evermind.server.Application.getHttpApplication(Application.java:890)
09/10/01 13:04:35       at 
com.evermind.server.http.HttpServer.getHttpApplication(HttpServer.java:707)
09/10/01 13:04:35       at 
com.evermind.server.http.HttpSite.initApplications(HttpSite.java:625)
09/10/01 13:04:35       at 
com.evermind.server.http.HttpSite.setConfig(HttpSite.java:278)
09/10/01 13:04:35       at 
com.evermind.server.http.HttpServer.setSites(HttpServer.java:278)
09/10/01 13:04:35       at 
com.evermind.server.http.HttpServer.setConfig(HttpServer.java:179)
09/10/01 13:04:35       at 
com.evermind.server.ApplicationServer.initializeHttp(ApplicationServer.java:2394)
09/10/01 13:04:35       at 
com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:1551)
09/10/01 13:04:35       at 
com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:92)
09/10/01 13:04:35       at java.lang.Thread.run(Thread.java:619)
09/10/01 13:04:35 Thr[thread 5]-OrionCMTConnection.close(): begin---this = 
com.evermind.sql.orioncmtconnectionfinal...@2dbcf0
09/10/01 13:04:35 Thr[thread 5]-OrionCMTConnection.close(): begin
09/10/01 13:04:35 Thr[thread 5]-OrionCMTConnection.close(): begin---this.closed 
= false
09/10/01 13:04:35 Thr[thread 5]-OrionCMTConnection.close(): end---Already 
closed:: com.evermind.sql.orioncmtconnectionfinal...@2dbcf0
09/10/01 13:04:35 Thr[thread 5]-OrionCMTConnection.finalize(): end


getUnderminedDetails is using a RowHandler if that makes any difference.

This is with IBATIS 2.3.0.677 (the latest one we can use against our current 
Java 1.4.2 Oracle 10G 10.1.2 Application Server).  The database is an Oracle 
10gR2 instance as well.

Any help would be appreciated.  I tried stepping the code, and I'm just not 
clear as to what's going on regarding the JdbcTransaction and how the 
connections are being started/ended automatically.

The SQLMapConfig.xml's tx entry looks like this:

    <transactionManager type="JDBC">
        <dataSource type="JNDI">
            <property name="DataSource" value="java:comp/env/jdbc/MyUserDS" />
        </dataSource>
    </transactionManager>

Thanks,

Eric

Eric Givler
Application Developer
Department of Environmental Protection/BIT
400 Market Street/3rd Floor
PO Box 8761
Harrisburg, PA 17105-8761
PH (717) 772-0138, FAX (717) 772-1676
egiv...@state.pa.us<mailto:egiv...@state.pa.us>



Reply via email to