Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: John Sumsion <jdsumsion@gm...> - 2006-11-10 00:02:57
Attachments:
Message as HTML
|
Steve, The nascent_pbds wasn't being properly configured. Here is a patch. Thanks again for such a great connection pool. We are using this on a very large site against Oracle RAC 10g, and the concurrency is great! Especially thanks for all the new timeout options. We were using dbcp, but the concurrency (esp. with all the options) and the fantastic paranoid rollback-on-close code has really paid off for us. Index: src/classes/com/mchange/v2/c3p0/DataSources.java =================================================================== RCS file: /usr/cvs-0.9/tools/c3p0/src/classes/com/mchange/v2/c3p0/DataSources.java,v retrieving revision 1.1.1.3 diff -u -r1.1.1.3 DataSources.java --- src/classes/com/mchange/v2/c3p0/DataSources.java 7 Nov 2006 19:15:19 -0000 1.1.1.3 +++ src/classes/com/mchange/v2/c3p0/DataSources.java 9 Nov 2006 23:39:49 -0000 @@ -268,7 +268,7 @@ nascent_pbds.setConnectionPoolDataSource( wcpds ); if (overrideProps != null) BeansUtils.overwriteAccessiblePropertiesFromMap( overrideProps, - wcpds, + nascent_pbds, false, null, true, John... P.S. For anyone using an unwrapped c3p0 pooled connection with Oracle AQ, we had to make the following change to get past an AQ Hashtable cast bug: Index: src/classes/com/mchange/v2/c3p0/impl/C3P0PooledConnection.java =================================================================== RCS file: /usr/cvs-0.9 /tools/c3p0/src/classes/com/mchange/v2/c3p0/impl/C3P0PooledConnection.java,v retrieving revision 1.1.1.3 retrieving revision 1.4 diff -u -r1.1.1.3 -r1.4 --- src/classes/com/mchange/v2/c3p0/impl/C3P0PooledConnection.java 7 Nov 2006 19:15:19 -0000 1.1.1.3 +++ src/classes/com/mchange/v2/c3p0/impl/C3P0PooledConnection.java 7 Nov 2006 20:54:39 -0000 1.4 @@ -371,11 +371,11 @@ } try - { if (supports_setTypeMap) physicalConnection.setTypeMap( Collections.EMPTY_MAP ); } + { if (supports_setTypeMap) physicalConnection.setTypeMap ( new Hashtable(20) ); } catch ( Throwable t ) { if (logger.isLoggable( MLevel.FINE )) - logger.log(MLevel.FINE, "A Throwable occurred while trying to reset the typeMap property of our Connection to Collections.EMPTY_MAP!", t); + logger.log(MLevel.FINE, "A Throwable occurred while trying to reset the typeMap property of our Connection to new Hashtable(20)!", t); } } Index: src/classes/com/mchange/v2/c3p0/impl/NewPooledConnection.java =================================================================== RCS file: /usr/cvs-0.9/tools/c3p0/src/classes/com/mchange/v2/c3p0/impl/NewPooledConnection.java,v retrieving revision 1.1.1.3 retrieving revision 1.4 diff -u -r1.1.1.3 -r1.4 --- src/classes/com/mchange/v2/c3p0/impl/NewPooledConnection.java 7 Nov 2006 19:15:19 -0000 1.1.1.3 +++ src/classes/com/mchange/v2/c3p0/impl/NewPooledConnection.java 7 Nov 2006 20:54:39 -0000 1.4 @@ -101,7 +101,7 @@ this.dflt_catalog = con.getCatalog(); this.dflt_holdability = (supports_setHoldability ? con.getHoldability() : ResultSet.CLOSE_CURSORS_AT_COMMIT); this.dflt_readOnly = (supports_setReadOnly ? carefulCheckReadOnly(con) : false); - this.dflt_typeMap = (supports_setTypeMap && (carefulCheckTypeMap(con) == null) ? null : Collections.EMPTY_MAP); + this.dflt_typeMap = (supports_setTypeMap && (carefulCheckTypeMap(con) == null) ? null : new Hashtable(20)); this.ces = new ConnectionEventSupport(this); } |
From: Steve Waldman <swaldman@mc...> - 2006-11-10 04:15:33
|
John, That's embarrassing. And very helpful! Thank you for tracking this down! The fix will be included in c3p0-0.9.1-pre11, any minute now. I plan to reorganize the code involved with sensing and resetting Connection defaults... I can try to work in a workaround to the problem you've observed with Oracle. Do you see a ClassCastException as soon as an attempt is made to set Collections.EMPTY_MAP as the type map? (But I'm not gonna mess with this 'til the 0.9.2 series... I expect c3p0-0.9.1-pre11 to be the last 0.9.1 prerelease; I'm making only small or urgent changes to 0.9.1 now. So in the meantime... use your patch! And thanks for that. Not to mention the compliments!) smiles, Steve --- Steve Waldman Machinery For Change, Inc. On Nov 9, 2006, at 7:02 PM, John Sumsion wrote: > Steve, > > The nascent_pbds wasn't being properly configured. Here is a patch. > > Thanks again for such a great connection pool. We are using this > on a very large site against Oracle RAC 10g, and the concurrency is > great! Especially thanks for all the new timeout options. We were > using dbcp, but the concurrency (esp. with all the options) and the > fantastic paranoid rollback-on-close code has really paid off for us. > > Index: src/classes/com/mchange/v2/c3p0/DataSources.java > ============================== > ===================================== > RCS file: /usr/cvs-0.9/tools/c3p0/src/classes/com/mchange/v2/c3p0/ > DataSources.java,v > retrieving revision 1.1.1.3 > diff -u -r1.1.1.3 DataSources.java > --- src/classes/com/mchange/v2/c3p0/DataSources.java 7 Nov 2006 > 19:15:19 -0000 1.1.1.3 > +++ src/classes/com/mchange/v2/c3p0/DataSources.java 9 Nov 2006 > 23:39:49 -0000 > @@ -268,7 +268,7 @@ > nascent_pbds.setConnectionPoolDataSource( wcpds ); > if (overrideProps != null) > BeansUtils.overwriteAccessiblePropertiesFromMap > ( overrideProps, > - w > cpds, > + n > ascent_pbds, > f > alse, > n > ull, > t > rue, > > John... > > P.S. For anyone using an unwrapped c3p0 pooled connection with > Oracle AQ, we had to make the following change to get past an AQ > Hashtable cast bug: > > Index: src/classes/com/mchange/v2/c3p0/impl/C3P0PooledConnection.java > =================================================================== > RCS file: /usr/cvs-0.9/tools/c3p0/src/classes/com/mchange/v2/c3p0/ > impl/C3P0PooledConnection.java,v > retrieving revision 1.1.1.3 > retrieving revision 1.4 > diff -u -r1.1.1.3 -r1.4 > --- src/classes/com/mchange/v2/c3p0/impl/ > C3P0PooledConnection.java 7 Nov 2006 19:15:19 -0000 1.1.1.3 > +++ src/classes/com/mchange/v2/c3p0/impl/ > C3P0PooledConnection.java 7 Nov 2006 20:54:39 -0000 1.4 > @@ -371,11 +371,11 @@ > } > > try > - { if (supports_setTypeMap) physicalConnection.setTypeMap > ( Collections.EMPTY_MAP ); } > + { if (supports_setTypeMap) > physicalConnection.setTypeMap ( new Hashtable(20) ); } > catch ( Throwable t ) > { > if (logger.isLoggable( MLevel.FINE )) > - logger.log(MLevel.FINE, "A Throwable occurred > while trying to reset the typeMap property of our Connection to > Collections.EMPTY_MAP!", t); > + logger.log(MLevel.FINE, "A Throwable occurred > while trying to reset the typeMap property of our Connection to new > Hashtable(20)!", t); > } > } > > Index: src/classes/com/mchange/v2/c3p0/impl/NewPooledConnection.java > =================================================================== > RCS file: /usr/cvs-0.9/tools/c3p0/src/classes/com/mchange/v2/c3p0/ > impl/NewPooledConnection.java,v > retrieving revision 1.1.1.3 > retrieving revision 1.4 > diff -u -r1.1.1.3 -r1.4 > --- src/classes/com/mchange/v2/c3p0/impl/ > NewPooledConnection.java 7 Nov 2006 19:15:19 -0000 1.1.1.3 > +++ src/classes/com/mchange/v2/c3p0/impl/ > NewPooledConnection.java 7 Nov 2006 20:54:39 -0000 1.4 > @@ -101,7 +101,7 @@ > this.dflt_catalog = con.getCatalog(); > this.dflt_holdability = > (supports_setHoldability ? con.getHoldability() : > ResultSet.CLOSE_CURSORS_AT_COMMIT); > this.dflt_readOnly = > (supports_setReadOnly ? carefulCheckReadOnly(con) : false); > - this.dflt_typeMap = > (supports_setTypeMap && (carefulCheckTypeMap(con) == null) ? null : > Collections.EMPTY_MAP); > + this.dflt_typeMap = > (supports_setTypeMap && (carefulCheckTypeMap(con) == null) ? null : > new Hashtable(20)); > this.ces = new > ConnectionEventSupport(this); > } > ---------------------------------------------------------------------- > --- > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel? > cmd=lnk&kid=120709&bid=263057&dat=121642______________________________ > _________________ > c3p0-users mailing list > c3p0-users@... > https://lists.sourceforge.net/lists/listinfo/c3p0-users |
From: John Sumsion <jdsumsion@gm...> - 2006-11-10 06:00:46
Attachments:
Message as HTML
|
Here was the sequence of events that led to the Oracle AQ problem: 1) establish a c3p0 connection pool 2) check out a connection 3) unwrap it to get to a raw Oracle connection 4) pass the raw Oracle connection to some Oracle AQ APIs 5) clean up after the AQ APIs by calling AQSession.close() 6) close the c3p0 pooled connection, returning it to the pool 6a) c3p0 resets the raw Oracle connections type map to be Collections.EMPTY_MAP as part of cleaning up the raw Oracle connection (this is sucessful at this point) 7) check out a connection to start a subsequent transaction 8) unwrap it to get a raw Oracle connection (same connection as in step 3) 9) pass the raw Oracle connection to some Oracle AQ APIs 10) bang! SQLException I found that the SQLException was caused because code way down in the AQ driver was casting the type map to be Hashtable and turning the ClassCastException into a SQLException. This is a bug in AQ, if you ask me, but it's an old 8i AQ API and I didn't want to hassle with getting an updated driver from Oracle, so I just patched c3p0 to reset the type map to be a Hashtable instead of EMPTY_MAP. I'm not sure if you even want to fix this, I just wanted you to be aware of it and if an easy fix popped up, then great. I also wanted anyone else using c3p0 and AQ together to be aware of the problem and a workaround. John... On 11/9/06, Steve Waldman <swaldman@...> wrote: <snip> I plan to reorganize the code involved with sensing and resetting > Connection defaults... I can try to work in a workaround to the > problem you've observed with Oracle. Do you see a ClassCastException > as soon as an attempt is made to set Collections.EMPTY_MAP as the > type map? > > (But I'm not gonna mess with this 'til the 0.9.2 series... I expect > c3p0-0.9.1-pre11 to be the last 0.9.1 prerelease; I'm making only > small or urgent changes to 0.9.1 now. So in the meantime... use your > patch! And thanks for that. Not to mention the compliments!) <snip> On Nov 9, 2006, at 7:02 PM, John Sumsion wrote: > > > P.S. For anyone using an unwrapped c3p0 pooled connection with > > Oracle AQ, we had to make the following change to get past an AQ > > Hashtable cast bug: > <snip> - see original email for the patch. |