[CONJ-1] Timeout exceptions when using Apache DBCP properties Created: 2012-12-07 Updated: 2013-01-04 Resolved: 2012-12-16 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Rasmus Johansson (Inactive) | Assignee: | Vladislav Vaintroub |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
When using validation-query and validation-query-timeout for them ("SELECT 1" and a timeout of 3), timeout exceptions occur in all queries. If the validation-query-timeout parameter (and only that one) is removed, everything works as expected. These are Apache DBCP properties. |
| Comments |
| Comment by Rasmus Johansson (Inactive) [ 2012-12-07 ] | ||||||||||||||||||||||||||||||||||
|
Reaching out to user that experienced this to get more information. | ||||||||||||||||||||||||||||||||||
| Comment by Vladislav Vaintroub [ 2012-12-09 ] | ||||||||||||||||||||||||||||||||||
|
I tried a lot of things (without DBCP, since I do not have any knowlegde about it), and could not see any difference in how setQueryTimeout/getQuerytimeout behave between ConnectorJ and MariaDB JDBC. I guess we need a runnable self-contained repro, be it DBCP or anything else. | ||||||||||||||||||||||||||||||||||
| Comment by Vladislav Vaintroub [ 2012-12-16 ] | ||||||||||||||||||||||||||||||||||
|
I think I fixed it now. I did not try DBCP, but playing around with timeouts revealed JVM bug in socket timeouts that were used for query timeout. So this got reimplemented again with java.util.Timer. | ||||||||||||||||||||||||||||||||||
| Comment by George El Boustani [ 2013-01-04 ] | ||||||||||||||||||||||||||||||||||
|
This fix solved the timeout exceptions, however it creates a resource leak as the Timer is not being cancelled and nulled. See attached patch | ||||||||||||||||||||||||||||||||||
| Comment by George El Boustani [ 2013-01-04 ] | ||||||||||||||||||||||||||||||||||
|
Patch:
| ||||||||||||||||||||||||||||||||||
| Comment by George El Boustani [ 2013-01-04 ] | ||||||||||||||||||||||||||||||||||
|
Before the patch over 3000 threads were running, and after it was down to 80 | ||||||||||||||||||||||||||||||||||
| Comment by Vladislav Vaintroub [ 2013-01-04 ] | ||||||||||||||||||||||||||||||||||
|
thanks. Would it be possible for you to paste a test case for "3000 threads are running"? | ||||||||||||||||||||||||||||||||||
| Comment by Vladislav Vaintroub [ 2013-01-04 ] | ||||||||||||||||||||||||||||||||||
|
After reading docs for java.util.Timer - yes, you're right that there are excessive threads when using multiple timers. So ,the way to fix is it, is to use single (per-JVM) timer with multiple timerTasks , which I done in this patch : |