I am using DBCP and found that similar error happens if one of my thread crashes and does not return the connection to the pool. I beleive that the connection is closed, but it is not removed from the pool for some reason. Once I fix the thread crash issue, it seems to go away. But I was able to reproduce the problem for certain.
The way I found is, I had debug in my object shutdowns and printed the thread which is executing the shutdown, I found that whenever Finalizer thread was executing through the shutdown ( which happens during crash ) I got this error on the next database access. Hope this helps. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2003 12:58 To: [EMAIL PROTECTED] Subject: RE: [DBCP] Exceptions in multi user environment. It seems to be some kind of a threading issue. We are keeping the DP Pool in the application context. Could this be causing a problem? If I access a URL in our application simultaneously from two different browsers at the same time, I can reproduce this error atleast once in 25 attempts. We plan to do load test through Loadrunner to get more statistics on this. I have gone through the application code to ensure that our code is thread safe..and it seems to be. I have synchronized DriverManager.getConnection("jdbc:apache:commons:dbcp:PHOENIX"); in our wrapper class. Do i need to synchronize the process of returning connections to the pool too...if yes, then where exactly should i put the synchronize block? I'm planning to print out the Connection reference information and a timestamp everytime we fetch a connection and close a connection. Then hopefully by going through the log, I should come up with something. -----Original Message----- From: Rodney Waldhoff [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2003 9:39 AM To: Jakarta Commons Users List Subject: RE: [DBCP] Exceptions in multi user environment. If we take this message ("Closed Statement") at face value, then one of three things has happened: 1) The database has closed a connection/statement out from under DBCP and the client code. 2) DBCP has closed a connection/statement. 3) The client code has closed (really closed, not just returned to the pool), a connection/statement. I don't see how #3 is possible unless the client code is unwrapping the Connection/Statement returne by DBCP. #2 is meant to happen in some circumstances, but only in circumstances that should prevent the end user from obtaining that connection/statement again. Some circumstances that may cause the pool to close a connection the client is using include (a) returning the same connection to the pool more than once (making the pool think they are two different connections, (b) hanging on to a connection after having returned it to the pool. It's possible that something related to "abandonded object" tracking could cause this also, but frankly I don't know anything about that. It's also possible that some bug in pool/dbcp could lead to this as well, of course. #3 might happen if the database was bounced, or if it drops a connection/statement due to inactivity or longevity. Configuring a "test while idle"/"keep alive" query should generally prevent that, as would "test on borrow", at some expense. On Fri, 28 Feb 2003, Linda Steckel wrote: > I get the same error but I've checked exhaustively and cannot find either of > these cases. Plus, this error occurs on the same code running numerous > times - sometimes in 10 minutes, sometimes in a day, sometimes in 2 days. > > -----Original Message----- > From: Rodney Waldhoff [mailto:[EMAIL PROTECTED] > Sent: Friday, February 28, 2003 5:43 AM > To: Jakarta Commons Users List > Subject: Re: [DBCP] Exceptions in multi user environment. > > > Is it possible that you're either returning a connection to the pool more > than once, or holding on to a connection after having returned it to the > pool? > > On Thu, 27 Feb 2003 [EMAIL PROTECTED] wrote: > > > Hi, > > I'm new to DBCP. Recently we have used DBCP in one of our projects. > > When around 5-6 users start accessing our application we start getting > some > > strange errors in an unpredictable manner. The trace from a few is > included > > below. Does any one have any suggestions to fix these? > > > > Thanks. > > > > 1) > > , root cause: java.sql.SQLException: Closed Statement > > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169) > > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:211) > > at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:274) > > at > > > oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:453 > > 0) > > at > > > oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:6 > > 66) > > at > > oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:1420) > > at > > > org.apache.commons.dbcp.DelegatingResultSet.getInt(DelegatingResultSet.java: > > 159) > > > > 2) > > , root cause: java.sql.SQLException: Connection is closed. > > at > > > org.apache.commons.dbcp.DelegatingConnection.checkOpen(DelegatingConnection. > > java:245) > > at > > > org.apache.commons.dbcp.DelegatingConnection.createStatement(DelegatingConne > > ction.java:170) > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
