Michael & Andrus,
The DataSource Factory specified in CM is:
org.apache.cayenne.conf.DriverDataSourceFactory
> I've deployed a long-running (up 24x7) internal application before
> that had a max of 2 DB connections ...
Interesting - I saw one of you examples in which you used min = max = 1. So this is not expected behavior at all.
The catalina log reported an exception (just prior to the connection exception)
java.sql.SQLException: Lock wait timeout exceeded; (see detail in attached file)
Is it possible that I have inadvertently configured improper locking? (Note: I never explicitly set locking.)
The only theory I can think of at this point is *really* bizarre: is it possible content editing of one product is locking the entire list of products? (The ProductDetail class is a JSP that simply displays a Product. At the same time, there is content editing going on. My expectation would be that there is row-level locking and that this would not interfere with displaying a row.)
RE open connections (I thought the PoolManager might report that, if my session gets one auto-magically).
Thanks,
Joe
Apr 14, 2010 2:06:08 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet ProductDetail threw exception
java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1734)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2019)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1937)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1922)
at org.apache.cayenne.access.jdbc.BatchAction.runAsIndividualQueries(BatchAction.java:221)
at org.apache.cayenne.access.jdbc.BatchAction.performAction(BatchAction.java:91)
at org.apache.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:87)
at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:269)
at org.apache.cayenne.access.DataDomainFlushAction.runQueries(DataDomainFlushAction.java:226)
at org.apache.cayenne.access.DataDomainFlushAction.flush(DataDomainFlushAction.java:144)
at org.apache.cayenne.access.DataDomain.onSyncFlush(DataDomain.java:824)
at org.apache.cayenne.access.DataDomain$2.transform(DataDomain.java:791)
at org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:850)
at org.apache.cayenne.access.DataDomain.onSync(DataDomain.java:788)
at org.apache.cayenne.access.DataContext.flushToParent(DataContext.java:1106)
at org.apache.cayenne.access.DataContext.commitChanges(DataContext.java:1045)
at pickers.SessionLogger.log(Unknown Source)
at pickers.SessionLogger.logSystem(Unknown Source)
at pickers.StoreContext.getProdResultSet(Unknown Source)
at org.apache.jsp.store.product.ProductDetail_jsp._jspService(ProductDetail_jsp.java:458)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.cayenne.conf.WebApplicationContextFilter.doFilter(WebApplicationContextFilter.java:91)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)
Apr 14, 2010 2:07:07 PM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet VintageShop threw exception
org.apache.cayenne.CayenneException: [v.3.0RC3 Mar 29 2010 08:52:27] Error getting ResultIterator: Global Exception:
java.sql.SQLException: Can't obtain connection. Request timed out. Total used connections: 10
at org.apache.cayenne.conn.PoolManager.uncheckPooledConnection(PoolManager.java:407)
at org.apache.cayenne.conn.PoolManager.getConnection(PoolManager.java:337)
at org.apache.cayenne.conn.PoolManager.getConnection(PoolManager.java:330)
at org.apache.cayenne.access.DataNode$TransactionDataSource.getConnection(DataNode.java:364)
at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:248)
at org.apache.cayenne.access.DataDomainLegacyQueryAction.execute(DataDomainLegacyQueryAction.java:79)
at org.apache.cayenne.access.DataDomain$1.transform(DataDomain.java:720)
at org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:840)
at org.apache.cayenne.access.DataDomain.performQueries(DataDomain.java:717)
at org.apache.cayenne.access.DataContext.internalPerformIteratedQuery(DataContext.java:1215)
at org.apache.cayenne.access.DataContext.performIteratedQuery(DataContext.java:1181)
at org.apache.cayenne.access.IncrementalFaultList.fillIn(IncrementalFaultList.java:189)
at org.apache.cayenne.access.IncrementalFaultList.<init>(IncrementalFaultList.java:139)
at org.apache.cayenne.access.SimpleIdIncrementalFaultList.<init>(SimpleIdIncrementalFaultList.java:42)
at org.apache.cayenne.access.DataContextQueryAction.interceptPaginatedQuery(DataContextQueryAction.java:92)
at org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:95)
at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1278)
at org.apache.cayenne.access.DataContext.performQuery(DataContext.java:1267)
at pickers.persist.Product.fetchProduct(Unknown Source)
at org.apache.jsp.store.vintage.VintageShop_jsp._jspService(VintageShop_jsp.java:229)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:706)
at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:677)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:56)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.cayenne.conf.WebApplicationContextFilter.doFilter(WebApplicationContextFilter.java:91)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)
at org.apache.cayenne.access.util.IteratedSelectObserver.getResultIterator(IteratedSelectObserver.java:70)
at org.apache.cayenne.access.DataContext.internalPerformIteratedQuery(DataContext.java:1216)
at org.apache.cayenne.access.DataContext.performIteratedQuery(DataContext.java:1181)
at org.apache.cayenne.access.IncrementalFaultList.fillIn(IncrementalFaultList.java:189)
at org.apache.cayenne.access.IncrementalFaultList.<init>(IncrementalFaultList.java:139)
at org.apache.cayenne.access.SimpleIdIncrementalFaultList.<init>(SimpleIdIncrementalFaultList.java:42)
at org.apache.cayenne.access.DataContextQueryAction.interceptPaginatedQuery(DataContextQueryAction.java:92)
at org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:95)
at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1278)
at org.apache.cayenne.access.DataContext.performQuery(DataContext.java:1267)
at pickers.persist.Product.fetchProduct(Unknown Source)
at org.apache.jsp.store.vintage.VintageShop_jsp._jspService(VintageShop_jsp.java:229)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:706)
at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:677)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:56)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.cayenne.conf.WebApplicationContextFilter.doFilter(WebApplicationContextFilter.java:91)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)
On Apr 16, 2010, at 8:57 AM, Michael Gentry wrote:
> Hi Joe,
>
> I've deployed a long-running (up 24x7) internal application before
> that had a max of 2 DB connections using the built-in Cayenne
> connection pooling mechanism and never had any issues with running out
> of connections. The only reason I even used 2 was I had long-running
> (several minutes) queries in a background thread that might block the
> interactive portion and make the user wait during those periods, so I
> basically allocated one to the background thread and one to the user
> threads.
>
> I don't know of a way to report open connections off the top of my
> head, but I could look into that if needed.
>
> mrg
>
>
> On Thu, Apr 15, 2010 at 8:57 AM, Joe Baldwin <jfbaldwi..arthlink.net> wrote:
>> Hi Michael,
>>
>> min = 1
>> max = 10 (we changed this to 20 but then got the same error)
>>
>> To my knowledge there are no long running transactions. Most are product list fetches which should take less than a second each. There is some content editing right now, so there are about 50-100 updates per day, (which again should take no more than 1 sec per transaction)
>>
>> I have been searching through my code, but can't find anything that seems out of the ordinary.
>>
>> Is there an object available to me that will report open connections?
>>
>> Thanks,
>> Joe
>>
>>
>> On Apr 15, 2010, at 8:18 AM, Michael Gentry wrote:
>>
>>> The connections are stored and reused. What is your min/max setting?
>>> Do you have any long-running transactions?
>>>
>>>
>>> On Wed, Apr 14, 2010 at 11:34 PM, Joe Baldwin <jfbaldwi..arthlink.net> wrote:
>>>> Why would the DataContext be running out of connections in a web app with only a small amount of traffic?
>>>>
>>>> (I thought that a group of connections were stored (base on the modeler specification), and then reused for each transaction.)
>>>>
>>>> Joe
>>>>
>>>>
>>
>>
This archive was generated by hypermail 2.0.0 : Fri Apr 16 2010 - 17:58:09 EDT