Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to checkout connection, stack blown due to internal ClassCastException #7

Closed
konrad-garus opened this issue May 13, 2013 · 4 comments

Comments

@konrad-garus
Copy link

After upgrade from 0.9.1.2 to 0.9.2.1, the pool is unable to check out connections. It fails each time in the loop in BaseResourcePool due to unexpected ClassCastException in attemptRefurbishResourceOnCheckout, eventually blowing the stack.

Stack trace:

Exception in thread "main" java.lang.StackOverflowError
    at java.lang.Exception.<init>(Exception.java:41)
    at java.lang.RuntimeException.<init>(RuntimeException.java:43)
    at java.lang.ClassCastException.<init>(ClassCastException.java:39)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$C3P0PooledConnectionNestedLockLockFetcher.getInUseLock(C3P0PooledConnectionPool.java:127)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.refurbishResourceOnCheckout(C3P0PooledConnectionPool.java:298)
    at com.mchange.v2.resourcepool.BasicResourcePool.attemptRefurbishResourceOnCheckout(BasicResourcePool.java:1682)
    at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:528)
    at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:563)
    at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:563)
    at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:563)
    at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:563)
// ... and so on

The root cause seems to be:

013-05-13 06:18:12 [main] DEBUG: A resource could not be refurbished for checkout. [com.mchange.v2.c3p0.impl.C3P0PooledConnection@5a296cad]
java.lang.ClassCastException: com.mchange.v2.c3p0.impl.C3P0PooledConnection cannot be cast to com.mchange.v2.c3p0.impl.NewPooledConnection
@konrad-garus
Copy link
Author

It only happens with usesTraditionalReflectiveProxies=true.

@swaldman
Copy link
Owner

hi,

thanks for reporting the issue. usesTraditionalReflectiveProxies is now deprecated; i don't promise to maintain the reflective proxies. nevertheless, i've fixed this issue (in github source and the current snapshot of c3p0-0.9.5-pre3.

thanks again!

@konrad-garus
Copy link
Author

Thank you!

Is 0.9.5-preX stable and production ready? Or should it be considered alpha/experimental?

@swaldman
Copy link
Owner

I think that it is pretty solid, and would selfishly love for you to use it and report any issues.

That said, the series has not stabilized and should still be considered a bit experimental. Your safest bet is to use 0.9.2.1 with usesTraditionalReflectiveProxies=false, unless you wish to use JDBC4 features (or if you want to configure in typesafe-config/hocon format or if you want c3p0 to log through the slf4j interface).

@ewsq ewsq mentioned this issue Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants