I am fairly certain that 1.1.3 Cayenne connection pool doesn't leak
by itself, as this would've been a common problem for everybody. So
try to determine whether the leak can occur somewhere in your
application. A few things to check:
(1) do you have queries that run longer than 0-10 seconds? (you can
check the logs - Cayenne prints JDBC timing)
(2) do you use Cayenne ResultIterator, if so do you close it properly?
(3) Also it might help to take a thread dump of the application when
the error starts to happen to see if there are deadlocks:
http://java.sun.com/developer/technicalArticles/Programming/Stacktrace/
(do "kill -QUIT <pid>" on UNIX or "Ctrl+Break" on Windows)
Hope this helps.
Andrus
On Nov 28, 2005, at 7:47 PM, Claudio Rosati wrote:
> Hello all,
>
> I'm using Cayenne 1.1.3 with PostgreSQL 8.1 on Windows XP & Linux.
> The following code, called in a context where the DataContext
> __datactx is already set up and possibly some commit were already
> called, seems consume a JDBC connection when __datactx.performQuery
> (query); is called without releasing it.
>
> private Collocation getCollocation ( String pressmark )
> {
> Collocation collocation = null;
> Expression exp = ExpressionFactory.matchExp("pressmark", pressmark);
> SelectQuery query = new SelectQuery(Collocation.class, exp);
> List queriedList = __datactx.performQuery(query);
> if ( queriedList.size() > 0 )
> collocation = (Collocation) queriedList.get(0);
> return collocation;
> }
> Clearly after a while (a very short while) the following errors occurs
>
> CADMUS Ver 1.3.0
> EXCEPTION: Unexpected exception
> org.objectstyle.cayenne.CayenneRuntimeException.
> Location is:
> org.objectstyle.cayenne.access.util.SelectObserver.nextGlobalException
> , line 222.
> Message is: [v.1.1.3 September 28 2005] Global exception.
> Stack trace: org.objectstyle.cayenne.CayenneRuntimeException: [v.
> 1.1.3 September 28 2005] Global exception.
> at
> org.objectstyle.cayenne.access.util.SelectObserver.nextGlobalException
> (SelectObserver.java:222)
> at org.objectstyle.cayenne.access.DataNode.performQueries
> (DataNode.java:325)
> at org.objectstyle.cayenne.access.DataDomain.performQueries
> (DataDomain.java:654)
> at org.objectstyle.cayenne.access.DataContext.performQueries
> (DataContext.java:1408)
> at org.objectstyle.cayenne.access.Transaction.performQueries
> (Transaction.java:179)
> at org.objectstyle.cayenne.access.DataContext.performQueries
> (DataContext.java:1366)
> at org.objectstyle.cayenne.access.DataContext.performQuery
> (DataContext.java:1622)
> at org.objectstyle.cayenne.access.DataContext.performQuery
> (DataContext.java:1485)
> at
> it.acsys.multimedia.products.cadmus.plugin.sbn.CollocationImporter.get
> Collocation(CollocationImporter.java:222)
> at
> it.acsys.multimedia.products.cadmus.plugin.sbn.CollocationImporter.imp
> ortCollocations(CollocationImporter.java:101)
> at
> it.acsys.multimedia.products.cadmus.plugin.sbn.RecordImporter.getCollo
> cations(RecordImporter.java:798)
> at
> it.acsys.multimedia.products.cadmus.plugin.sbn.RecordImporter.importRe
> cord(RecordImporter.java:412)
> at
> it.acsys.multimedia.products.cadmus.plugin.sbn.RecordImporter.getRecor
> d(RecordImporter.java:336)
> at
> it.acsys.multimedia.products.cadmus.plugin.sbn.RecordImporter.importRe
> cords(RecordImporter.java:168)
> at
> it.acsys.multimedia.products.cadmus.plugin.sbn.SBNImporter.importRecor
> ds(SBNImporter.java:305)
> at
> it.acsys.multimedia.products.cadmus.plugin.sbn.wizard.Progress.importR
> ecords(Progress.java:208)
> at
> it.acsys.multimedia.products.cadmus.plugin.sbn.wizard.Progress.run
> (Progress.java:228)
> at it.acsys.swing.wizard.DefaultProgressPage$2.run
> (DefaultProgressPage.java:1181)
> at java.lang.Thread.run(Thread.java:595)
> Caused by: java.sql.SQLException: Can't obtain connection. Request
> timed out. Total used connections: 20
> at
> org.objectstyle.cayenne.conn.PoolManager.uncheckPooledConnection
> (PoolManager.java:466)
> at org.objectstyle.cayenne.conn.PoolManager.getConnection
> (PoolManager.java:392)
> at org.objectstyle.cayenne.conn.PoolManager.getConnection
> (PoolManager.java:385)
> at org.objectstyle.cayenne.access.DataNode.performQueries
> (DataNode.java:313)
> ... 17 more
>
> I've tried to give more connection but the problems always occurs
> (in a longer time).
>
> I don't understand is I've missed something in the code or
> somewhere in the initialization.
>
> Anyone has some suggestions?
>
> Thanks
>
> Claudio
>
>
>
>
>
>
> <642113416>
> Multimedia Division
> Claudio Rosati
> Project ManagerAdvanced Computer Systems S.p.A.
> via Della Bufalotta 378
> 00139 Roma, RM
> Italy
> claudio.rosat..csys.it
> tel:
> fax:+39 06 8709 0516
> +39 06 8720 1502
> Add me to your address book...Want a signature like this?
>
>
This archive was generated by hypermail 2.0.0 : Mon Nov 28 2005 - 15:50:08 EST