Re: ConnectionPool JDBC vs. DBCP
Andreas, On 2/16/24 02:21, Döscher, Andreas (ESI) wrote: Moin, in the docpage https://tomcat.apache.org/tomcat-10.1-doc/jdbc-pool.html it says The JDBC Connection Pool org.apache.tomcat.jdbc.pool is a replacement or an alternative to the Apache Commons DBCP connection pool. So why do we need a new connection pool? Here are a few of the reasons: Commons DBCP 1.x is single threaded. In order to be thread safe Commons locks the entire pool for short periods during both object allocation and object return. Note that this does not apply to Commons DBCP 2.x. [...snip...] I thought that Tomcat uses DBCP 2.x per default, is this document still relevant or is it outdated? Recent versions of Tomcat do indeed use DBCP2. You are reading the documentation for the pool itself, which is justifying the reason it was developed in the first place, back when Tomcat shipped with DBCP1. DBCP2 was created for many of the same reasons tomcat-pool was created, just on different schedules. This document could be updated to make it clear that the comparison of tomcat-pool against DBCP1 is a historical comparison, and that Tomcat now uses DBCP2 by default which does not suffer from the same problems tomcat-pool was designed to address. There are some significant architectural and feature differences between DBCP2 and tomcat-pool which is why we haven't shut the sub-project down. -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
ConnectionPool JDBC vs. DBCP
Moin, in the docpage https://tomcat.apache.org/tomcat-10.1-doc/jdbc-pool.html it says >The JDBC Connection Pool org.apache.tomcat.jdbc.pool is a replacement or an >alternative to the Apache Commons DBCP connection pool. > >So why do we need a new connection pool? > >Here are a few of the reasons: > >Commons DBCP 1.x is single threaded. In order to be thread safe Commons > locks the entire pool for short periods during both object allocation and > object return. Note that this does not apply to Commons DBCP 2.x. [...snip...] I thought that Tomcat uses DBCP 2.x per default, is this document still relevant or is it outdated? Thanks, Andreas This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, notify the sender immediately by return email and delete the message and any attachments from your system. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Unable to find [jdbc].
Found it. Details if anybody wants to dig into it The 30 second intervals should have given me a clue. We are running multiple server instances in a cluster that have a health check for each server instance. A pre-defined URL is called on each server instance every 30 seconds. But since it needs to target specific instances, it can't simply use the host name. It has to send the request using the IP address instead. This means Tomcat default host will handle it. The Catalina context file for default host is used instead of the normal host name context file, and the default host file didn't have all of the required dataSource names used by the test URL. The real problem was that this slipped by for a while and wasn't failing the health check as it should have. I just accidentally saw all the errors in the logs while looking for something else. Anyway, problem solved. (At least THIS one was solved :-) ) Jerry On 6/27/2023 3:41 PM, Jerry Malcolm wrote: All of a sudden I started getting a NameNotFoundException when I'm trying to resolve a dataSource name. But it comes and goes on all of my dataSource names. The log below was from about a minute. The only thing I could find in a google search for "Unable to find [jdbc]" says my configuration is wrong and proceeds to explain how to set up a datasource. My datasources have been set up for several years, correctly as far as I know. They were all working fine until a couple of days ago. And now they fail for 30 seconds, work for 30 seconds, and fail again for 30 seconds. This is a pretty critical problem. I've spent several hours trying to figure out what could be causing it. It's failing on: ds = (DataSource)envContext.lookup( dataSourceName ); The datasource is defined in a context file in Catalina folder: type="javax.sql.DataSource" /> And the global resource is defined in /conf/server.xml. Tomcat 9.0.53 running on Java 11, AWS Linux2, connecting to an AWS MySQL RDS. I haven't been playing with dataSources in months. I'm at a loss. Not a fan of random problems that just appear Any help you can offer to assist me in figuring this out and getting it resolved will be greatly appreciated. Jerry ---javax.naming.NameNotFoundException: Name [jdbc/idmanager2] is not bound in this Context. Unable to find [jdbc]. ---javax.naming.NameNotFoundException: Name [jdbc/idmanager2] is not bound in this Context. Unable to find [jdbc]. ---javax.naming.NameNotFoundException: Name [jdbc/idmanager2] is not bound in this Context. Unable to find [jdbc]. 2023-06-27 20:17:02.924637 Successful - DBData.getConnection( jdbc/idmanager2 ) 2023-06-27 20:17:02.925252 Successful - DBData.getConnection( jdbc/idmanager2 ) 2023-06-27 20:17:03.911673 Successful - DBData.getConnection( jdbc/idmanager2 ) 2023-06-27 20:17:03.981999 Successful - DBData.getConnection( jdbc/idmanager2 ) 2023-06-27 20:17:04.001715 Successful - DBData.getConnection( jdbc/idmanager2 ) 2023-06-27 20:17:04.80616 Successful - DBData.getConnection( jdbc/idmanager2 ) ---javax.naming.NameNotFoundException: Name [jdbc/idmanager2] is not bound in this Context. Unable to find [jdbc]. ---javax.naming.NameNotFoundException: Name [jdbc/idmanager2] is not bound in this Context. Unable to find [jdbc]. ---javax.naming.NameNotFoundException: Name [jdbc/idmanager2] is not bound in this Context. Unable to find [jdbc]. ---javax.naming.NameNotFoundException: Name [jdbc/idmanager2] is not bound in this Context. Unable to find [jdbc]. ---javax.naming.NameNotFoundException: Name [jdbc/idmanager2] is not bound in this Context. Unable to find [jdbc]. ---javax.naming.NameNotFoundException: Name [jdbc/idmanager2] is not bound in this Context. Unable to find [jdbc]. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Unable to find [jdbc].
All of a sudden I started getting a NameNotFoundException when I'm trying to resolve a dataSource name. But it comes and goes on all of my dataSource names. The log below was from about a minute. The only thing I could find in a google search for "Unable to find [jdbc]" says my configuration is wrong and proceeds to explain how to set up a datasource. My datasources have been set up for several years, correctly as far as I know. They were all working fine until a couple of days ago. And now they fail for 30 seconds, work for 30 seconds, and fail again for 30 seconds. This is a pretty critical problem. I've spent several hours trying to figure out what could be causing it. It's failing on: ds = (DataSource)envContext.lookup( dataSourceName ); The datasource is defined in a context file in Catalina folder: type="javax.sql.DataSource" /> And the global resource is defined in /conf/server.xml. Tomcat 9.0.53 running on Java 11, AWS Linux2, connecting to an AWS MySQL RDS. I haven't been playing with dataSources in months. I'm at a loss. Not a fan of random problems that just appear Any help you can offer to assist me in figuring this out and getting it resolved will be greatly appreciated. Jerry ---javax.naming.NameNotFoundException: Name [jdbc/idmanager2] is not bound in this Context. Unable to find [jdbc]. ---javax.naming.NameNotFoundException: Name [jdbc/idmanager2] is not bound in this Context. Unable to find [jdbc]. ---javax.naming.NameNotFoundException: Name [jdbc/idmanager2] is not bound in this Context. Unable to find [jdbc]. 2023-06-27 20:17:02.924637 Successful - DBData.getConnection( jdbc/idmanager2 ) 2023-06-27 20:17:02.925252 Successful - DBData.getConnection( jdbc/idmanager2 ) 2023-06-27 20:17:03.911673 Successful - DBData.getConnection( jdbc/idmanager2 ) 2023-06-27 20:17:03.981999 Successful - DBData.getConnection( jdbc/idmanager2 ) 2023-06-27 20:17:04.001715 Successful - DBData.getConnection( jdbc/idmanager2 ) 2023-06-27 20:17:04.80616 Successful - DBData.getConnection( jdbc/idmanager2 ) ---javax.naming.NameNotFoundException: Name [jdbc/idmanager2] is not bound in this Context. Unable to find [jdbc]. ---javax.naming.NameNotFoundException: Name [jdbc/idmanager2] is not bound in this Context. Unable to find [jdbc]. ---javax.naming.NameNotFoundException: Name [jdbc/idmanager2] is not bound in this Context. Unable to find [jdbc]. ---javax.naming.NameNotFoundException: Name [jdbc/idmanager2] is not bound in this Context. Unable to find [jdbc]. ---javax.naming.NameNotFoundException: Name [jdbc/idmanager2] is not bound in this Context. Unable to find [jdbc]. ---javax.naming.NameNotFoundException: Name [jdbc/idmanager2] is not bound in this Context. Unable to find [jdbc]. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat / Oracle JDBC OracleTimeoutPollingThread memory leak?
On 13/02/2023 19:12, Ragosta, Vincent wrote: Is the above GC root, an example of the above condition? Yes. If so, can this be mitigated using the JreMemoryLeakPreventionListener, as illustrated in the Tomcat documentation, here -- https://tomcat.apache.org/tomcat-9.0-doc/config/listeners.html#JreMemoryLeakPreventionListener_Examples? Yes. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Tomcat / Oracle JDBC OracleTimeoutPollingThread memory leak?
Our Tomcat instance is configured to create a heap dump on out of memory conditions, and we often see a large amount of memory allocated to OracleTimeoutPollingThread. For example, here is once such instance: 465,922Kb (57.4%) Object tree for GC root(s) Java Static oracle.jdbc.driver.OracleTimeoutThreadPerVM.watchdog Leak candidate(s) found Root object oracle.jdbc.driver.OracleTimeoutPollingThread@c492d2c0oracle<https://forums.oracle.com/ords/apexds/user/c492d2c0oracle>.jdbc.driver.OracleTimeoutPollingThread(name : "OracleTimeoutPollingThread", priority : 10, threadQ : null, eetop : 392972288, single_step : false, daemon : true, stillborn : false, target : null, group : j.l.ThreadGroup@c02fa828<mailto:j.l.ThreadGroup@c02fa828>, contextClassLoader : org.apache.catalina.loader.ParallelWebappClassLoader@c02fb4c8<https://forums.oracle.com/ords/apexds/user/c02fb4c8>, inheritedAccessControlContext : java.security.AccessControlContext@c492d448<mailto:java.security.AccessControlContext@c492d448>, threadLocals : null, inheritableThreadLocals : j.l.ThreadLocal$ThreadLocalMap(size: 2), stackSize : 0, nativeParkEventPointer : 0, tid : 119, threadStatus : 225, parkBlocker : null, blocker : null, blockerLock : Object@c492d660, uncaughtExceptionHandler : null, threadLocalRandomSeed : 0, threadLocalRandomProbe : 0, threadLocalRandomSecondarySeed : 0, knownTimeouts : oracle.jdbc.driver.OracleTimeoutThreadPerVM[](size: 32), count : 20, sleepMillis : 1000) 1. oracle.jdbc.driver.OracleTimeoutPollingThread ↘465,922Kb (57.4%), self 136b (< 0.1%), 1 object(s) I came across the following note: Oracle JDBC driver, at least in some versions (such as ojdbc6), have a timeout detection thread, _oracle.jdbc.driver.OracleTimeoutPollingThread_, that according to reports has as its context classloader the classloader of the web application from which the first JDBC connection is requested, even if the driver itself resides on the server level. It seem this can be prevented by loading the class _oracle.jdbc.driver.OracleTimeoutThreadPerVM_ using the system classloader before any JDBC connections are opened, which can be achieved in _contextInitialized()_ of our _ServletContextListener_<https://java.jiderhamn.se/2012/01/01/classloader-leaks-ii-find-and-work-around-unwanted-references/#cleanup>. (Thanks to Hal Deadman for the report!) Ref: https://java.jiderhamn.se/category/classloader-leaks/ Is the above GC root, an example of the above condition? We are using the following: Oracle JDBC driver version 18.3.0.0.0 Tomcat 9.0.60. If so, can this be mitigated using the JreMemoryLeakPreventionListener, as illustrated in the Tomcat documentation, here -- https://tomcat.apache.org/tomcat-9.0-doc/config/listeners.html#JreMemoryLeakPreventionListener_Examples? Thank you, Vincent
Re: Tomcat JDBC CP: Exponential backoff?
Thomas, On 1/26/23 03:00, Thomas Meyer wrote: Am 18. Januar 2023 23:20:29 MEZ schrieb Christopher Schultz : Thomas, On 1/17/23 13:33, Thomas Meyer wrote: Does Tomcat's CP support exponential backoff in case DB is unavailable for some reason? I didn't find anything in the documentation in this regards. I don't think is supports any such thing. What would be the purpose of exponential back-off... don't you want to connect ASAP? Hi, Not really sure, but I think the idea is to protect the database from getting overloaded with requests once it's coming up again. Sadly the description given in https://cloud.google.com/sql/docs/postgres/manage-connections#backoff Is very vague and I think won't really help much to mitigate above problem, if any. I found this interesting article and test class that tries to demonstrate the resp. behavior of the situation: https://github.com/brettwooldridge/HikariCP/wiki/Bad-Behavior:-Handling-Database-Down https://github.com/brettwooldridge/HikariCP-benchmark/blob/master/src/test/java/com/zaxxer/hikari/benchmark/DbDownTest.java There seems also to be an reply to above benchmark from the vibur dbcp author, which has some interesting points: https://github.com/brettwooldridge/HikariCP/issues/230 While investigating the reason of why exponential backoff would make sense I also did stumble across this article: https://aws.amazon.com/de/blogs/architecture/exponential-backoff-and-jitter/ This article make much more sense in my head, I.e. use exponential backoff with jitter to protect the restarting database from getting "flooded". But HikariCP does only support plain exponential backoff and probably won't help much in above described situation, because once the database is starting to accept connections again, all HikariCP connections will probably align at the same time to start creating connections again. If you are worried abou tyour database being flooded with requests, you should limit the number of connections your database will accept /at the database/. If you have 10 applications connecting to the db each with their own connection pools, even exponential backoff won't help avoid all of them (separately!) flooding the database. -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat JDBC CP: Exponential backoff?
Am 18. Januar 2023 23:20:29 MEZ schrieb Christopher Schultz : >Thomas, > >On 1/17/23 13:33, Thomas Meyer wrote: >> Does Tomcat's CP support exponential backoff in case DB is unavailable for >> some reason? >> I didn't find anything in the documentation in this regards. > >I don't think is supports any such thing. What would be the purpose of >exponential back-off... don't you want to connect ASAP? Hi, Not really sure, but I think the idea is to protect the database from getting overloaded with requests once it's coming up again. Sadly the description given in https://cloud.google.com/sql/docs/postgres/manage-connections#backoff Is very vague and I think won't really help much to mitigate above problem, if any. I found this interesting article and test class that tries to demonstrate the resp. behavior of the situation: https://github.com/brettwooldridge/HikariCP/wiki/Bad-Behavior:-Handling-Database-Down https://github.com/brettwooldridge/HikariCP-benchmark/blob/master/src/test/java/com/zaxxer/hikari/benchmark/DbDownTest.java There seems also to be an reply to above benchmark from the vibur dbcp author, which has some interesting points: https://github.com/brettwooldridge/HikariCP/issues/230 While investigating the reason of why exponential backoff would make sense I also did stumble across this article: https://aws.amazon.com/de/blogs/architecture/exponential-backoff-and-jitter/ This article make much more sense in my head, I.e. use exponential backoff with jitter to protect the restarting database from getting "flooded". But HikariCP does only support plain exponential backoff and probably won't help much in above described situation, because once the database is starting to accept connections again, all HikariCP connections will probably align at the same time to start creating connections again. > >-chris > >- >To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >For additional commands, e-mail: users-h...@tomcat.apache.org > -- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat JDBC CP: Exponential backoff?
Thomas, On 1/17/23 13:33, Thomas Meyer wrote: Does Tomcat's CP support exponential backoff in case DB is unavailable for some reason? I didn't find anything in the documentation in this regards. I don't think is supports any such thing. What would be the purpose of exponential back-off... don't you want to connect ASAP? -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Tomcat JDBC CP: Exponential backoff?
Hi, Does Tomcat's CP support exponential backoff in case DB is unavailable for some reason? I didn't find anything in the documentation in this regards. Mfg Thomas -- Diese Nachricht wurde von meinem Android-Gerät mit K-9 Mail gesendet.
Connection Closed Errors From JDBC-Pool
Greetings! I have a problem, possibly (or not) tied to the Tomcat-JDBC Pool. Here is the rundown: Application Server: Apache Tomcat 9.0.56 JDBC Connection Pool: org.apache.tomcat.jdbc.pool.DataSource; Tomcat-JDBC 9.0.56 Oracle Version: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Java Driver: com.oracle.database.jdbc::ojdbc11 21.4.0.0.1 All of this running on Amazon ECS running between 8 and 20 instances depending on load Configuration of Pool: Problem: We are experiencing sporadic spikes where connections are being closed even though they are in use, or are returned by the connection pool already closed. This is a high volume API, and it can go days without this happening and then suddenly it will have a spike out of nowhere. This does not seem to be tied to any long running activity we can find. I can see instances where a request got a connection from the pool and it failed on the first attempt to use just milliseconds after it was returned. Furthermore it seems to happen randomly in batches where hundreds of these happen at once on a single JVM, then won't happen again for days. There are a few different scenarios where we see this, sometimes it occurs inside of the connection pool, in this case we see a message about not being able to clear warnings, but not much else. The stack trace gets truncated after a while but in these cases there is no sub-exception. It's just the one, this error in the pool propagates up and out and results in a failed request. Message: Unable to clear Warnings, connection will be closed. Logger: org.apache.tomcat.jdbc.pool.PooledConnection Exception: java.sql.SQLRecoverableException: Closed Connection at oracle.jdbc.driver.PhysicalConnection.requireOpenConnection(PhysicalConnection.java:11773) at oracle.jdbc.driver.PhysicalConnection.clearWarnings(PhysicalConnection.java:3526) at org.apache.tomcat.jdbc.pool.PooledConnection.clearWarnings(PooledConnection.java:875) at org.apache.tomcat.jdbc.pool.ConnectionPool.returnConnection(ConnectionPool.java:1019) at org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:103) at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109) at org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:69) at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109) at org.apache.tomcat.jdbc.pool.interceptor.ConnectionState.invoke(ConnectionState.java:158) at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109) at org.apache.tomcat.jdbc.pool.TrapException.invoke(TrapException.java:39) at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109) at org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:69) at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109) at org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:81) at com.sun.proxy.$Proxy94.close(Unknown Source) Sometimes we see a similar error AFTER the connection has been returned from the pool: message (example, lots of different queries): Resolved [org.springframework.dao.RecoverableDataAccessException: PreparedStatementCallback; SQL [**]; Closed Connection; nested exception is java.sql.SQLRecoverableException: Closed Connection] exception: java.sql.SQLRecoverableException: Closed Connection at oracle.jdbc.driver.PhysicalConnection.requireOpenConnection(PhysicalConnection.java:11773) at oracle.jdbc.driver.PhysicalConnection.prepareStatementInternal(PhysicalConnection.java:2354) at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:2309) at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:2300) at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:2211) at jdk.internal.reflect.GeneratedMethodAccessor194.invoke(Unknown Source) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:566) at org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:131) at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109) at org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:75) at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109) at org.apache.tomcat.jdbc.pool.interceptor.ConnectionState.invoke(ConnectionState.java:158) at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109) at org.apache.tomcat.jdbc.pool.TrapException.invoke(TrapException.java:39) at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109) at org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke
[jdbc-pool] ProxyConnection doesn't return connection to the pool on 'abort' call
Hi, folks [NOT A CONTRIBUTION] JDBC Pool Version: 9.0.49 Database: Oracle JDBC Version: 19.3.0.0 OS: Mac, Linux The problem I'm running into: We are using Tomcat JDBC Pool. When getting the network failure between server and database something like 'Connection Reset by Peer' ORM framework we are using 'abort' method from JDBC Connection which goes through the ProxyConnection class. As a result underlying physical connection to DB is closed but PooledConnection is not return to the pool. The reason to using 'abort' is that oracle PhysicalConnection in case of network failure sometimes goes to the inconsistent state and calling plain 'close' throws an unexpected exception. Seems like ProxyConnection is missing special handling for the 'abort' method which should call abort on the underlying connection and return PoolConnection to the pool afterwards. According to JDBC specification link - https://docs.oracle.com/javase/8/docs/api/java/sql/Connection.html#abort-java.util.concurrent.Executor- calling 'abort' should perform close on the connection. As a workaround we have fixed that using interceptor: [NOT A CONTRIBUTION] @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object invoke = super.invoke(proxy, method, args); if (compare(ABORT_VAL, method) && findProxyConnectionInChain().isPresent()) { ProxyConnection proxyConnection = findProxyConnectionInChain().get(); proxyConnection.getDelegateConnection().setDiscarded(true); try { super.invoke(proxy, Connection.class.getDeclaredMethod(ProxyConnection.CLOSE_VAL), args); } catch (Exception e) { // Error handling } } return invoke; } private Optional findProxyConnectionInChain() { JdbcInterceptor next = getNext(); while (next != null) { if (next instanceof ProxyConnection) return Optional.of((ProxyConnection) next); next = next.getNext(); } return Optional.empty(); } Can someone confirm this is an issue and can be reported as a bug? Alexey PS I've patch ready for that: [NOT A CONTRIBUTION] if (compare(CLOSE_VAL,method) || compare(ABORT_VAL,method)) { if (connection==null) return null; //noop for already closed. if (compare(ABORT_VAL,method)) { invokeRealMethod(method, args); } PooledConnection poolc = this.connection; this.connection = null; pool.returnConnection(poolc); return null; } private Object invokeRealMethod(Method method, Object[] args) throws Throwable { try { PooledConnection poolc = connection; if (poolc!=null) { return method.invoke(poolc.getConnection(), args); } else { throw new SQLException("Connection has already been closed."); } } catch (Throwable t) { if (t instanceof InvocationTargetException) { throw t.getCause() != null ? t.getCause() : t; } else { throw t; } } } - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat jdbc connections
On 1/25/22 1:44 AM, Alan F wrote: Hi Chris, Thankyou so much for your time and detail here. I had been working on this yesterday and posted my findings below. In the end It turned out to be my lack of understanding on Tomcat, but hey we are always learning! I would just like to update on my discovery of the issue I had with Tomcat resetting connections to DB. Main issue being lack of familiarity of parameters and how connection pooling worked. One thing I was unable to see without using a DBA admin was the connections resetting, no level of logging in Tomcat seemed to reveal this, and in the end I used a simple netstat query to check connections. watch -n1 "netstat -ant | grep ':1521.*ESTABLISHED' | nl | tail -n20 (last number depends on how many connections to monitor.) Obvs local ports will change outgoing therefore highlighting a new connection when these change. Once I had this I was able to tinker with current settings until I discovered the issue. Which in reality wasn't an issue per se its just that I discovered a non live Tomcat was behaving differently with pooled connections over a live host! Just to Recap Symptom: Tomcat closing DBCP pooled connections to Database every 60 seconds Cause: Tomcat was idle, therefore the configuration param was causing idle connections to be reset the period specified below (60 secs) timeBetweenEvictionRunsMillis=6 Resolution: The behaviour above is by design, a busy server will be less likely to trigger this due to connections being used! Are you sure you did not set minEvictableIdleTimeMillis somewhere? That is the setting that determines how long a connection can sit idle in the pool before it is eligible for eviction. Phil -Original Message- From: Christopher Schultz Sent: 24 January 2022 22:42 To: users@tomcat.apache.org Subject: Re: Tomcat jdbc connections Alan, On 1/23/22 09:17, Alan F wrote: Can I just follow up here what would be the next steps how would I go about capturing the root cause of these very short connection times to Oracle from Tomcat. Honestly, I would want to know what query or queries are being run by these short-lived connections. Something tells me that if you are able to audit those queries, you'll immediately know what's going on. SELECT * FROM query_details WHERE connection_id='deadbeef' user | start_time | end_time | query zabbix | 12:00:00 | 12:00:00 | SELECT COUNT(*) FROM some_queue zabbix | 12:01:00 | 12:01:00 | SELECT COUNT(*) FROM some_queue zabbix | 12:02:00 | 12:02:00 | SELECT COUNT(*) FROM some_queue zabbix | 12:03:00 | 12:03:00 | SELECT COUNT(*) FROM some_queue zabbix | 12:04:00 | 12:04:00 | SELECT COUNT(*) FROM some_queue zabbix | 12:05:00 | 12:05:00 | SELECT COUNT(*) FROM some_queue /me says "Oh, right. We have monitoring." Would it be along the lines of Wireshark or TCP dump to see what's occurring as I gather this won't be captured in tomcat logging via Catalina.out? Or can it be. I would only resort to reading TCP dumps if all else fails. Why? 1. TCP dumps are large and "expensive" 2. You are encrypting connections to your database... right?! Knowing the nature of the queries will help. If you see no queries being executed, then no TCP dump will help you because you won't be able to prove what component is making those connection anyway (unless dbcp2 pushes some environmental information over to Oracle whenever it makes a connection like "I'm connecting to Oracle on behalf of application X on Tomcat, but I'm not going to execute any queries mmm'kay"). I don't think dbcp does that kind of thing, so you'd have to crank-up the logging level on that application and/or Tomcat instance to see what's happening with the connection pool. Hope that helps, -chris -Original Message- From: Phil Steitz Sent: 21 January 2022 17:50 To: users@tomcat.apache.org Subject: Re: Tomcat jdbc connections On 1/21/22 9:28 AM, Alan F wrote: Ok thanks Phil ok I checked other connections in the same host and see minIdle="2" and initialSize="7" Ive run a diff on this server.xml between our active prod hosts which shows connections on Toad up for at least a day as to this idle server reconnecting after minutes! And diff is identical apart from Cluster ips. Most likely culprit is network or other issue causing validations to fail. With testWhileIdle on, idle connections in the pool will be tested when visited and closed if validation fails. Phil -Original Message- From: Phil Steitz Sent: 21 January 2022 16:10 To: users@tomcat.apache.org Subject: Re: Tomcat jdbc connections On 1/21/22 8:19 AM, Alan F wrote: Thanks John, Here is an example of a connection below I see timeBetweenEvictionRunsMillis but not maxConnLifetimeMillis if the server has no traffic does this mean So above does that mean every 60 secs Eviction runs, does this mean a server with no
Re: Tomcat jdbc connections
Alan, On 1/25/22 03:44, Alan F wrote: Hi Chris, Thankyou so much for your time and detail here. I had been working on this yesterday and posted my findings below. In the end It turned out to be my lack of understanding on Tomcat, but hey we are always learning! I would just like to update on my discovery of the issue I had with Tomcat resetting connections to DB. Main issue being lack of familiarity of parameters and how connection pooling worked. One thing I was unable to see without using a DBA admin was the connections resetting, no level of logging in Tomcat seemed to reveal this, and in the end I used a simple netstat query to check connections. watch -n1 "netstat -ant | grep ':1521.*ESTABLISHED' | nl | tail -n20 (last number depends on how many connections to monitor.) Obvs local ports will change outgoing therefore highlighting a new connection when these change. Once I had this I was able to tinker with current settings until I discovered the issue. Which in reality wasn't an issue per se its just that I discovered a non live Tomcat was behaving differently with pooled connections over a live host! Just to Recap Symptom: Tomcat closing DBCP pooled connections to Database every 60 seconds Cause: Tomcat was idle, therefore the configuration param was causing idle connections to be reset the period specified below (60 secs) timeBetweenEvictionRunsMillis=6 Resolution: The behaviour above is by design, a busy server will be less likely to trigger this due to connections being used! Hmm. I wouldn't expect any connections to be (re)established if those connections aren't being used. Maybe your application uses a bunch of connections on startup? -chris -Original Message- From: Christopher Schultz Sent: 24 January 2022 22:42 To: users@tomcat.apache.org Subject: Re: Tomcat jdbc connections Alan, On 1/23/22 09:17, Alan F wrote: Can I just follow up here what would be the next steps how would I go about capturing the root cause of these very short connection times to Oracle from Tomcat. Honestly, I would want to know what query or queries are being run by these short-lived connections. Something tells me that if you are able to audit those queries, you'll immediately know what's going on. SELECT * FROM query_details WHERE connection_id='deadbeef' user | start_time | end_time | query zabbix | 12:00:00 | 12:00:00 | SELECT COUNT(*) FROM some_queue zabbix | 12:01:00 | 12:01:00 | SELECT COUNT(*) FROM some_queue zabbix | 12:02:00 | 12:02:00 | SELECT COUNT(*) FROM some_queue zabbix | 12:03:00 | 12:03:00 | SELECT COUNT(*) FROM some_queue zabbix | 12:04:00 | 12:04:00 | SELECT COUNT(*) FROM some_queue zabbix | 12:05:00 | 12:05:00 | SELECT COUNT(*) FROM some_queue /me says "Oh, right. We have monitoring." Would it be along the lines of Wireshark or TCP dump to see what's occurring as I gather this won't be captured in tomcat logging via Catalina.out? Or can it be. I would only resort to reading TCP dumps if all else fails. Why? 1. TCP dumps are large and "expensive" 2. You are encrypting connections to your database... right?! Knowing the nature of the queries will help. If you see no queries being executed, then no TCP dump will help you because you won't be able to prove what component is making those connection anyway (unless dbcp2 pushes some environmental information over to Oracle whenever it makes a connection like "I'm connecting to Oracle on behalf of application X on Tomcat, but I'm not going to execute any queries mmm'kay"). I don't think dbcp does that kind of thing, so you'd have to crank-up the logging level on that application and/or Tomcat instance to see what's happening with the connection pool. Hope that helps, -chris -Original Message- From: Phil Steitz Sent: 21 January 2022 17:50 To: users@tomcat.apache.org Subject: Re: Tomcat jdbc connections On 1/21/22 9:28 AM, Alan F wrote: Ok thanks Phil ok I checked other connections in the same host and see minIdle="2" and initialSize="7" Ive run a diff on this server.xml between our active prod hosts which shows connections on Toad up for at least a day as to this idle server reconnecting after minutes! And diff is identical apart from Cluster ips. Most likely culprit is network or other issue causing validations to fail. With testWhileIdle on, idle connections in the pool will be tested when visited and closed if validation fails. Phil -Original Message- From: Phil Steitz Sent: 21 January 2022 16:10 To: users@tomcat.apache.org Subject: Re: Tomcat jdbc connections On 1/21/22 8:19 AM, Alan F wrote: Thanks John, Here is an example of a connection below I see timeBetweenEvictionRunsMillis but not maxConnLifetimeMillis if the server has no traffic does this mean So above does that mean every 60 secs Eviction runs, does this mean a server with no traffic evicts unused conne
RE: [External] Re: Tomcat jdbc connections
> Would it be along the lines of Wireshark or TCP dump to see what's > occurring as I gather this won't be captured in tomcat logging via > Catalina.out? Or can it be. Have you explored Oracle listener / client tracing? Ref: https://docs.oracle.com/cd/E11882_01/network.112/e10835/sqlnet.htm#NETRF397
RE: Tomcat jdbc connections
Hi Chris, Thankyou so much for your time and detail here. I had been working on this yesterday and posted my findings below. In the end It turned out to be my lack of understanding on Tomcat, but hey we are always learning! I would just like to update on my discovery of the issue I had with Tomcat resetting connections to DB. Main issue being lack of familiarity of parameters and how connection pooling worked. One thing I was unable to see without using a DBA admin was the connections resetting, no level of logging in Tomcat seemed to reveal this, and in the end I used a simple netstat query to check connections. watch -n1 "netstat -ant | grep ':1521.*ESTABLISHED' | nl | tail -n20 (last number depends on how many connections to monitor.) Obvs local ports will change outgoing therefore highlighting a new connection when these change. Once I had this I was able to tinker with current settings until I discovered the issue. Which in reality wasn't an issue per se its just that I discovered a non live Tomcat was behaving differently with pooled connections over a live host! Just to Recap Symptom: Tomcat closing DBCP pooled connections to Database every 60 seconds Cause: Tomcat was idle, therefore the configuration param was causing idle connections to be reset the period specified below (60 secs) timeBetweenEvictionRunsMillis=6 Resolution: The behaviour above is by design, a busy server will be less likely to trigger this due to connections being used! -Original Message- From: Christopher Schultz Sent: 24 January 2022 22:42 To: users@tomcat.apache.org Subject: Re: Tomcat jdbc connections Alan, On 1/23/22 09:17, Alan F wrote: > Can I just follow up here what would be the next steps how would I go > about capturing the root cause of these very short connection times to > Oracle from Tomcat. Honestly, I would want to know what query or queries are being run by these short-lived connections. Something tells me that if you are able to audit those queries, you'll immediately know what's going on. SELECT * FROM query_details WHERE connection_id='deadbeef' user | start_time | end_time | query zabbix | 12:00:00 | 12:00:00 | SELECT COUNT(*) FROM some_queue zabbix | 12:01:00 | 12:01:00 | SELECT COUNT(*) FROM some_queue zabbix | 12:02:00 | 12:02:00 | SELECT COUNT(*) FROM some_queue zabbix | 12:03:00 | 12:03:00 | SELECT COUNT(*) FROM some_queue zabbix | 12:04:00 | 12:04:00 | SELECT COUNT(*) FROM some_queue zabbix | 12:05:00 | 12:05:00 | SELECT COUNT(*) FROM some_queue /me says "Oh, right. We have monitoring." > Would it be along the lines of Wireshark or TCP dump to see what's > occurring as I gather this won't be captured in tomcat logging via > Catalina.out? Or can it be. I would only resort to reading TCP dumps if all else fails. Why? 1. TCP dumps are large and "expensive" 2. You are encrypting connections to your database... right?! Knowing the nature of the queries will help. If you see no queries being executed, then no TCP dump will help you because you won't be able to prove what component is making those connection anyway (unless dbcp2 pushes some environmental information over to Oracle whenever it makes a connection like "I'm connecting to Oracle on behalf of application X on Tomcat, but I'm not going to execute any queries mmm'kay"). I don't think dbcp does that kind of thing, so you'd have to crank-up the logging level on that application and/or Tomcat instance to see what's happening with the connection pool. Hope that helps, -chris > -Original Message- > From: Phil Steitz > Sent: 21 January 2022 17:50 > To: users@tomcat.apache.org > Subject: Re: Tomcat jdbc connections > > > > On 1/21/22 9:28 AM, Alan F wrote: >> Ok thanks Phil ok I checked other connections in the same host and see >> minIdle="2" and initialSize="7" >> >> Ive run a diff on this server.xml between our active prod hosts which shows >> connections on Toad up for at least a day as to this idle server >> reconnecting after minutes! And diff is identical apart from Cluster ips. > Most likely culprit is network or other issue causing validations to fail. > With testWhileIdle on, idle connections in the pool will be tested when > visited and closed if validation fails. > > Phil >> >> >> >> >> -Original Message- >> From: Phil Steitz >> Sent: 21 January 2022 16:10 >> To: users@tomcat.apache.org >> Subject: Re: Tomcat jdbc connections >> >> >> >> On 1/21/22 8:19 AM, Alan F wrote: >>> Thanks John, >>> >>> Here is an example of a connection below I see >>> timeBetweenEvictionRunsMillis but not maxConnLifetimeMillis if the >>> server has no traffic does this
Re: Tomcat jdbc connections
Alan, On 1/23/22 09:17, Alan F wrote: Can I just follow up here what would be the next steps how would I go about capturing the root cause of these very short connection times to Oracle from Tomcat. Honestly, I would want to know what query or queries are being run by these short-lived connections. Something tells me that if you are able to audit those queries, you'll immediately know what's going on. SELECT * FROM query_details WHERE connection_id='deadbeef' user | start_time | end_time | query zabbix | 12:00:00 | 12:00:00 | SELECT COUNT(*) FROM some_queue zabbix | 12:01:00 | 12:01:00 | SELECT COUNT(*) FROM some_queue zabbix | 12:02:00 | 12:02:00 | SELECT COUNT(*) FROM some_queue zabbix | 12:03:00 | 12:03:00 | SELECT COUNT(*) FROM some_queue zabbix | 12:04:00 | 12:04:00 | SELECT COUNT(*) FROM some_queue zabbix | 12:05:00 | 12:05:00 | SELECT COUNT(*) FROM some_queue /me says "Oh, right. We have monitoring." Would it be along the lines of Wireshark or TCP dump to see what's occurring as I gather this won't be captured in tomcat logging via Catalina.out? Or can it be. I would only resort to reading TCP dumps if all else fails. Why? 1. TCP dumps are large and "expensive" 2. You are encrypting connections to your database... right?! Knowing the nature of the queries will help. If you see no queries being executed, then no TCP dump will help you because you won't be able to prove what component is making those connection anyway (unless dbcp2 pushes some environmental information over to Oracle whenever it makes a connection like "I'm connecting to Oracle on behalf of application X on Tomcat, but I'm not going to execute any queries mmm'kay"). I don't think dbcp does that kind of thing, so you'd have to crank-up the logging level on that application and/or Tomcat instance to see what's happening with the connection pool. Hope that helps, -chris -Original Message- From: Phil Steitz Sent: 21 January 2022 17:50 To: users@tomcat.apache.org Subject: Re: Tomcat jdbc connections On 1/21/22 9:28 AM, Alan F wrote: Ok thanks Phil ok I checked other connections in the same host and see minIdle="2" and initialSize="7" Ive run a diff on this server.xml between our active prod hosts which shows connections on Toad up for at least a day as to this idle server reconnecting after minutes! And diff is identical apart from Cluster ips. Most likely culprit is network or other issue causing validations to fail. With testWhileIdle on, idle connections in the pool will be tested when visited and closed if validation fails. Phil -Original Message- From: Phil Steitz Sent: 21 January 2022 16:10 To: users@tomcat.apache.org Subject: Re: Tomcat jdbc connections On 1/21/22 8:19 AM, Alan F wrote: Thanks John, Here is an example of a connection below I see timeBetweenEvictionRunsMillis but not maxConnLifetimeMillis if the server has no traffic does this mean So above does that mean every 60 secs Eviction runs, does this mean a server with no traffic evicts unused connections to DB? One more note on this config. Since you have not specified minIIdle or initialSize, the pool will not create connections until they are requested by clients. Phil -Original Message- From: john.e.gr...@wellsfargo.com.INVALID Sent: 21 January 2022 14:50 To: users@tomcat.apache.org Subject: RE: Tomcat jdbc connections Alan, -Original Message- From: Alan F Sent: Friday, January 21, 2022 6:53 AM To: Tomcat Users List Subject: RE: Tomcat jdbc connections Hi Christopher Thanks for your time here. You mean like, a connection is made, no queries are executed, and then the connection is terminated? - ANSWER - DBAs are saying connections last a minute or so and are replaced by a new set of connections 1 session each pool. Presumably, you have an application running on Tomcat with a JDBC connection configured. Are you using Tomcat's built-in pooling, or is your application managing its own pooling/connections? - ANSWER we are using dbcp2 Do you have any background tasks (in the JVM) that will run even when there is no user activity? Cache-management? Lazy-writes? - ANSWER I don't think so. Are you using Tomcat's clustering? Are you using a database-backed session management or any kind? - - ANSWER YES clustered B node down, A node up this Tomcat node is not live or receiving any traffic currently in test. Are the connections definitely being made from the application itself and/or Tomcat? Or do you just see those connections coming from the IP where the application is running? - ANSWER im assuming according to server.xml they are utlising these declared connections via Tomcat. Do you have any background tasks (outside the JVM) that will run even when there are no user actions? For example, some monitoring system that pings the server to say "can you reach the database?" - ANSWER NO O
Re: Tomcat 9 Encrpytion of JDBC
On Thu, Jan 20, 2022 at 6:30 PM Christopher Schultz wrote: > > Harri, > > On 1/20/22 11:37, Harri Pesonen wrote: > > Vault for Apache Tomcat: > > > > https://github.com/web-servers/tomcat-vault > > > > It hides the secrets in another encrypted file, and password for that > > file is then in another file... So it just makes it more difficult to > > access the secrets, but at least they are not in plain text. > What this does is satisfy the following "security" requirement: > > [ ] Have you ensured that no credentials are stored unencrypted in > Tomcat's conf/server.xml file? > > [X] Check! > > Nice job. It doesn't answer the question "do you have plaintext > credentials in any configuration files" because whatever auditor is > asking would give you a bad grade. > > As soon as that auditor learns about Vault for Apache Tomcat, they will ask: > > [ ] Have you ensured that no credentials are stored unencrypted in > Tomcat's conf/server.xml file? > [ ] Have you ensured that no credentials are stored unencrypted in Vault > for Tomcat's vault-config.xml file? > > Then we'll get questions about whether there is a Vault for Vault for > Apache Tomcat. > > Someone should patch VfAT so it has a new feature which is the number of > configuration files it should use for encryption. So you can set it to > e.g. "4" and then you get these files: > > vault-config.xml > vault-config-1.xml > vault-config-2.xml > vault-config-3.xml > > And the -3 file contains the plaintext password used to unlock -2 which > unlocks -1 which unlocks vault-config.xml. Hey, three layers of > encryption! Super secure! So I guess this means you're still not interested in that awesome potential contribution we could make to Tomcat :D Rémy Rémy > > -chris > > > -Original Message- > > From: Orendt, John > > Sent: torstai 20. tammikuuta 2022 18.11 > > To: users@tomcat.apache.org > > Subject: RE: Tomcat 9 Encrpytion of JDBC > > > > [Et saa yleensä sähköpostia osoitteesta > > john.p.ore...@medtronic.com.invalid. Lue lisää siitä, miksi tämä on > > tärkeää, osoitteesta http://aka.ms/LearnAboutSenderIdentification.] > > > > Hi > > > > There are at least two types of mutual authentication. > > > > 1. Device Client A and Server B > > 2. Human A via browser and Server B > > > > All the scenarios you mention have been solved. You just need to know how. > > X509 certs, the chain of trust, TPMs and HSMs are some the of parts of the > > solution for both types. > > > > Internet Banking does exist. > > > > John Orendt > > john.p.ore...@medtronic.com > > > > -Original Message- > > From: Christopher Schultz > > Sent: Tuesday, January 18, 2022 11:32 AM > > To: users@tomcat.apache.org > > Subject: Re: Tomcat 9 Encrpytion of JDBC > > > > John, > > > > On 1/18/22 08:37, Orendt, John wrote: > >> Secrets are more secure with the use of a Trusted Platform Module > >> (TPM) and / or a Hardware Security Module (HSM). > >> > >> Secrets need to be protected both at rest and in transit. > > Sure. Where you put the password for the TPM or HSM? Or do you enter the > > password for your HSM/TPM every time you start a process that needs access > > to secrets? How do you handle unattended restarts? > > > > How do you handle massive deployments? Do you manually-enter a password on > > 1000 servers as they all launch together? > > > > On all these kinds of deployments, you usually use a key server. But then > > how do you authenticate to the key server? With another secret. > > It's secrets all the way down. At some point, you must trust something, and > > that something you trust can't be a human, because that doesn't scale or > > isn't practical for some other reason. > > > > I'd love to hear a practical solution to the "secret at rest" problem that > > actually makes some sense and doesn't just hand-wave the problem off to > > another component that is Somebody Else's Problem. > > > > -chris > > > >> -Original Message- > >> From: Alan F > >> Sent: Friday, January 14, 2022 2:05 PM > >> To: Tomcat Users List > >> Subject: RE: Tomcat 9 Encrpytion of JDBC > >> > >> OK thanks Bill! > >> > >> -Original Message- > >> From: Bill Stewart > >> Sent: 14 January 2022 19:02 > >> To: Tomcat Users List > >> Subject: Re: Tomcat 9 Encrpytion of JDBC > >> >
RE: Tomcat jdbc connections
Can I just follow up here what would be the next steps how would I go about capturing the root cause of these very short connection times to Oracle from Tomcat. Would it be along the lines of Wireshark or TCP dump to see what's occurring as I gather this won't be captured in tomcat logging via Catalina.out? Or can it be. -Original Message- From: Phil Steitz Sent: 21 January 2022 17:50 To: users@tomcat.apache.org Subject: Re: Tomcat jdbc connections On 1/21/22 9:28 AM, Alan F wrote: > Ok thanks Phil ok I checked other connections in the same host and see > minIdle="2" and initialSize="7" > > Ive run a diff on this server.xml between our active prod hosts which shows > connections on Toad up for at least a day as to this idle server reconnecting > after minutes! And diff is identical apart from Cluster ips. Most likely culprit is network or other issue causing validations to fail. With testWhileIdle on, idle connections in the pool will be tested when visited and closed if validation fails. Phil > > > > > -Original Message- > From: Phil Steitz > Sent: 21 January 2022 16:10 > To: users@tomcat.apache.org > Subject: Re: Tomcat jdbc connections > > > > On 1/21/22 8:19 AM, Alan F wrote: >> Thanks John, >> >> Here is an example of a connection below I see >> timeBetweenEvictionRunsMillis but not maxConnLifetimeMillis if the >> server has no traffic does this mean >> >> > timeBetweenEvictionRunsMillis="6" testWhileIdle="true" >> testOnReturn="false" >> testOnBorrow="true" removeAbandonedOnBorrow="true" maxWaitmillis="3" >> defaultQueryTimeout="30" validationQuery="select * from dual" maxTotal="10" >> maxIdle="5" >> url="jdbc:oracle:thin:@XXX:X:" username="XXX" >> password="" driverClassName="oracle.jdbc.OracleDriver" /> >> >> >> So above does that mean every 60 secs Eviction runs, does this mean a server >> with no traffic evicts unused connections to DB? > One more note on this config. Since you have not specified minIIdle or > initialSize, the pool will not create connections until they are requested by > clients. > > Phil >> >> -Original Message- >> From: john.e.gr...@wellsfargo.com.INVALID >> >> Sent: 21 January 2022 14:50 >> To: users@tomcat.apache.org >> Subject: RE: Tomcat jdbc connections >> >> Alan, >> >> >>> -Original Message- >>> From: Alan F >>> Sent: Friday, January 21, 2022 6:53 AM >>> To: Tomcat Users List >>> Subject: RE: Tomcat jdbc connections >>> >>> Hi Christopher >>> >>> Thanks for your time here. >>> >>> You mean like, a connection is made, no queries are executed, and >>> then the connection is terminated? >>> - ANSWER - DBAs are saying connections last a minute or so and are >>> replaced by a new set of connections 1 session each pool. >>> >>> >>> Presumably, you have an application running on Tomcat with a JDBC >>> connection configured. Are you using Tomcat's built-in pooling, or >>> is your application managing its own pooling/connections? >>> - ANSWER we are using dbcp2 >>> >>> >>> Do you have any background tasks (in the JVM) that will run even >>> when there is no user activity? Cache-management? Lazy-writes? >>> - ANSWER I don't think so. >>> >>> >>> Are you using Tomcat's clustering? Are you using a database-backed >>> session management or any kind? - >>> - ANSWER YES clustered B node down, A node up this Tomcat node is >>> not live or receiving any traffic currently in test. >>> >>> >>> Are the connections definitely being made from the application >>> itself and/or Tomcat? Or do you just see those connections coming >>> from the IP where the application is running? - ANSWER im assuming >>> according to server.xml they are utlising these declared connections via >>> Tomcat. >>> >>> >>> Do you have any background tasks (outside the JVM) that will run >>> even when there are no user actions? For example, some monitoring >>> system that pings the server to say "can you reach the database?" - >>> ANSWER NO >>> >>> >>> O >>> >> Could your pool be closing the connections after a set time? Look at >> timeBetweenEvict
RE: Tomcat jdbc connections
Thanks for your input Phil! Arghh will keep looking. -Original Message- From: Phil Steitz Sent: 21 January 2022 17:50 To: users@tomcat.apache.org Subject: Re: Tomcat jdbc connections On 1/21/22 9:28 AM, Alan F wrote: > Ok thanks Phil ok I checked other connections in the same host and see > minIdle="2" and initialSize="7" > > Ive run a diff on this server.xml between our active prod hosts which shows > connections on Toad up for at least a day as to this idle server reconnecting > after minutes! And diff is identical apart from Cluster ips. Most likely culprit is network or other issue causing validations to fail. With testWhileIdle on, idle connections in the pool will be tested when visited and closed if validation fails. Phil > > > > > -Original Message- > From: Phil Steitz > Sent: 21 January 2022 16:10 > To: users@tomcat.apache.org > Subject: Re: Tomcat jdbc connections > > > > On 1/21/22 8:19 AM, Alan F wrote: >> Thanks John, >> >> Here is an example of a connection below I see >> timeBetweenEvictionRunsMillis but not maxConnLifetimeMillis if the >> server has no traffic does this mean >> >> > timeBetweenEvictionRunsMillis="6" testWhileIdle="true" >> testOnReturn="false" >> testOnBorrow="true" removeAbandonedOnBorrow="true" maxWaitmillis="3" >> defaultQueryTimeout="30" validationQuery="select * from dual" maxTotal="10" >> maxIdle="5" >> url="jdbc:oracle:thin:@XXX:X:" username="XXX" >> password="" driverClassName="oracle.jdbc.OracleDriver" /> >> >> >> So above does that mean every 60 secs Eviction runs, does this mean a server >> with no traffic evicts unused connections to DB? > One more note on this config. Since you have not specified minIIdle or > initialSize, the pool will not create connections until they are requested by > clients. > > Phil >> >> -Original Message- >> From: john.e.gr...@wellsfargo.com.INVALID >> >> Sent: 21 January 2022 14:50 >> To: users@tomcat.apache.org >> Subject: RE: Tomcat jdbc connections >> >> Alan, >> >> >>> -Original Message- >>> From: Alan F >>> Sent: Friday, January 21, 2022 6:53 AM >>> To: Tomcat Users List >>> Subject: RE: Tomcat jdbc connections >>> >>> Hi Christopher >>> >>> Thanks for your time here. >>> >>> You mean like, a connection is made, no queries are executed, and >>> then the connection is terminated? >>> - ANSWER - DBAs are saying connections last a minute or so and are >>> replaced by a new set of connections 1 session each pool. >>> >>> >>> Presumably, you have an application running on Tomcat with a JDBC >>> connection configured. Are you using Tomcat's built-in pooling, or >>> is your application managing its own pooling/connections? >>> - ANSWER we are using dbcp2 >>> >>> >>> Do you have any background tasks (in the JVM) that will run even >>> when there is no user activity? Cache-management? Lazy-writes? >>> - ANSWER I don't think so. >>> >>> >>> Are you using Tomcat's clustering? Are you using a database-backed >>> session management or any kind? - >>> - ANSWER YES clustered B node down, A node up this Tomcat node is >>> not live or receiving any traffic currently in test. >>> >>> >>> Are the connections definitely being made from the application >>> itself and/or Tomcat? Or do you just see those connections coming >>> from the IP where the application is running? - ANSWER im assuming >>> according to server.xml they are utlising these declared connections via >>> Tomcat. >>> >>> >>> Do you have any background tasks (outside the JVM) that will run >>> even when there are no user actions? For example, some monitoring >>> system that pings the server to say "can you reach the database?" - >>> ANSWER NO >>> >>> >>> O >>> >> Could your pool be closing the connections after a set time? Look at >> timeBetweenEvictionRunsMillis and maxConnLifetimeMillis here: >> >> https://commons.apache.org/proper/commons-dbcp/configuration.html >> B CB >> [ X ܚX KK[XZ[ >>\ \ ][ X ܚX P X ] >>\X K ܙ B ܈Y][ۘ[ [X[ K[XZ[ >>\ \ Z[ X ] >>\X K ܙ B >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >> For additional commands, e-mail: users-h...@tomcat.apache.org >> > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat jdbc connections
On 1/21/22 9:28 AM, Alan F wrote: Ok thanks Phil ok I checked other connections in the same host and see minIdle="2" and initialSize="7" Ive run a diff on this server.xml between our active prod hosts which shows connections on Toad up for at least a day as to this idle server reconnecting after minutes! And diff is identical apart from Cluster ips. Most likely culprit is network or other issue causing validations to fail. With testWhileIdle on, idle connections in the pool will be tested when visited and closed if validation fails. Phil -Original Message- From: Phil Steitz Sent: 21 January 2022 16:10 To: users@tomcat.apache.org Subject: Re: Tomcat jdbc connections On 1/21/22 8:19 AM, Alan F wrote: Thanks John, Here is an example of a connection below I see timeBetweenEvictionRunsMillis but not maxConnLifetimeMillis if the server has no traffic does this mean So above does that mean every 60 secs Eviction runs, does this mean a server with no traffic evicts unused connections to DB? One more note on this config. Since you have not specified minIIdle or initialSize, the pool will not create connections until they are requested by clients. Phil -Original Message- From: john.e.gr...@wellsfargo.com.INVALID Sent: 21 January 2022 14:50 To: users@tomcat.apache.org Subject: RE: Tomcat jdbc connections Alan, -Original Message- From: Alan F Sent: Friday, January 21, 2022 6:53 AM To: Tomcat Users List Subject: RE: Tomcat jdbc connections Hi Christopher Thanks for your time here. You mean like, a connection is made, no queries are executed, and then the connection is terminated? - ANSWER - DBAs are saying connections last a minute or so and are replaced by a new set of connections 1 session each pool. Presumably, you have an application running on Tomcat with a JDBC connection configured. Are you using Tomcat's built-in pooling, or is your application managing its own pooling/connections? - ANSWER we are using dbcp2 Do you have any background tasks (in the JVM) that will run even when there is no user activity? Cache-management? Lazy-writes? - ANSWER I don't think so. Are you using Tomcat's clustering? Are you using a database-backed session management or any kind? - - ANSWER YES clustered B node down, A node up this Tomcat node is not live or receiving any traffic currently in test. Are the connections definitely being made from the application itself and/or Tomcat? Or do you just see those connections coming from the IP where the application is running? - ANSWER im assuming according to server.xml they are utlising these declared connections via Tomcat. Do you have any background tasks (outside the JVM) that will run even when there are no user actions? For example, some monitoring system that pings the server to say "can you reach the database?" - ANSWER NO O Could your pool be closing the connections after a set time? Look at timeBetweenEvictionRunsMillis and maxConnLifetimeMillis here: https://commons.apache.org/proper/commons-dbcp/configuration.html B CB [ X ܚX KK[XZ[ \ \ ][ X ܚX P X ] \X K ܙ B ܈Y][ۘ[ [X[ K[XZ[ \ \ Z[ X ] \X K ܙ B - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat jdbc connections
Ok thanks Phil ok I checked other connections in the same host and see minIdle="2" and initialSize="7" Ive run a diff on this server.xml between our active prod hosts which shows connections on Toad up for at least a day as to this idle server reconnecting after minutes! And diff is identical apart from Cluster ips. -Original Message- From: Phil Steitz Sent: 21 January 2022 16:10 To: users@tomcat.apache.org Subject: Re: Tomcat jdbc connections On 1/21/22 8:19 AM, Alan F wrote: > Thanks John, > > Here is an example of a connection below I see > timeBetweenEvictionRunsMillis but not maxConnLifetimeMillis if the > server has no traffic does this mean > > timeBetweenEvictionRunsMillis="6" testWhileIdle="true" > testOnReturn="false" > testOnBorrow="true" removeAbandonedOnBorrow="true" maxWaitmillis="3" > defaultQueryTimeout="30" validationQuery="select * from dual" maxTotal="10" > maxIdle="5" > url="jdbc:oracle:thin:@XXX:X:" username="XXX" > password="" driverClassName="oracle.jdbc.OracleDriver" /> > > > So above does that mean every 60 secs Eviction runs, does this mean a server > with no traffic evicts unused connections to DB? One more note on this config. Since you have not specified minIIdle or initialSize, the pool will not create connections until they are requested by clients. Phil > > > -Original Message- > From: john.e.gr...@wellsfargo.com.INVALID > > Sent: 21 January 2022 14:50 > To: users@tomcat.apache.org > Subject: RE: Tomcat jdbc connections > > Alan, > > >> -Original Message- >> From: Alan F >> Sent: Friday, January 21, 2022 6:53 AM >> To: Tomcat Users List >> Subject: RE: Tomcat jdbc connections >> >> Hi Christopher >> >> Thanks for your time here. >> >> You mean like, a connection is made, no queries are executed, and >> then the connection is terminated? >> - ANSWER - DBAs are saying connections last a minute or so and are >> replaced by a new set of connections 1 session each pool. >> >> >> Presumably, you have an application running on Tomcat with a JDBC >> connection configured. Are you using Tomcat's built-in pooling, or is >> your application managing its own pooling/connections? >> - ANSWER we are using dbcp2 >> >> >> Do you have any background tasks (in the JVM) that will run even when >> there is no user activity? Cache-management? Lazy-writes? >> - ANSWER I don't think so. >> >> >> Are you using Tomcat's clustering? Are you using a database-backed >> session management or any kind? - >> - ANSWER YES clustered B node down, A node up this Tomcat node is not >> live or receiving any traffic currently in test. >> >> >> Are the connections definitely being made from the application itself >> and/or Tomcat? Or do you just see those connections coming from the >> IP where the application is running? - ANSWER im assuming according >> to server.xml they are utlising these declared connections via Tomcat. >> >> >> Do you have any background tasks (outside the JVM) that will run even >> when there are no user actions? For example, some monitoring system >> that pings the server to say "can you reach the database?" - ANSWER >> NO >> >> >> O >> > Could your pool be closing the connections after a set time? Look at > timeBetweenEvictionRunsMillis and maxConnLifetimeMillis here: > > https://commons.apache.org/proper/commons-dbcp/configuration.html > B CB > [ X ܚX KK[XZ[ > \ \ ][ X ܚX P X ] > \X K ܙ B ܈Y][ۘ[ [X[ K[XZ[ > \ \ Z[ X ] > \X K ܙ B > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat jdbc connections
On 1/21/22 8:19 AM, Alan F wrote: Thanks John, Here is an example of a connection below I see timeBetweenEvictionRunsMillis but not maxConnLifetimeMillis if the server has no traffic does this mean So above does that mean every 60 secs Eviction runs, does this mean a server with no traffic evicts unused connections to DB? One more note on this config. Since you have not specified minIIdle or initialSize, the pool will not create connections until they are requested by clients. Phil -Original Message- From: john.e.gr...@wellsfargo.com.INVALID Sent: 21 January 2022 14:50 To: users@tomcat.apache.org Subject: RE: Tomcat jdbc connections Alan, -Original Message- From: Alan F Sent: Friday, January 21, 2022 6:53 AM To: Tomcat Users List Subject: RE: Tomcat jdbc connections Hi Christopher Thanks for your time here. You mean like, a connection is made, no queries are executed, and then the connection is terminated? - ANSWER - DBAs are saying connections last a minute or so and are replaced by a new set of connections 1 session each pool. Presumably, you have an application running on Tomcat with a JDBC connection configured. Are you using Tomcat's built-in pooling, or is your application managing its own pooling/connections? - ANSWER we are using dbcp2 Do you have any background tasks (in the JVM) that will run even when there is no user activity? Cache-management? Lazy-writes? - ANSWER I don't think so. Are you using Tomcat's clustering? Are you using a database-backed session management or any kind? - - ANSWER YES clustered B node down, A node up this Tomcat node is not live or receiving any traffic currently in test. Are the connections definitely being made from the application itself and/or Tomcat? Or do you just see those connections coming from the IP where the application is running? - ANSWER im assuming according to server.xml they are utlising these declared connections via Tomcat. Do you have any background tasks (outside the JVM) that will run even when there are no user actions? For example, some monitoring system that pings the server to say "can you reach the database?" - ANSWER NO O Could your pool be closing the connections after a set time? Look at timeBetweenEvictionRunsMillis and maxConnLifetimeMillis here: https://commons.apache.org/proper/commons-dbcp/configuration.html B CB [ X ܚX KK[XZ[ \ \ ][ X ܚX P X ] \X K ܙ B ܈Y][ۘ[ [X[ K[XZ[ \ \ Z[ X ] \X K ܙ B - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat jdbc connections
On 1/21/22 8:19 AM, Alan F wrote: Thanks John, Here is an example of a connection below I see timeBetweenEvictionRunsMillis but not maxConnLifetimeMillis if the server has no traffic does this mean So above does that mean every 60 secs Eviction runs, does this mean a server with no traffic evicts unused connections to DB? Not until they have been idle for minEvictableIdleTimeMillis ms. Since you have not specified this property, that will default to 30 mins (see [1]), so while the check will run every 60 secs, no connections should be removed for being idle too long until they have been idle in the pool for 30 mins. One thing that could cause connections to get closed by the pool under the config above is validation failures. Can your DBAs see the validation queries succeeding? Phil [1] https://commons.apache.org/proper/commons-dbcp/configuration.html -Original Message- From:john.e.gr...@wellsfargo.com.INVALID Sent: 21 January 2022 14:50 To:users@tomcat.apache.org Subject: RE: Tomcat jdbc connections Alan, -Original Message- From: Alan F Sent: Friday, January 21, 2022 6:53 AM To: Tomcat Users List Subject: RE: Tomcat jdbc connections Hi Christopher Thanks for your time here. You mean like, a connection is made, no queries are executed, and then the connection is terminated? - ANSWER - DBAs are saying connections last a minute or so and are replaced by a new set of connections 1 session each pool. Presumably, you have an application running on Tomcat with a JDBC connection configured. Are you using Tomcat's built-in pooling, or is your application managing its own pooling/connections? - ANSWER we are using dbcp2 Do you have any background tasks (in the JVM) that will run even when there is no user activity? Cache-management? Lazy-writes? - ANSWER I don't think so. Are you using Tomcat's clustering? Are you using a database-backed session management or any kind? - - ANSWER YES clustered B node down, A node up this Tomcat node is not live or receiving any traffic currently in test. Are the connections definitely being made from the application itself and/or Tomcat? Or do you just see those connections coming from the IP where the application is running? - ANSWER im assuming according to server.xml they are utlising these declared connections via Tomcat. Do you have any background tasks (outside the JVM) that will run even when there are no user actions? For example, some monitoring system that pings the server to say "can you reach the database?" - ANSWER NO O Could your pool be closing the connections after a set time? Look at timeBetweenEvictionRunsMillis and maxConnLifetimeMillis here: https://commons.apache.org/proper/commons-dbcp/configuration.html B CB [ X ܚX KK[XZ[ \ \ ][ X ܚX P X ] \X K ܙ B ܈Y][ۘ[ [X[ K[XZ[ \ \ Z[ X ] \X K ܙ B - To unsubscribe, e-mail:users-unsubscr...@tomcat.apache.org For additional commands, e-mail:users-h...@tomcat.apache.org
RE: Tomcat jdbc connections
Thanks John, Here is an example of a connection below I see timeBetweenEvictionRunsMillis but not maxConnLifetimeMillis if the server has no traffic does this mean So above does that mean every 60 secs Eviction runs, does this mean a server with no traffic evicts unused connections to DB? -Original Message- From: john.e.gr...@wellsfargo.com.INVALID Sent: 21 January 2022 14:50 To: users@tomcat.apache.org Subject: RE: Tomcat jdbc connections Alan, > -Original Message- > From: Alan F > Sent: Friday, January 21, 2022 6:53 AM > To: Tomcat Users List > Subject: RE: Tomcat jdbc connections > > Hi Christopher > > Thanks for your time here. > > You mean like, a connection is made, no queries are executed, and then > the connection is terminated? > - ANSWER - DBAs are saying connections last a minute or so and are > replaced by a new set of connections 1 session each pool. > > > Presumably, you have an application running on Tomcat with a JDBC > connection configured. Are you using Tomcat's built-in pooling, or is > your application managing its own pooling/connections? > - ANSWER we are using dbcp2 > > > Do you have any background tasks (in the JVM) that will run even when > there is no user activity? Cache-management? Lazy-writes? > - ANSWER I don't think so. > > > Are you using Tomcat's clustering? Are you using a database-backed > session management or any kind? - > - ANSWER YES clustered B node down, A node up this Tomcat node is not > live or receiving any traffic currently in test. > > > Are the connections definitely being made from the application itself > and/or Tomcat? Or do you just see those connections coming from the IP > where the application is running? - ANSWER im assuming according to > server.xml they are utlising these declared connections via Tomcat. > > > Do you have any background tasks (outside the JVM) that will run even > when there are no user actions? For example, some monitoring system > that pings the server to say "can you reach the database?" - ANSWER NO > > > O > Could your pool be closing the connections after a set time? Look at timeBetweenEvictionRunsMillis and maxConnLifetimeMillis here: https://commons.apache.org/proper/commons-dbcp/configuration.html B CB [ X ܚX KK[XZ[ \ \ ][ X ܚX P X ] \X K ܙ B ܈Y][ۘ[ [X[ K[XZ[ \ \ Z[ X ] \X K ܙ B - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat jdbc connections
Alan, > -Original Message- > From: Alan F > Sent: Friday, January 21, 2022 6:53 AM > To: Tomcat Users List > Subject: RE: Tomcat jdbc connections > > Hi Christopher > > Thanks for your time here. > > You mean like, a connection is made, no queries are executed, and then the > connection is terminated? > - ANSWER - DBAs are saying connections last a minute or so and are replaced > by a new set of connections 1 session each pool. > > > Presumably, you have an application running on Tomcat with a JDBC > connection configured. Are you using Tomcat's built-in pooling, or is your > application managing its own pooling/connections? > - ANSWER we are using dbcp2 > > > Do you have any background tasks (in the JVM) that will run even when > there is no user activity? Cache-management? Lazy-writes? > - ANSWER I don't think so. > > > Are you using Tomcat's clustering? Are you using a database-backed session > management or any kind? - > - ANSWER YES clustered B node down, A node up this Tomcat node is not live > or receiving any traffic currently in test. > > > Are the connections definitely being made from the application itself and/or > Tomcat? Or do you just see those connections coming from the IP where the > application is running? - ANSWER im assuming according to server.xml they > are utlising these declared connections via Tomcat. > > > Do you have any background tasks (outside the JVM) that will run even when > there are no user actions? For example, some monitoring system that pings > the server to say "can you reach the database?" - ANSWER NO > > > O > Could your pool be closing the connections after a set time? Look at timeBetweenEvictionRunsMillis and maxConnLifetimeMillis here: https://commons.apache.org/proper/commons-dbcp/configuration.html
RE: Tomcat jdbc connections
Hi Christopher Thanks for your time here. You mean like, a connection is made, no queries are executed, and then the connection is terminated? - ANSWER - DBAs are saying connections last a minute or so and are replaced by a new set of connections 1 session each pool. Presumably, you have an application running on Tomcat with a JDBC connection configured. Are you using Tomcat's built-in pooling, or is your application managing its own pooling/connections? - ANSWER we are using dbcp2 Do you have any background tasks (in the JVM) that will run even when there is no user activity? Cache-management? Lazy-writes? - ANSWER I don't think so. Are you using Tomcat's clustering? Are you using a database-backed session management or any kind? - - ANSWER YES clustered B node down, A node up this Tomcat node is not live or receiving any traffic currently in test. Are the connections definitely being made from the application itself and/or Tomcat? Or do you just see those connections coming from the IP where the application is running? - ANSWER im assuming according to server.xml they are utlising these declared connections via Tomcat. Do you have any background tasks (outside the JVM) that will run even when there are no user actions? For example, some monitoring system that pings the server to say "can you reach the database?" - ANSWER NO O -Original Message- From: Christopher Schultz Sent: 20 January 2022 17:34 To: users@tomcat.apache.org Subject: Re: Tomcat jdbc connections Alan, On 1/20/22 09:33, Alan F wrote: > I have an issue with connections on Tomcat9 Oracle showing connections > made for about 2seconds then dropped again. Is this normal when the > server is not being used? You mean like, a connection is made, no queries are executed, and then the connection is terminated? Presumably, you have an application running on Tomcat with a JDBC connection configured. Are you using Tomcat's built-in pooling, or is your application managing its own pooling/connections? Do you have any background tasks (in the JVM) that will run even when there is no user activity? Cache-management? Lazy-writes? Are you using Tomcat's clustering? Are you using a database-backed session management or any kind? Are the connections definitely being made from the application itself and/or Tomcat? Or do you just see those connections coming from the IP where the application is running? Do you have any background tasks (outside the JVM) that will run even when there are no user actions? For example, some monitoring system that pings the server to say "can you reach the database?" -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat jdbc connections
Alan, On 1/20/22 09:33, Alan F wrote: I have an issue with connections on Tomcat9 Oracle showing connections made for about 2seconds then dropped again. Is this normal when the server is not being used? You mean like, a connection is made, no queries are executed, and then the connection is terminated? Presumably, you have an application running on Tomcat with a JDBC connection configured. Are you using Tomcat's built-in pooling, or is your application managing its own pooling/connections? Do you have any background tasks (in the JVM) that will run even when there is no user activity? Cache-management? Lazy-writes? Are you using Tomcat's clustering? Are you using a database-backed session management or any kind? Are the connections definitely being made from the application itself and/or Tomcat? Or do you just see those connections coming from the IP where the application is running? Do you have any background tasks (outside the JVM) that will run even when there are no user actions? For example, some monitoring system that pings the server to say "can you reach the database?" -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat 9 Encrpytion of JDBC
Harri, On 1/20/22 11:37, Harri Pesonen wrote: Vault for Apache Tomcat: https://github.com/web-servers/tomcat-vault It hides the secrets in another encrypted file, and password for that file is then in another file... So it just makes it more difficult to access the secrets, but at least they are not in plain text. What this does is satisfy the following "security" requirement: [ ] Have you ensured that no credentials are stored unencrypted in Tomcat's conf/server.xml file? [X] Check! Nice job. It doesn't answer the question "do you have plaintext credentials in any configuration files" because whatever auditor is asking would give you a bad grade. As soon as that auditor learns about Vault for Apache Tomcat, they will ask: [ ] Have you ensured that no credentials are stored unencrypted in Tomcat's conf/server.xml file? [ ] Have you ensured that no credentials are stored unencrypted in Vault for Tomcat's vault-config.xml file? Then we'll get questions about whether there is a Vault for Vault for Apache Tomcat. Someone should patch VfAT so it has a new feature which is the number of configuration files it should use for encryption. So you can set it to e.g. "4" and then you get these files: vault-config.xml vault-config-1.xml vault-config-2.xml vault-config-3.xml And the -3 file contains the plaintext password used to unlock -2 which unlocks -1 which unlocks vault-config.xml. Hey, three layers of encryption! Super secure! -chris -Original Message- From: Orendt, John Sent: torstai 20. tammikuuta 2022 18.11 To: users@tomcat.apache.org Subject: RE: Tomcat 9 Encrpytion of JDBC [Et saa yleensä sähköpostia osoitteesta john.p.ore...@medtronic.com.invalid. Lue lisää siitä, miksi tämä on tärkeää, osoitteesta http://aka.ms/LearnAboutSenderIdentification.] Hi There are at least two types of mutual authentication. 1. Device Client A and Server B 2. Human A via browser and Server B All the scenarios you mention have been solved. You just need to know how. X509 certs, the chain of trust, TPMs and HSMs are some the of parts of the solution for both types. Internet Banking does exist. John Orendt john.p.ore...@medtronic.com -Original Message- From: Christopher Schultz Sent: Tuesday, January 18, 2022 11:32 AM To: users@tomcat.apache.org Subject: Re: Tomcat 9 Encrpytion of JDBC John, On 1/18/22 08:37, Orendt, John wrote: Secrets are more secure with the use of a Trusted Platform Module (TPM) and / or a Hardware Security Module (HSM). Secrets need to be protected both at rest and in transit. Sure. Where you put the password for the TPM or HSM? Or do you enter the password for your HSM/TPM every time you start a process that needs access to secrets? How do you handle unattended restarts? How do you handle massive deployments? Do you manually-enter a password on 1000 servers as they all launch together? On all these kinds of deployments, you usually use a key server. But then how do you authenticate to the key server? With another secret. It's secrets all the way down. At some point, you must trust something, and that something you trust can't be a human, because that doesn't scale or isn't practical for some other reason. I'd love to hear a practical solution to the "secret at rest" problem that actually makes some sense and doesn't just hand-wave the problem off to another component that is Somebody Else's Problem. -chris -Original Message- From: Alan F Sent: Friday, January 14, 2022 2:05 PM To: Tomcat Users List Subject: RE: Tomcat 9 Encrpytion of JDBC OK thanks Bill! -Original Message- From: Bill Stewart Sent: 14 January 2022 19:02 To: Tomcat Users List Subject: Re: Tomcat 9 Encrpytion of JDBC On Fri, Jan 14, 2022 at 10:25 AM Alan F wrote: Interested to know your best practices on securing jdbc plain text passwords, in my last place they used a mechanism to encrypt all passwords. Is this the best method as I read some people don't recommend this. Any details or procs on best practice appreciated. The "best practice," generally speaking, is that doing so is basically pointless from a security perspective. https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Furld efense.com%2Fv3%2F__https%3A%2F%2Fcwiki.apache.org%2Fconfluence%2Fdisp ladata=04%7C01%7Charri.pesonen%40sinch.com%7C318adb49672e4fe13aa1 08d9dc2f9971%7C3b518aae89214a7b8497619d756ce20e%7C0%7C0%7C637782919266 275465%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJ BTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=mMjmECMDtbO%2Fa5ovQgdahIl aq%2FZdVBEnzoRAyy7oYQA%3Dreserved=0 y/TOMCAT/Password__;!!NFcUtLLUcw!Bhr3E8c3AZFikCj4AHarnHl2emUxh99SUwhyn Fa-FKWZahvlpv0TmiVo5DveVMgMyg3NbQ$ Bill [CONFIDENTIALITY AND PRIVACY NOTICE] Information transmitted by this email is proprietary to Medtronic and is intended for use only by the individual or entity to which it is addressed, and may contain inf
Re: Tomcat 9 Encrpytion of JDBC
John, On 1/20/22 11:10, Orendt, John wrote: There are at least two types of mutual authentication. 1. Device Client A and Server B 2. Human A via browser and Server B All the scenarios you mention have been solved. You just need to know how. X509 certs, the chain of trust, TPMs and HSMs are some the of parts of the solution for both types. Okay, let's take X.509 certs as an example. Your server needs to sign messages sent to the client to provide authentication (to the client). For that you need the key, unencrypted. So how do you unlock the key without having the password around? Let's take TPM as another example: the key is in the TPM and it's (somewhat) tamper-proof and you can't extract it. Some software on the machine where the TPM is located asks the TPM to sign or decrypt something using the key. But how does the software authenticate to the TPM? (Hint: it doesn't). The trust is established by simple physical connection. So, let's get back to encrypting your JDBC password in your conf/server.xml file. If you encrypt that, you have to put the encryption key elsewhere. Fine, you say, I'll use a "remote key-service" where I supply an encrypted secret to the service and it returns the unencrypted password I can then use to connect to my JDBC server. Well, how do you authenticate to the key-service? Is it another physical presence thing? IP allow-listing? Whatever it is, it's almost exactly as secure as having the password right there in the file on the machine without all the hand-waving and complexity. "Oh, but if the server is stolen or data is exfiltrated then OMG what do we do?" Well, first of all, you don't allow connections to your database from random strangers: that password is only useful when used locally. So the "secret" of the password getting out isn't really a problem. Fine, rotating the password would be a good idea, but the password should be useless without that other security control: presence in a (relatively) trusted position. Internet Banking does exist. Yep, and I've never had anyone from the banking industry tell me how they protect their TLS keys in some super-secure way that uses TPMs, HSMs, and X.509 certifictes. Maybe it's a closely-guarded secret that they aren't allowed to tell anybody. If you think you have an idea that meaningfully improves security and ALSO does not rely on hand-waving to simply move the problem somewhere else, I'd love to hear it. -chris -Original Message- From: Christopher Schultz Sent: Tuesday, January 18, 2022 11:32 AM To: users@tomcat.apache.org Subject: Re: Tomcat 9 Encrpytion of JDBC John, On 1/18/22 08:37, Orendt, John wrote: Secrets are more secure with the use of a Trusted Platform Module (TPM) and / or a Hardware Security Module (HSM). Secrets need to be protected both at rest and in transit. Sure. Where you put the password for the TPM or HSM? Or do you enter the password for your HSM/TPM every time you start a process that needs access to secrets? How do you handle unattended restarts? How do you handle massive deployments? Do you manually-enter a password on 1000 servers as they all launch together? On all these kinds of deployments, you usually use a key server. But then how do you authenticate to the key server? With another secret. It's secrets all the way down. At some point, you must trust something, and that something you trust can't be a human, because that doesn't scale or isn't practical for some other reason. I'd love to hear a practical solution to the "secret at rest" problem that actually makes some sense and doesn't just hand-wave the problem off to another component that is Somebody Else's Problem. -chris -Original Message- From: Alan F Sent: Friday, January 14, 2022 2:05 PM To: Tomcat Users List Subject: RE: Tomcat 9 Encrpytion of JDBC OK thanks Bill! -Original Message- From: Bill Stewart Sent: 14 January 2022 19:02 To: Tomcat Users List Subject: Re: Tomcat 9 Encrpytion of JDBC On Fri, Jan 14, 2022 at 10:25 AM Alan F wrote: Interested to know your best practices on securing jdbc plain text passwords, in my last place they used a mechanism to encrypt all passwords. Is this the best method as I read some people don't recommend this. Any details or procs on best practice appreciated. The "best practice," generally speaking, is that doing so is basically pointless from a security perspective. https://urldefense.com/v3/__https://cwiki.apache.org/confluence/displa y/TOMCAT/Password__;!!NFcUtLLUcw!Bhr3E8c3AZFikCj4AHarnHl2emUxh99SUwhyn Fa-FKWZahvlpv0TmiVo5DveVMgMyg3NbQ$ Bill [CONFIDENTIALITY AND PRIVACY NOTICE] Information transmitted by this email is proprietary to Medtronic and is intended for use only by the individual or entity to which it is addressed, and may contain information that is private, privileged, confidential or exempt from disclosure under app
RE: Tomcat 9 Encrpytion of JDBC
Vault for Apache Tomcat: https://github.com/web-servers/tomcat-vault It hides the secrets in another encrypted file, and password for that file is then in another file... So it just makes it more difficult to access the secrets, but at least they are not in plain text. -Harri -Original Message- From: Orendt, John Sent: torstai 20. tammikuuta 2022 18.11 To: users@tomcat.apache.org Subject: RE: Tomcat 9 Encrpytion of JDBC [Et saa yleensä sähköpostia osoitteesta john.p.ore...@medtronic.com.invalid. Lue lisää siitä, miksi tämä on tärkeää, osoitteesta http://aka.ms/LearnAboutSenderIdentification.] Hi There are at least two types of mutual authentication. 1. Device Client A and Server B 2. Human A via browser and Server B All the scenarios you mention have been solved. You just need to know how. X509 certs, the chain of trust, TPMs and HSMs are some the of parts of the solution for both types. Internet Banking does exist. John Orendt john.p.ore...@medtronic.com -Original Message- From: Christopher Schultz Sent: Tuesday, January 18, 2022 11:32 AM To: users@tomcat.apache.org Subject: Re: Tomcat 9 Encrpytion of JDBC John, On 1/18/22 08:37, Orendt, John wrote: > Secrets are more secure with the use of a Trusted Platform Module > (TPM) and / or a Hardware Security Module (HSM). > > Secrets need to be protected both at rest and in transit. Sure. Where you put the password for the TPM or HSM? Or do you enter the password for your HSM/TPM every time you start a process that needs access to secrets? How do you handle unattended restarts? How do you handle massive deployments? Do you manually-enter a password on 1000 servers as they all launch together? On all these kinds of deployments, you usually use a key server. But then how do you authenticate to the key server? With another secret. It's secrets all the way down. At some point, you must trust something, and that something you trust can't be a human, because that doesn't scale or isn't practical for some other reason. I'd love to hear a practical solution to the "secret at rest" problem that actually makes some sense and doesn't just hand-wave the problem off to another component that is Somebody Else's Problem. -chris > -Original Message- > From: Alan F > Sent: Friday, January 14, 2022 2:05 PM > To: Tomcat Users List > Subject: RE: Tomcat 9 Encrpytion of JDBC > > OK thanks Bill! > > -Original Message- > From: Bill Stewart > Sent: 14 January 2022 19:02 > To: Tomcat Users List > Subject: Re: Tomcat 9 Encrpytion of JDBC > > On Fri, Jan 14, 2022 at 10:25 AM Alan F wrote: > > >> Interested to know your best practices on securing jdbc plain text >> passwords, in my last place they used a mechanism to encrypt all passwords. >> Is this the best method as I read some people don't recommend this. >> Any details or procs on best practice appreciated. >> > > The "best practice," generally speaking, is that doing so is basically > pointless from a security perspective. > > https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Furld > efense.com%2Fv3%2F__https%3A%2F%2Fcwiki.apache.org%2Fconfluence%2Fdisp > ladata=04%7C01%7Charri.pesonen%40sinch.com%7C318adb49672e4fe13aa1 > 08d9dc2f9971%7C3b518aae89214a7b8497619d756ce20e%7C0%7C0%7C637782919266 > 275465%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJ > BTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=mMjmECMDtbO%2Fa5ovQgdahIl > aq%2FZdVBEnzoRAyy7oYQA%3Dreserved=0 > y/TOMCAT/Password__;!!NFcUtLLUcw!Bhr3E8c3AZFikCj4AHarnHl2emUxh99SUwhyn > Fa-FKWZahvlpv0TmiVo5DveVMgMyg3NbQ$ > > Bill > [CONFIDENTIALITY AND PRIVACY NOTICE] Information transmitted by this > email is proprietary to Medtronic and is intended for use only by the > individual or entity to which it is addressed, and may contain > information that is private, privileged, confidential or exempt from > disclosure under applicable law. If you are not the intended recipient > or it appears that this mail has been forwarded to you without proper > authority, you are notified that any use or dissemination of this > information in any manner is strictly prohibited. In such cases, > please delete this mail from your records. To view this notice in > other languages you can either select the following link or manually > copy and paste the link into the address bar of a web browser: > https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Femail > disclaimer.medtronic.com%2Fdata=04%7C01%7Charri.pesonen%40sinch.c > om%7C318adb49672e4fe13aa108d9dc2f9971%7C3b518aae89214a7b8497619d756ce2 > 0e%7C0%7C0%7C637782919266275465%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLj > AwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata= > %2Fcv%2B6vRuz8ox1ipRnMTOWZxpz2%2BB
Re: Tomcat jdbc connections
On 20/01/2022 14:33, Alan F wrote: I have an issue with connections on Tomcat9 Oracle showing connections made for about 2seconds then dropped again. Is this normal when the server is not being used? Seems unlikely. Can you provide the DataSource configuration? Remember to obfuscate any sensitive data. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat 9 Encrpytion of JDBC
Hi There are at least two types of mutual authentication. 1. Device Client A and Server B 2. Human A via browser and Server B All the scenarios you mention have been solved. You just need to know how. X509 certs, the chain of trust, TPMs and HSMs are some the of parts of the solution for both types. Internet Banking does exist. John Orendt john.p.ore...@medtronic.com -Original Message- From: Christopher Schultz Sent: Tuesday, January 18, 2022 11:32 AM To: users@tomcat.apache.org Subject: Re: Tomcat 9 Encrpytion of JDBC John, On 1/18/22 08:37, Orendt, John wrote: > Secrets are more secure with the use of a Trusted Platform Module > (TPM) and / or a Hardware Security Module (HSM). > > Secrets need to be protected both at rest and in transit. Sure. Where you put the password for the TPM or HSM? Or do you enter the password for your HSM/TPM every time you start a process that needs access to secrets? How do you handle unattended restarts? How do you handle massive deployments? Do you manually-enter a password on 1000 servers as they all launch together? On all these kinds of deployments, you usually use a key server. But then how do you authenticate to the key server? With another secret. It's secrets all the way down. At some point, you must trust something, and that something you trust can't be a human, because that doesn't scale or isn't practical for some other reason. I'd love to hear a practical solution to the "secret at rest" problem that actually makes some sense and doesn't just hand-wave the problem off to another component that is Somebody Else's Problem. -chris > -Original Message- > From: Alan F > Sent: Friday, January 14, 2022 2:05 PM > To: Tomcat Users List > Subject: RE: Tomcat 9 Encrpytion of JDBC > > OK thanks Bill! > > -Original Message- > From: Bill Stewart > Sent: 14 January 2022 19:02 > To: Tomcat Users List > Subject: Re: Tomcat 9 Encrpytion of JDBC > > On Fri, Jan 14, 2022 at 10:25 AM Alan F wrote: > > >> Interested to know your best practices on securing jdbc plain text >> passwords, in my last place they used a mechanism to encrypt all passwords. >> Is this the best method as I read some people don't recommend this. >> Any details or procs on best practice appreciated. >> > > The "best practice," generally speaking, is that doing so is basically > pointless from a security perspective. > > https://urldefense.com/v3/__https://cwiki.apache.org/confluence/displa > y/TOMCAT/Password__;!!NFcUtLLUcw!Bhr3E8c3AZFikCj4AHarnHl2emUxh99SUwhyn > Fa-FKWZahvlpv0TmiVo5DveVMgMyg3NbQ$ > > Bill > [CONFIDENTIALITY AND PRIVACY NOTICE] Information transmitted by this > email is proprietary to Medtronic and is intended for use only by the > individual or entity to which it is addressed, and may contain > information that is private, privileged, confidential or exempt from > disclosure under applicable law. If you are not the intended recipient > or it appears that this mail has been forwarded to you without proper > authority, you are notified that any use or dissemination of this > information in any manner is strictly prohibited. In such cases, > please delete this mail from your records. To view this notice in > other languages you can either select the following link or manually > copy and paste the link into the address bar of a web browser: > http://emaildisclaimer.medtronic.com > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Tomcat jdbc connections
I have an issue with connections on Tomcat9 Oracle showing connections made for about 2seconds then dropped again. Is this normal when the server is not being used? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat 9 Encrpytion of JDBC
John, On 1/18/22 08:37, Orendt, John wrote: Secrets are more secure with the use of a Trusted Platform Module (TPM) and / or a Hardware Security Module (HSM). Secrets need to be protected both at rest and in transit. Sure. Where you put the password for the TPM or HSM? Or do you enter the password for your HSM/TPM every time you start a process that needs access to secrets? How do you handle unattended restarts? How do you handle massive deployments? Do you manually-enter a password on 1000 servers as they all launch together? On all these kinds of deployments, you usually use a key server. But then how do you authenticate to the key server? With another secret. It's secrets all the way down. At some point, you must trust something, and that something you trust can't be a human, because that doesn't scale or isn't practical for some other reason. I'd love to hear a practical solution to the "secret at rest" problem that actually makes some sense and doesn't just hand-wave the problem off to another component that is Somebody Else's Problem. -chris -Original Message- From: Alan F Sent: Friday, January 14, 2022 2:05 PM To: Tomcat Users List Subject: RE: Tomcat 9 Encrpytion of JDBC OK thanks Bill! -Original Message- From: Bill Stewart Sent: 14 January 2022 19:02 To: Tomcat Users List Subject: Re: Tomcat 9 Encrpytion of JDBC On Fri, Jan 14, 2022 at 10:25 AM Alan F wrote: Interested to know your best practices on securing jdbc plain text passwords, in my last place they used a mechanism to encrypt all passwords. Is this the best method as I read some people don't recommend this. Any details or procs on best practice appreciated. The "best practice," generally speaking, is that doing so is basically pointless from a security perspective. https://urldefense.com/v3/__https://cwiki.apache.org/confluence/display/TOMCAT/Password__;!!NFcUtLLUcw!Bhr3E8c3AZFikCj4AHarnHl2emUxh99SUwhynFa-FKWZahvlpv0TmiVo5DveVMgMyg3NbQ$ Bill [CONFIDENTIALITY AND PRIVACY NOTICE] Information transmitted by this email is proprietary to Medtronic and is intended for use only by the individual or entity to which it is addressed, and may contain information that is private, privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please delete this mail from your records. To view this notice in other languages you can either select the following link or manually copy and paste the link into the address bar of a web browser: http://emaildisclaimer.medtronic.com - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat 9 Encrpytion of JDBC
Hi All Secrets are more secure with the use of a Trusted Platform Module (TPM) and / or a Hardware Security Module (HSM). Secrets need to be protected both at rest and in transit. John Orendt john.p.ore...@medtronic.com -Original Message- From: Alan F Sent: Friday, January 14, 2022 2:05 PM To: Tomcat Users List Subject: RE: Tomcat 9 Encrpytion of JDBC OK thanks Bill! -Original Message- From: Bill Stewart Sent: 14 January 2022 19:02 To: Tomcat Users List Subject: Re: Tomcat 9 Encrpytion of JDBC On Fri, Jan 14, 2022 at 10:25 AM Alan F wrote: > Interested to know your best practices on securing jdbc plain text > passwords, in my last place they used a mechanism to encrypt all passwords. > Is this the best method as I read some people don't recommend this. > Any details or procs on best practice appreciated. > The "best practice," generally speaking, is that doing so is basically pointless from a security perspective. https://urldefense.com/v3/__https://cwiki.apache.org/confluence/display/TOMCAT/Password__;!!NFcUtLLUcw!Bhr3E8c3AZFikCj4AHarnHl2emUxh99SUwhynFa-FKWZahvlpv0TmiVo5DveVMgMyg3NbQ$ Bill [CONFIDENTIALITY AND PRIVACY NOTICE] Information transmitted by this email is proprietary to Medtronic and is intended for use only by the individual or entity to which it is addressed, and may contain information that is private, privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please delete this mail from your records. To view this notice in other languages you can either select the following link or manually copy and paste the link into the address bar of a web browser: http://emaildisclaimer.medtronic.com - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat 9 Encrpytion of JDBC
OK thanks Bill! -Original Message- From: Bill Stewart Sent: 14 January 2022 19:02 To: Tomcat Users List Subject: Re: Tomcat 9 Encrpytion of JDBC On Fri, Jan 14, 2022 at 10:25 AM Alan F wrote: > Interested to know your best practices on securing jdbc plain text > passwords, in my last place they used a mechanism to encrypt all passwords. > Is this the best method as I read some people don't recommend this. > Any details or procs on best practice appreciated. > The "best practice," generally speaking, is that doing so is basically pointless from a security perspective. https://cwiki.apache.org/confluence/display/TOMCAT/Password Bill
Re: Tomcat 9 Encrpytion of JDBC
On Fri, Jan 14, 2022 at 10:25 AM Alan F wrote: > Interested to know your best practices on securing jdbc plain text > passwords, in my last place they used a mechanism to encrypt all passwords. > Is this the best method as I read some people don't recommend this. Any > details or procs on best practice appreciated. > The "best practice," generally speaking, is that doing so is basically pointless from a security perspective. https://cwiki.apache.org/confluence/display/TOMCAT/Password Bill
Tomcat 9 Encrpytion of JDBC
All, Interested to know your best practices on securing jdbc plain text passwords, in my last place they used a mechanism to encrypt all passwords. Is this the best method as I read some people don't recommend this. Any details or procs on best practice appreciated. Thanks Ken - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Jdbc drivers not found on Tomcat 10
HI Christopher, not sure we are on the same page. The problem I encountered was that a Spring 6 war app with pg driver(42.3.1) could not deploy on Tomcat 10, but worked well when downupgraded to Spring 5/Tomcat 9. But on the jetty 11 and WildFly preview 26, Spring 6/pg war package are also working. I checked the source code of Spring DriverMangerDataSource, it will search the drivers when calling getConnection at the first time, the work is delegated to the underlay DriverManager class. There is a security check wrapping the operations, not sure this affects the actions on Tomcat 10. Regards, *Hantsy Bai* Self-employed consultant, fullstack developer, agile coach GitHub: https://github.com/hantsy Twitter: https://twitter.com/@hantsy Medium: https://medium.com/@hantsy On Fri, Jan 7, 2022 at 12:42 AM Christopher Schultz < ch...@christopherschultz.net> wrote: > Hantsy, > > On 1/5/22 23:31, hantsy bai wrote: > > I finally resolved this issue. Exclude the pg driver from war, and copy > it > > to tomcat/lib, it works. > > > > I remember in the past years, I preferred tomcat for Java Web > applications > > because I did not need to register a Jdbc driver but it is tedious work > in > > Java EE application servers, such as Glassfish, etc. But since Java EE 7, > > it supports packaging Jdbc drivers into war and register it automatically > > when deploying the application to the application servers. > > > > What happened in the tomcat classloader and war application classloader > of > > Tomcat 10? > > They still exist. The detailed answer to your question is on Stack > Overflow. What about that answer do you not understand? It explains what > you would need to do in order to get the driver to work when placed in > your WAR bundle. > > The problem is not Tomcat; the problem is the way that DriverManager > works, and Tomcat has no control over that. > > -chris > > > On Mon, Jan 3, 2022 at 12:02 PM hantsy bai wrote: > > > >> I have tried to update myself Spring 6/Jakarta EE9/Java 17, etc, and > >> created a simple war application, when deployed to Tomcat 10, failed, > due > >> to the famous *no suitable drivers*. > >> > >> I have created a detailed post on stackoverflow: > >> > >> > >> > https://stackoverflow.com/questions/70554119/no-suitable-drivers-available-when-deploying-a-spring-6-war-to-tomcat-10 > >> > >> Any suggestion is welcome. > >> Thanks. > >> > >> *Hantsy Bai* > >> > >> Self-employed consultant, fullstack developer, agile coach > >> > >> GitHub: https://github.com/hantsy > >> > >> Twitter: https://twitter.com/@hantsy > >> Medium: https://medium.com/@hantsy > >> > > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >
Re: Jdbc drivers not found on Tomcat 10
Hantsy, On 1/5/22 23:31, hantsy bai wrote: I finally resolved this issue. Exclude the pg driver from war, and copy it to tomcat/lib, it works. I remember in the past years, I preferred tomcat for Java Web applications because I did not need to register a Jdbc driver but it is tedious work in Java EE application servers, such as Glassfish, etc. But since Java EE 7, it supports packaging Jdbc drivers into war and register it automatically when deploying the application to the application servers. What happened in the tomcat classloader and war application classloader of Tomcat 10? They still exist. The detailed answer to your question is on Stack Overflow. What about that answer do you not understand? It explains what you would need to do in order to get the driver to work when placed in your WAR bundle. The problem is not Tomcat; the problem is the way that DriverManager works, and Tomcat has no control over that. -chris On Mon, Jan 3, 2022 at 12:02 PM hantsy bai wrote: I have tried to update myself Spring 6/Jakarta EE9/Java 17, etc, and created a simple war application, when deployed to Tomcat 10, failed, due to the famous *no suitable drivers*. I have created a detailed post on stackoverflow: https://stackoverflow.com/questions/70554119/no-suitable-drivers-available-when-deploying-a-spring-6-war-to-tomcat-10 Any suggestion is welcome. Thanks. *Hantsy Bai* Self-employed consultant, fullstack developer, agile coach GitHub: https://github.com/hantsy Twitter: https://twitter.com/@hantsy Medium: https://medium.com/@hantsy - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Jdbc drivers not found on Tomcat 10
I finally resolved this issue. Exclude the pg driver from war, and copy it to tomcat/lib, it works. I remember in the past years, I preferred tomcat for Java Web applications because I did not need to register a Jdbc driver but it is tedious work in Java EE application servers, such as Glassfish, etc. But since Java EE 7, it supports packaging Jdbc drivers into war and register it automatically when deploying the application to the application servers. What happened in the tomcat classloader and war application classloader of Tomcat 10? *Hantsy Bai* Self-employed consultant, fullstack developer, agile coach GitHub: https://github.com/hantsy Twitter: https://twitter.com/@hantsy Medium: https://medium.com/@hantsy On Mon, Jan 3, 2022 at 12:02 PM hantsy bai wrote: > I have tried to update myself Spring 6/Jakarta EE9/Java 17, etc, and > created a simple war application, when deployed to Tomcat 10, failed, due > to the famous *no suitable drivers*. > > I have created a detailed post on stackoverflow: > > > https://stackoverflow.com/questions/70554119/no-suitable-drivers-available-when-deploying-a-spring-6-war-to-tomcat-10 > > Any suggestion is welcome. > Thanks. > > *Hantsy Bai* > > Self-employed consultant, fullstack developer, agile coach > > GitHub: https://github.com/hantsy > > Twitter: https://twitter.com/@hantsy > Medium: https://medium.com/@hantsy >
Jdbc drivers not found on Tomcat 10
I have tried to update myself Spring 6/Jakarta EE9/Java 17, etc, and created a simple war application, when deployed to Tomcat 10, failed, due to the famous *no suitable drivers*. I have created a detailed post on stackoverflow: https://stackoverflow.com/questions/70554119/no-suitable-drivers-available-when-deploying-a-spring-6-war-to-tomcat-10 Any suggestion is welcome. Thanks. *Hantsy Bai* Self-employed consultant, fullstack developer, agile coach GitHub: https://github.com/hantsy Twitter: https://twitter.com/@hantsy Medium: https://medium.com/@hantsy
RE: Strange Oracle JDBC Driver error on Application Deployment
Thanks Mark E.! Dream * Excel * Explore * Inspire Jon McAlexander Infrastructure Engineer Asst Vice President Middleware Product Engineering Enterprise CIO | EAS | Middleware | Infrastructure Solutions 8080 Cobblestone Rd | Urbandale, IA 50322 MAC: F4469-010 Tel 515-988-2508 | Cell 515-988-2508 jonmcalexan...@wellsfargo.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. > -Original Message- > From: Mark Eggers > Sent: Tuesday, November 2, 2021 5:55 PM > To: users@tomcat.apache.org > Subject: Re: Strange Oracle JDBC Driver error on Application Deployment > > Jon, > > On 11/2/2021 3:26 PM, jonmcalexan...@wellsfargo.com.INVALID wrote: > > I have an application team that is getting the following stack trace while > starting Tomcat 8.5.70. I've done some searching but can't find anything. In > looking at their context.xml it appears that they have jmxEnabled="false" in > each of the resources. > > > > Any assistance would be grand. > > > > Thanks, > > > > Stack Trace > > > > 02-Nov-2021 13:01:45.809 SEVERE [localhost-startStop-1] > org.apache.tomcat.jdbc.pool.DataSource.registerJmx Unable to register > JDBC pool with JMX > > java.lang.NullPointerException > > at > org.apache.tomcat.jdbc.pool.DataSource.registerJmx(DataSource.java:129) > > at > org.apache.tomcat.jdbc.pool.DataSource.preRegister(DataSource.java:98) > > at > org.apache.tomcat.util.modeler.BaseModelMBean.preRegister(BaseModel > MBean.java:927) > > at > com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.preRegister(Defa > ultMBeanServerInterceptor.java:1007) > > at > com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamic > MBean(DefaultMBeanServerInterceptor.java:919) > > at > com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(De > faultMBeanServerInterceptor.java:900) > > at > com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(D > efaultMBeanServerInterceptor.java:324) > > at > com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanSer > ver.java:522) > > at > org.apache.tomcat.util.modeler.Registry.registerComponent(Registry.java:6 > 37) > > at > org.apache.catalina.core.NamingContextListener.addResource(NamingCont > extListener.java:1014) > > at > org.apache.catalina.core.NamingContextListener.createNamingContext(Na > mingContextListener.java:552) > > at > org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingCont > extListener.java:245) > > at > org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:1 > 23) > > at > org.apache.catalina.core.StandardContext.startInternal(StandardContext.jav > a:5130) > > at > org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) > > at > org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java > :753) > > at > org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:727) > > at > org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695) > > at > org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1016) > > at > org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1903 > ) > > at > java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) > > at > java.util.concurrent.FutureTask.run(FutureTask.java:266) > > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.jav > a:1149) > > at &
RE: Strange Oracle JDBC Driver error on Application Deployment
Hmmm...strange. I've gone thru their configuration and modified it to match up with our strategy of using separate HOME and BASE locations. I've had them get rid of duplicate jar files from BASE that are in HOME. Only 1-off is the Oracle JDBC jar. I do need to see if they have "cleared cache" and then startup clean to see if there is something stashed in work. Thanks for the info, I'll keep digging in with them. Dream * Excel * Explore * Inspire Jon McAlexander Infrastructure Engineer Asst Vice President Middleware Product Engineering Enterprise CIO | EAS | Middleware | Infrastructure Solutions 8080 Cobblestone Rd | Urbandale, IA 50322 MAC: F4469-010 Tel 515-988-2508 | Cell 515-988-2508 jonmcalexan...@wellsfargo.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation. > -Original Message- > From: Mark Thomas > Sent: Wednesday, November 3, 2021 3:00 AM > To: users@tomcat.apache.org > Subject: Re: Strange Oracle JDBC Driver error on Application Deployment > > On 02/11/2021 22:26, jonmcalexan...@wellsfargo.com.INVALID wrote: > > I have an application team that is getting the following stack trace while > starting Tomcat 8.5.70. I've done some searching but can't find anything. In > looking at their context.xml it appears that they have jmxEnabled="false" in > each of the resources. > > Jon, > > The line numbers listed in the stack trace aren't consistent with the version > number quoted above. I've tried stepping back through old 8.5.x versions > and I can't find a match unless I go back 10 years (before Tomcat 8.5.x and > even 8.0.x existed). > > It looks like you are seeing this issue: > https://urldefense.com/v3/__https://bz.apache.org/bugzilla/show_bug.cgi? > id=54194__;!!F9svGWnIaVPGSwU!6k1ftwyDgYK6qpbm3iwHXp5P_Q0rgz_ZO > pjJJoDVGQMBXS5ELDnmXD1Mo0GiFpB48176YTE$ > > Possible explanations: > > - the application is packaged with a (very) old version of Tomcat's >jdbc-pool and is using that rather than the version provided by Tomcat > > - The Tomcat instances are running a much older Tomcat version than >8.5.70 > > - The Tomcat instances are using some form of custom patch > > - Something else. > > HTH, > > Mark > > > > > Any assistance would be grand. > > > > Thanks, > > > > ==== Stack Trace > > > > 02-Nov-2021 13:01:45.809 SEVERE [localhost-startStop-1] > org.apache.tomcat.jdbc.pool.DataSource.registerJmx Unable to register > JDBC pool with JMX > > java.lang.NullPointerException > > at > org.apache.tomcat.jdbc.pool.DataSource.registerJmx(DataSource.java:129) > > at > org.apache.tomcat.jdbc.pool.DataSource.preRegister(DataSource.java:98) > > at > org.apache.tomcat.util.modeler.BaseModelMBean.preRegister(BaseModel > MBean.java:927) > > at > com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.preRegister(Defa > ultMBeanServerInterceptor.java:1007) > > at > com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamic > MBean(DefaultMBeanServerInterceptor.java:919) > > at > com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(De > faultMBeanServerInterceptor.java:900) > > at > com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(D > efaultMBeanServerInterceptor.java:324) > > at > com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanSer > ver.java:522) > > at > org.apache.tomcat.util.modeler.Registry.registerComponent(Registry.java:6 > 37) > > at > org.apache.catalina.core.NamingContextListener.addResource(NamingCont > extListener.java:1014) > > at > org.apache.catalina.core.NamingContextListener.createNamingContext(Na > mingContextListener.java:552) > > at > org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingCont > extListener.java:245) > > at > org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:1 > 23) > >
Re: Strange Oracle JDBC Driver error on Application Deployment
On 02/11/2021 22:26, jonmcalexan...@wellsfargo.com.INVALID wrote: I have an application team that is getting the following stack trace while starting Tomcat 8.5.70. I've done some searching but can't find anything. In looking at their context.xml it appears that they have jmxEnabled="false" in each of the resources. Jon, The line numbers listed in the stack trace aren't consistent with the version number quoted above. I've tried stepping back through old 8.5.x versions and I can't find a match unless I go back 10 years (before Tomcat 8.5.x and even 8.0.x existed). It looks like you are seeing this issue: https://bz.apache.org/bugzilla/show_bug.cgi?id=54194 Possible explanations: - the application is packaged with a (very) old version of Tomcat's jdbc-pool and is using that rather than the version provided by Tomcat - The Tomcat instances are running a much older Tomcat version than 8.5.70 - The Tomcat instances are using some form of custom patch - Something else. HTH, Mark Any assistance would be grand. Thanks, Stack Trace 02-Nov-2021 13:01:45.809 SEVERE [localhost-startStop-1] org.apache.tomcat.jdbc.pool.DataSource.registerJmx Unable to register JDBC pool with JMX java.lang.NullPointerException at org.apache.tomcat.jdbc.pool.DataSource.registerJmx(DataSource.java:129) at org.apache.tomcat.jdbc.pool.DataSource.preRegister(DataSource.java:98) at org.apache.tomcat.util.modeler.BaseModelMBean.preRegister(BaseModelMBean.java:927) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.preRegister(DefaultMBeanServerInterceptor.java:1007) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:919) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324) at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522) at org.apache.tomcat.util.modeler.Registry.registerComponent(Registry.java:637) at org.apache.catalina.core.NamingContextListener.addResource(NamingContextListener.java:1014) at org.apache.catalina.core.NamingContextListener.createNamingContext(NamingContextListener.java:552) at org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingContextListener.java:245) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5130) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:727) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1016) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1903) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) 02-Nov-2021 13:01:46.066 SEVERE [localhost-startStop-1] org.apache.tomcat.jdbc.pool.DataSource.registerJmx Unable to register JDBC pool with JMX java.lang.NullPointerException at org.apache.tomcat.jdbc.pool.DataSource.registerJmx(DataSource.java:129) at org.apache.tomcat.jdbc.pool.DataSource.preRegister(DataSource.java:98) at org.apache.tomcat.util.modeler.BaseModelMBean.preRegister(BaseModelMBean.java:927) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.preRegister(DefaultMBeanServerInterceptor
Re: Strange Oracle JDBC Driver error on Application Deployment
Jon, On 11/2/2021 3:26 PM, jonmcalexan...@wellsfargo.com.INVALID wrote: I have an application team that is getting the following stack trace while starting Tomcat 8.5.70. I've done some searching but can't find anything. In looking at their context.xml it appears that they have jmxEnabled="false" in each of the resources. Any assistance would be grand. Thanks, Stack Trace 02-Nov-2021 13:01:45.809 SEVERE [localhost-startStop-1] org.apache.tomcat.jdbc.pool.DataSource.registerJmx Unable to register JDBC pool with JMX java.lang.NullPointerException at org.apache.tomcat.jdbc.pool.DataSource.registerJmx(DataSource.java:129) at org.apache.tomcat.jdbc.pool.DataSource.preRegister(DataSource.java:98) at org.apache.tomcat.util.modeler.BaseModelMBean.preRegister(BaseModelMBean.java:927) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.preRegister(DefaultMBeanServerInterceptor.java:1007) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:919) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324) at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522) at org.apache.tomcat.util.modeler.Registry.registerComponent(Registry.java:637) at org.apache.catalina.core.NamingContextListener.addResource(NamingContextListener.java:1014) at org.apache.catalina.core.NamingContextListener.createNamingContext(NamingContextListener.java:552) at org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingContextListener.java:245) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5130) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:727) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1016) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1903) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) 02-Nov-2021 13:01:46.066 SEVERE [localhost-startStop-1] org.apache.tomcat.jdbc.pool.DataSource.registerJmx Unable to register JDBC pool with JMX java.lang.NullPointerException at org.apache.tomcat.jdbc.pool.DataSource.registerJmx(DataSource.java:129) at org.apache.tomcat.jdbc.pool.DataSource.preRegister(DataSource.java:98) at org.apache.tomcat.util.modeler.BaseModelMBean.preRegister(BaseModelMBean.java:927) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.preRegister(DefaultMBeanServerInterceptor.java:1007) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:919) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324) at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522) at org.apache.tomcat.util.modeler.Registry.registerComponent(Registr
Strange Oracle JDBC Driver error on Application Deployment
I have an application team that is getting the following stack trace while starting Tomcat 8.5.70. I've done some searching but can't find anything. In looking at their context.xml it appears that they have jmxEnabled="false" in each of the resources. Any assistance would be grand. Thanks, Stack Trace 02-Nov-2021 13:01:45.809 SEVERE [localhost-startStop-1] org.apache.tomcat.jdbc.pool.DataSource.registerJmx Unable to register JDBC pool with JMX java.lang.NullPointerException at org.apache.tomcat.jdbc.pool.DataSource.registerJmx(DataSource.java:129) at org.apache.tomcat.jdbc.pool.DataSource.preRegister(DataSource.java:98) at org.apache.tomcat.util.modeler.BaseModelMBean.preRegister(BaseModelMBean.java:927) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.preRegister(DefaultMBeanServerInterceptor.java:1007) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:919) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324) at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522) at org.apache.tomcat.util.modeler.Registry.registerComponent(Registry.java:637) at org.apache.catalina.core.NamingContextListener.addResource(NamingContextListener.java:1014) at org.apache.catalina.core.NamingContextListener.createNamingContext(NamingContextListener.java:552) at org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingContextListener.java:245) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5130) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:727) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1016) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1903) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) 02-Nov-2021 13:01:46.066 SEVERE [localhost-startStop-1] org.apache.tomcat.jdbc.pool.DataSource.registerJmx Unable to register JDBC pool with JMX java.lang.NullPointerException at org.apache.tomcat.jdbc.pool.DataSource.registerJmx(DataSource.java:129) at org.apache.tomcat.jdbc.pool.DataSource.preRegister(DataSource.java:98) at org.apache.tomcat.util.modeler.BaseModelMBean.preRegister(BaseModelMBean.java:927) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.preRegister(DefaultMBeanServerInterceptor.java:1007) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:919) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324) at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522) at org.apache.tomcat.util.modeler.Registry.registerComponent(Registry.java:637) at org.apache.catalina.core.NamingContextListener.addResource(NamingContextListener
RE: Tomcat 9.0.x JDBC connection pool does not always remove abandoned connections
Chris, really appreciate you taking some time to respond. See my replies inline below. > -Original Message- > From: Christopher Schultz > Sent: Thursday, October 14, 2021 12:19 PM > To: users@tomcat.apache.org > Subject: Re: Tomcat 9.0.x JDBC connection pool does not always remove > abandoned connections > > Gerhardt, > > On 10/12/21 13:27, Martin, Gerhardt A wrote: > > Running Tomcat 9.0.50 on Centos 7.9.x Linux and using Tomcat JDBC > connection pool to connect to my application's databases. My app connects to > about a dozen read only databases and one read/write database. Here is a > typical resource definition with tuning configurations for the pool and the > MSSQL server JDBC driver: > > > > > Note that these are the only relevant attributes: > > > factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" > > You are using tomcat-pool, not the default commons-dbcp. 100% aware of this and we plan to continue to use it. > > > maxActive="20" > > initialSize="1" > > maxIdle="8" > > minIdle="1" > > maxWait="5000" > > testOnBorrow="false" > > testWhileIdle="false" > > testOnConnect="false" > > testOnReturn="false" > > timeBetweenEvictionRunsMillis="1" > > removeAbandonedTimeout="15" > > removeAbandoned="true" > > logAbandoned="false" > > minEvictableIdleTimeMillis="90" > > maxAge="60" > > > > > Important NOTE: the framework we employ does NOT execute more than one > > SQL statement per borrow from the connection pool. It's a constant > > cycle of getConnection(borrow) ->execute 1 > > SQL->closeConnection(return) > > That's kind of wasteful, but okay. I agree to some extent, but we have had stable success with this inherited approach. Tough to change this in our current situation but I have had thoughts about it. > > > Why are we configured this way: > > Ultimately we need to fail fast to avoid our APP going into death by stuck > threads when we lose connectivity to the backend databases for a short period > of time. ( for example a short 10 second period where the DB(s) is/are > unreachable from the app servers). > > Is this common? Not common, but when it occurs it is very disruptive to our customer base, hence the need to improve resiliency. > > > -We want the evictor thread (Pool Cleaner) to run every 10 seconds -We > > are only using the Pool Cleaner to clobber busy connections that have been > running 15 seconds or more > >NOTE: we rarely see SQL that takes longer than 2 seconds, most are > > sub 100ms and the avg is about 4ms > > Note that the connections aren't clobbered; they are simply dropped from the > pool. The work they generated is still continuing... > > > -We are not testing connections period -We want our connections > > replaced with new fresh connections after 10 mins of use hence we set > > maxAge=60 The connection pool settings work hand in hand with > properties set on the SQL server JDBC driver in the URL: > > The driver will kill any SQL that takes longer than 10 seconds > > Ouch. > > > -When everything else is OK, then the connection itself is returned > > intact back to the connection pool -When the DB is unreachable, there > > is another timer cancelQueryTimeout set to 10 seconds which is a safety > > valve > for cases where the message to the DB server to cancel the SQL gracefully does > not make it to the DB. After the cancleQueryTimeout, the client side of the > driver gives up. This is problematic because it actually returns a bad > connection > back to the connection pool. > > > > The combination of the connection pool settings to run the Pool cleaner > > every > 10 seconds and removeAbandoned of 15 seconds should work together to > remove any connection whose SQL execution time went past 10 seconds before > the cancelQueryTimeout kicks in. This should prevent returning bad connections > to the pool when bad things happen like a network switch going offline > temporarily and dropping all packets between the app server hosting tomcat and > the database server. > > Sounds like you really just want to be validating connections, but you have > explicitly disabled that feature. Why? So we have a fairly high volume of SQL in our APPs and given our current borrow->execute SQL-> return situation, test on borrow or return doubles the number of SQL statements we run even if one of them is "SELECT 1". Our DBAs are not keen on this. Also there is
Re: Tomcat 9.0.x JDBC connection pool does not always remove abandoned connections
Gerhardt, On 10/12/21 13:27, Martin, Gerhardt A wrote: Running Tomcat 9.0.50 on Centos 7.9.x Linux and using Tomcat JDBC connection pool to connect to my application's databases. My app connects to about a dozen read only databases and one read/write database. Here is a typical resource definition with tuning configurations for the pool and the MSSQL server JDBC driver: Note that these are the only relevant attributes: > factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" You are using tomcat-pool, not the default commons-dbcp. maxActive="20" initialSize="1" maxIdle="8" minIdle="1" maxWait="5000" testOnBorrow="false" testWhileIdle="false" testOnConnect="false" testOnReturn="false" timeBetweenEvictionRunsMillis="1" removeAbandonedTimeout="15" removeAbandoned="true" logAbandoned="false" minEvictableIdleTimeMillis="90" maxAge="60" Important NOTE: the framework we employ does NOT execute more than one SQL statement per borrow from the connection pool. It's a constant cycle of getConnection(borrow) ->execute 1 SQL->closeConnection(return) That's kind of wasteful, but okay. Why are we configured this way: Ultimately we need to fail fast to avoid our APP going into death by stuck threads when we lose connectivity to the backend databases for a short period of time. ( for example a short 10 second period where the DB(s) is/are unreachable from the app servers). Is this common? -We want the evictor thread (Pool Cleaner) to run every 10 seconds -We are only using the Pool Cleaner to clobber busy connections that have been running 15 seconds or more NOTE: we rarely see SQL that takes longer than 2 seconds, most are sub 100ms and the avg is about 4ms Note that the connections aren't clobbered; they are simply dropped from the pool. The work they generated is still continuing... -We are not testing connections period -We want our connections replaced with new fresh connections after 10 mins of use hence we set maxAge=60 The connection pool settings work hand in hand with properties set on the SQL server JDBC driver in the URL: The driver will kill any SQL that takes longer than 10 seconds Ouch. -When everything else is OK, then the connection itself is returned intact back to the connection pool -When the DB is unreachable, there is another timer cancelQueryTimeout set to 10 seconds which is a safety valve for cases where the message to the DB server to cancel the SQL gracefully does not make it to the DB. After the cancleQueryTimeout, the client side of the driver gives up. This is problematic because it actually returns a bad connection back to the connection pool. The combination of the connection pool settings to run the Pool cleaner every 10 seconds and removeAbandoned of 15 seconds should work together to remove any connection whose SQL execution time went past 10 seconds before the cancelQueryTimeout kicks in. This should prevent returning bad connections to the pool when bad things happen like a network switch going offline temporarily and dropping all packets between the app server hosting tomcat and the database server. Sounds like you really just want to be validating connections, but you have explicitly disabled that feature. Why? NOTE that for the MSSQL server driver all their timeouts default to wait indefinitely. This is one of the prime reasons why even short outages can kill our APP with stuck threads. Our Web app hits tomcat about 2000 requests per minute and each request is going to fire on AVG ~6 SQL statements so we are running about 12K SQL hits per minute. If we lose connectivity to a database for even 15 seconds without a means to fail fast we could easily overcome the allotted number of threads which will create a "log jam" that can take a very long time to recover. Why doesn't your query-timeout handle this situation? So I am very sorry for all this lenghty background but I thought it might help for readers and potential responders to know a bit about why we do what we do in our connection pool. Finally now onto the problem: I was running a load test and simulating the temporary loss of connectivity to one or more of the databases used in the APP and I noticed a strange behavior that does not align with my understanding of how Tomcat JDBC removeAbandoned works. While most of my database connections coming from the pool did die shortly after the simulation started and "failed fast" there were a few connections that actually ran for up to 5 minutes before they terminated themselves. Given the configuration I explained I would have expected no database connection that was interacting with the database to live beyond 30 seconds. ( giving that there could be some forward/reverse lag in the evictor t
Tomcat 9.0.x JDBC connection pool does not always remove abandoned connections
Running Tomcat 9.0.50 on Centos 7.9.x Linux and using Tomcat JDBC connection pool to connect to my application's databases. My app connects to about a dozen read only databases and one read/write database. Here is a typical resource definition with tuning configurations for the pool and the MSSQL server JDBC driver: Important NOTE: the framework we employ does NOT execute more than one SQL statement per borrow from the connection pool. It's a constant cycle of getConnection(borrow) ->execute 1 SQL->closeConnection(return) Why are we configured this way: Ultimately we need to fail fast to avoid our APP going into death by stuck threads when we lose connectivity to the backend databases for a short period of time. ( for example a short 10 second period where the DB(s) is/are unreachable from the app servers). -We want the evictor thread (Pool Cleaner) to run every 10 seconds -We are only using the Pool Cleaner to clobber busy connections that have been running 15 seconds or more NOTE: we rarely see SQL that takes longer than 2 seconds, most are sub 100ms and the avg is about 4ms -We are not testing connections period -We want our connections replaced with new fresh connections after 10 mins of use hence we set maxAge=60 The connection pool settings work hand in hand with properties set on the SQL server JDBC driver in the URL: The driver will kill any SQL that takes longer than 10 seconds -When everything else is OK, then the connection itself is returned intact back to the connection pool -When the DB is unreachable, there is another timer cancelQueryTimeout set to 10 seconds which is a safety valve for cases where the message to the DB server to cancel the SQL gracefully does not make it to the DB. After the cancleQueryTimeout, the client side of the driver gives up. This is problematic because it actually returns a bad connection back to the connection pool. The combination of the connection pool settings to run the Pool cleaner every 10 seconds and removeAbandoned of 15 seconds should work together to remove any connection whose SQL execution time went past 10 seconds before the cancelQueryTimeout kicks in. This should prevent returning bad connections to the pool when bad things happen like a network switch going offline temporarily and dropping all packets between the app server hosting tomcat and the database server. NOTE that for the MSSQL server driver all their timeouts default to wait indefinitely. This is one of the prime reasons why even short outages can kill our APP with stuck threads. Our Web app hits tomcat about 2000 requests per minute and each request is going to fire on AVG ~6 SQL statements so we are running about 12K SQL hits per minute. If we lose connectivity to a database for even 15 seconds without a means to fail fast we could easily overcome the allotted number of threads which will create a "log jam" that can take a very long time to recover. So I am very sorry for all this lenghty background but I thought it might help for readers and potential responders to know a bit about why we do what we do in our connection pool. Finally now onto the problem: I was running a load test and simulating the temporary loss of connectivity to one or more of the databases used in the APP and I noticed a strange behavior that does not align with my understanding of how Tomcat JDBC removeAbandoned works. While most of my database connections coming from the pool did die shortly after the simulation started and "failed fast" there were a few connections that actually ran for up to 5 minutes before they terminated themselves. Given the configuration I explained I would have expected no database connection that was interacting with the database to live beyond 30 seconds. ( giving that there could be some forward/reverse lag in the evictor thread timing where there could be a slight chance that the first run of the evictor thread might not catch every connection that was at the 15 seconds mark.) What I believe I saw in some cases was that the socket timeout that I set on the SQLServer JDBC driver for 300,000ms (5 mins) kicked in and read timeout was generated in the driver. This lead to a bad connection being returned to the connection pool and caused errors until the connection(s) aged out due to maxAge. Does anyone know why the Pool Cleaner would be able to run and NOT forcefully remove a connection from the tomcat JDBC pool that has been running more than configured removeAbandonedTimeout? I searched google and this list on MARC for any clues and I found nothing. I also reviewed the source code for the Tomcat JDBC module and was unable to see a place in the code that indicated it would not be able to clobber a running connection that was borrowed from the pool. Anyone able to help me understand what I saw in my testing? Could this be a Tomcat connection pool bug? -Rega
AW: Calculate time to get a connection from JDBC Pool
Hello, are you using a Datasource, accessed via JNDI-Lookup? Is the task to measure the call DataSource.getConnection()? Or do you want to measure some calls within "getConnection"? Maybe a Java agent can be useful to measure method calls. Usually the borrowing process itself is not a time consuming operation. If the pool is not properly sized and new connections must be established, that will cause lags and issues. Greetings, Thomas Von: Lasantha Samarakoon Gesendet: Sonntag, 12. September 2021 20:30 An: Tomcat Users List Betreff: Re: Calculate time to get a connection from JDBC Pool Hi John, Thanks for your suggestion on the JMX approach. But as per my requirement, using JMX to get the connection time will not be a viable solution. My exact requirement is to log down individual connection establishment time for each JDBC connection which is related to specific message flow. So in this case, we won't be able to open up JMX (due to security concerns), and also we will not be able to track down each JDBC connection object and get the individual connection establishment time. Thanks & Regards, *Lasantha Samarakoon* M: +94 (71) 214 1576 | E: lasn1...@gmail.com On Tue, Sep 7, 2021 at 7:34 PM wrote: > Lasantha, > > > > -Original Message- > > From: Lasantha Samarakoon > > Sent: Monday, September 06, 2021 10:22 PM > > To: users@tomcat.apache.org > > Subject: Calculate time to get a connection from JDBC Pool > > > > Hi all, > > > > I am working on Tomcat JDBC Pools and I have a requirement that needs to > > calculate the total time it takes to get a connection from the JDBC pool. > > This is to cover the entire connection borrowing process (includes > connection > > creation, setting up, validation, etc). The Tomcat version we are using > is > > 9.0.34. > > > > I tried playing around with the interceptors and also walked through the > > respective implementation of Tomcat[1], but couldn't find any extensible > > code segment to catch the before and after points of the get connection > > flow. > > > > Appreciate your input on any possible solution for this. > > > > [1] > > https://urldefense.com/v3/__https://github.com/apache/tomcat/tree/9.0.3 > > 4/modules/jdbc-pool__;!!F9svGWnIaVPGSwU!6_tpBtEDTx2wg- > > 2SBU2URViWoyhQPdrSNgVO7dErbhcA1-gh-KL_EtXutKh78PSXUt86mkU$ > > > > TIA, > > Lasantha > > I don't have an example on hand, but it looks like there is an MBean with > the property meanBorrowWaitTimeMillis. Enable JMX like this: > > https://tomcat.apache.org/tomcat-9.0-doc/jdbc-pool.html#JMX > > > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Calculate time to get a connection from JDBC Pool
Hi John, Thanks for your suggestion on the JMX approach. But as per my requirement, using JMX to get the connection time will not be a viable solution. My exact requirement is to log down individual connection establishment time for each JDBC connection which is related to specific message flow. So in this case, we won't be able to open up JMX (due to security concerns), and also we will not be able to track down each JDBC connection object and get the individual connection establishment time. Thanks & Regards, *Lasantha Samarakoon* M: +94 (71) 214 1576 | E: lasn1...@gmail.com On Tue, Sep 7, 2021 at 7:34 PM wrote: > Lasantha, > > > > -Original Message- > > From: Lasantha Samarakoon > > Sent: Monday, September 06, 2021 10:22 PM > > To: users@tomcat.apache.org > > Subject: Calculate time to get a connection from JDBC Pool > > > > Hi all, > > > > I am working on Tomcat JDBC Pools and I have a requirement that needs to > > calculate the total time it takes to get a connection from the JDBC pool. > > This is to cover the entire connection borrowing process (includes > connection > > creation, setting up, validation, etc). The Tomcat version we are using > is > > 9.0.34. > > > > I tried playing around with the interceptors and also walked through the > > respective implementation of Tomcat[1], but couldn't find any extensible > > code segment to catch the before and after points of the get connection > > flow. > > > > Appreciate your input on any possible solution for this. > > > > [1] > > https://urldefense.com/v3/__https://github.com/apache/tomcat/tree/9.0.3 > > 4/modules/jdbc-pool__;!!F9svGWnIaVPGSwU!6_tpBtEDTx2wg- > > 2SBU2URViWoyhQPdrSNgVO7dErbhcA1-gh-KL_EtXutKh78PSXUt86mkU$ > > > > TIA, > > Lasantha > > I don't have an example on hand, but it looks like there is an MBean with > the property meanBorrowWaitTimeMillis. Enable JMX like this: > > https://tomcat.apache.org/tomcat-9.0-doc/jdbc-pool.html#JMX > > >
RE: Calculate time to get a connection from JDBC Pool
Lasantha, > -Original Message- > From: Lasantha Samarakoon > Sent: Monday, September 06, 2021 10:22 PM > To: users@tomcat.apache.org > Subject: Calculate time to get a connection from JDBC Pool > > Hi all, > > I am working on Tomcat JDBC Pools and I have a requirement that needs to > calculate the total time it takes to get a connection from the JDBC pool. > This is to cover the entire connection borrowing process (includes connection > creation, setting up, validation, etc). The Tomcat version we are using is > 9.0.34. > > I tried playing around with the interceptors and also walked through the > respective implementation of Tomcat[1], but couldn't find any extensible > code segment to catch the before and after points of the get connection > flow. > > Appreciate your input on any possible solution for this. > > [1] > https://urldefense.com/v3/__https://github.com/apache/tomcat/tree/9.0.3 > 4/modules/jdbc-pool__;!!F9svGWnIaVPGSwU!6_tpBtEDTx2wg- > 2SBU2URViWoyhQPdrSNgVO7dErbhcA1-gh-KL_EtXutKh78PSXUt86mkU$ > > TIA, > Lasantha I don't have an example on hand, but it looks like there is an MBean with the property meanBorrowWaitTimeMillis. Enable JMX like this: https://tomcat.apache.org/tomcat-9.0-doc/jdbc-pool.html#JMX
Calculate time to get a connection from JDBC Pool
Hi all, I am working on Tomcat JDBC Pools and I have a requirement that needs to calculate the total time it takes to get a connection from the JDBC pool. This is to cover the entire connection borrowing process (includes connection creation, setting up, validation, etc). The Tomcat version we are using is 9.0.34. I tried playing around with the interceptors and also walked through the respective implementation of Tomcat[1], but couldn't find any extensible code segment to catch the before and after points of the get connection flow. Appreciate your input on any possible solution for this. [1] https://github.com/apache/tomcat/tree/9.0.34/modules/jdbc-pool TIA, Lasantha
Re: Clarification on behaviour after pool exhaustion happen in tomcat jdbc pool 9.0.16
Sampath, On 8/12/21 07:02, Sampath Rajapakshe wrote: Hi Chris, Thanks for the detailed explanation, yes, we tried with abandoned true logs and found an issue with our code base as well. It seems we had a case where a single thread creates a new connection and before closing that connection creates a new connection and closes that new connection and then afterwards closes the initial connection. So in a scenario where a huge traffic goes through the same logic path pool gets exhausted due to all threads waiting to create another connection before closing their initial connection. After fixing that issue, now the system runs without pool exhaustion. So thank you very much for your explanations. Yes, this is item #1 in my (ancient!) blog post's "general tips" section: 1. In development, set your connection pool to a fixed size of 1 connection. [...] If you had set you pool size to "exactly 1" in development, you would have caught this problem long ago. -chris On Wed, Aug 11, 2021 at 7:25 PM Christopher Schultz < ch...@christopherschultz.net> wrote: Sampath, On 8/9/21 01:45, Sampath Rajapakshe wrote: In our case, we know the reason for the pool exhausted behaviour, there are slow queries and also due to high TPS where pool is not enough. So we are expected to get pool exhaustion with current configurations. Ok. What we wanted to verify was the behaviour after pool exhaustion. Do the current executing connections continue their executions during pool exhausted duration? I would not expect the connection pool to actively kill connections unless explicitly configured to do so. Usually, connections that are "orphaned" will stay that way, "just in case". If you aren't seeing exceptions being thrown due to "connection is closed" or some such thing, you are probably okay as far as the long-running queries are concerned. Do you know in advance which queries will take a "long time"? Perhaps you'd like to use a different connection pool for those long-running queries -- one where the timeout is significantly higher. As per our observations, they do not, and connections are stuck without executing any queries until maxWait. is that the expected behaviour after pool exhaustion? Let's be clear what we mean when we say "connection". The only "connection" here that is relevant is the "connection to the database." It sounds like you mean "incoming HTTP connection" whose thread will stall if a DB connection is not immediately available from the pool. That may be true, but the "(HTTP) connection" isn't waiting for a DB connection; the request-processing thread is waiting for a DB connection. Do you mean "behavior of connections checked-out and used long-term" or do you mean "behavior of the pool when all connections are checked-out and we need a NEW one?" I assume the second question is what you are asking. When all the connections are being used, the pool usually stalls, meaning that your code will just sit there a wait (possibly forever) for a connection. To fix that, you'd have to adjust the configuration of the pool (e.g. add more possible connections, increase maxWait to avoid errors). You can also usually configure the pool to allow connections which are checked-out and not returned after a certain period of time ("abandoned" to use the Commons-Pool terminology) to be allowed to "leak" and replenish the pool. You didn't say which pool you were using, so I will assume you are using the default DB connection pool based upon Apache commons-dbcp2. Here is the documentation for that pool; you can use these configuration settings on your element in your web application's META-INF/context.xml file: https://commons.apache.org/proper/commons-dbcp/configuration.html I recommend looking at the "abandoned"-related configuration options. -chris On Sat, Aug 7, 2021 at 3:43 AM Christopher Schultz < ch...@christopherschultz.net> wrote: Sampath, On 8/6/21 08:37, Sampath Rajapakshe wrote: Hi All, In my local setup before pool exhaustion exception is thrown, all the connections seem to be in freezed and when checking processList in mysql, those connections are in sleep state and doesn't execute any queries. After waiting for maxWait period the pool exhausted exception gets thrown and seems to reset the connections and then the queries are getting processed as normally. > So, my question is, with pool exhausted scenarios, doesn't existing connections execute their queries during that time(maxWait) and try to resolve the exhausted behaviour by releasing those connections to idle queue automatically? When checking the JMX matrix during this pool exhausted time all the connections are in the active queue. https://blog.christopherschultz.net/2009/03/16/properly-handling-pooled-jdbc-connections/ If not, what
Re: Clarification on behaviour after pool exhaustion happen in tomcat jdbc pool 9.0.16
Hi Chris, Thanks for the detailed explanation, yes, we tried with abandoned true logs and found an issue with our code base as well. It seems we had a case where a single thread creates a new connection and before closing that connection creates a new connection and closes that new connection and then afterwards closes the initial connection. So in a scenario where a huge traffic goes through the same logic path pool gets exhausted due to all threads waiting to create another connection before closing their initial connection. After fixing that issue, now the system runs without pool exhaustion. So thank you very much for your explanations. Thanks and Regards, Sampath On Wed, Aug 11, 2021 at 7:25 PM Christopher Schultz < ch...@christopherschultz.net> wrote: > Sampath, > > On 8/9/21 01:45, Sampath Rajapakshe wrote: > > In our case, we know the reason for the pool exhausted behaviour, > > there are slow queries and also due to high TPS where pool is not > > enough. So we are expected to get pool exhaustion with current > > configurations. > Ok. > > > What we wanted to verify was the behaviour after pool exhaustion. Do > > the current executing connections continue their executions during > > pool exhausted duration? > I would not expect the connection pool to actively kill connections > unless explicitly configured to do so. Usually, connections that are > "orphaned" will stay that way, "just in case". If you aren't seeing > exceptions being thrown due to "connection is closed" or some such > thing, you are probably okay as far as the long-running queries are > concerned. > > Do you know in advance which queries will take a "long time"? Perhaps > you'd like to use a different connection pool for those long-running > queries -- one where the timeout is significantly higher. > > > As per our observations, they do not, and connections are stuck > > without executing any queries until maxWait. is that the expected > > behaviour after pool exhaustion? > Let's be clear what we mean when we say "connection". The only > "connection" here that is relevant is the "connection to the database." > It sounds like you mean "incoming HTTP connection" whose thread will > stall if a DB connection is not immediately available from the pool. > That may be true, but the "(HTTP) connection" isn't waiting for a DB > connection; the request-processing thread is waiting for a DB connection. > > Do you mean "behavior of connections checked-out and used long-term" or > do you mean "behavior of the pool when all connections are checked-out > and we need a NEW one?" > > I assume the second question is what you are asking. > > When all the connections are being used, the pool usually stalls, > meaning that your code will just sit there a wait (possibly forever) for > a connection. To fix that, you'd have to adjust the configuration of the > pool (e.g. add more possible connections, increase maxWait to avoid > errors). You can also usually configure the pool to allow connections > which are checked-out and not returned after a certain period of time > ("abandoned" to use the Commons-Pool terminology) to be allowed to > "leak" and replenish the pool. > > You didn't say which pool you were using, so I will assume you are using > the default DB connection pool based upon Apache commons-dbcp2. Here is > the documentation for that pool; you can use these configuration > settings on your element in your web application's > META-INF/context.xml file: > > https://commons.apache.org/proper/commons-dbcp/configuration.html > > I recommend looking at the "abandoned"-related configuration options. > > -chris > > > On Sat, Aug 7, 2021 at 3:43 AM Christopher Schultz < > > ch...@christopherschultz.net> wrote: > > > >> Sampath, > >> > >> On 8/6/21 08:37, Sampath Rajapakshe wrote: > >>> Hi All, > >>> > >>> In my local setup before pool exhaustion exception is thrown, all the > >>> connections seem to be in freezed and when checking processList in > mysql, > >>> those connections are in sleep state and doesn't execute any queries. > >> After > >>> waiting for maxWait period the pool exhausted exception gets thrown and > >>> seems to reset the connections and then the queries are getting > processed > >>> as normally. > >> > > >>> So, my question is, with pool exhausted scenarios, doesn't existing > >>> connections execute their queries during that time(maxWait) and try to > >>> resolve the
Re: Clarification on behaviour after pool exhaustion happen in tomcat jdbc pool 9.0.16
Sampath, On 8/9/21 01:45, Sampath Rajapakshe wrote: In our case, we know the reason for the pool exhausted behaviour, there are slow queries and also due to high TPS where pool is not enough. So we are expected to get pool exhaustion with current configurations. Ok. What we wanted to verify was the behaviour after pool exhaustion. Do the current executing connections continue their executions during pool exhausted duration? I would not expect the connection pool to actively kill connections unless explicitly configured to do so. Usually, connections that are "orphaned" will stay that way, "just in case". If you aren't seeing exceptions being thrown due to "connection is closed" or some such thing, you are probably okay as far as the long-running queries are concerned. Do you know in advance which queries will take a "long time"? Perhaps you'd like to use a different connection pool for those long-running queries -- one where the timeout is significantly higher. As per our observations, they do not, and connections are stuck without executing any queries until maxWait. is that the expected behaviour after pool exhaustion? Let's be clear what we mean when we say "connection". The only "connection" here that is relevant is the "connection to the database." It sounds like you mean "incoming HTTP connection" whose thread will stall if a DB connection is not immediately available from the pool. That may be true, but the "(HTTP) connection" isn't waiting for a DB connection; the request-processing thread is waiting for a DB connection. Do you mean "behavior of connections checked-out and used long-term" or do you mean "behavior of the pool when all connections are checked-out and we need a NEW one?" I assume the second question is what you are asking. When all the connections are being used, the pool usually stalls, meaning that your code will just sit there a wait (possibly forever) for a connection. To fix that, you'd have to adjust the configuration of the pool (e.g. add more possible connections, increase maxWait to avoid errors). You can also usually configure the pool to allow connections which are checked-out and not returned after a certain period of time ("abandoned" to use the Commons-Pool terminology) to be allowed to "leak" and replenish the pool. You didn't say which pool you were using, so I will assume you are using the default DB connection pool based upon Apache commons-dbcp2. Here is the documentation for that pool; you can use these configuration settings on your element in your web application's META-INF/context.xml file: https://commons.apache.org/proper/commons-dbcp/configuration.html I recommend looking at the "abandoned"-related configuration options. -chris On Sat, Aug 7, 2021 at 3:43 AM Christopher Schultz < ch...@christopherschultz.net> wrote: Sampath, On 8/6/21 08:37, Sampath Rajapakshe wrote: Hi All, In my local setup before pool exhaustion exception is thrown, all the connections seem to be in freezed and when checking processList in mysql, those connections are in sleep state and doesn't execute any queries. After waiting for maxWait period the pool exhausted exception gets thrown and seems to reset the connections and then the queries are getting processed as normally. > So, my question is, with pool exhausted scenarios, doesn't existing connections execute their queries during that time(maxWait) and try to resolve the exhausted behaviour by releasing those connections to idle queue automatically? When checking the JMX matrix during this pool exhausted time all the connections are in the active queue. https://blog.christopherschultz.net/2009/03/16/properly-handling-pooled-jdbc-connections/ If not, what i am experiencing is as expected behaviour where the system is stuck after pool exhaustion for the best case of maxWait? Most of the time I've seen this kind of behavior it's due to sloppy resource-management. -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Clarification on behaviour after pool exhaustion happen in tomcat jdbc pool 9.0.16
Hi Chris, Thanks for the clarification. I've gone through the blog, In our case, we know the reason for the pool exhausted behaviour, there are slow queries and also due to high TPS where pool is not enough. So we are expected to get pool exhaustion with current configurations. What we wanted to verify was the behaviour after pool exhaustion. Do the current executing connections continue their executions during pool exhausted duration? As per our observations, they do not, and connections are stuck without executing any queries until maxWait. is that the expected behaviour after pool exhaustion? Thanks and Regards, Sampath On Sat, Aug 7, 2021 at 3:43 AM Christopher Schultz < ch...@christopherschultz.net> wrote: > Sampath, > > On 8/6/21 08:37, Sampath Rajapakshe wrote: > > Hi All, > > > > In my local setup before pool exhaustion exception is thrown, all the > > connections seem to be in freezed and when checking processList in mysql, > > those connections are in sleep state and doesn't execute any queries. > After > > waiting for maxWait period the pool exhausted exception gets thrown and > > seems to reset the connections and then the queries are getting processed > > as normally. > > > > So, my question is, with pool exhausted scenarios, doesn't existing > > connections execute their queries during that time(maxWait) and try to > > resolve the exhausted behaviour by releasing those connections to idle > > queue automatically? When checking the JMX matrix during this pool > > exhausted time all the connections are in the active queue. > > > https://blog.christopherschultz.net/2009/03/16/properly-handling-pooled-jdbc-connections/ > > > If not, what i am experiencing is as expected behaviour where the system > is > > stuck after pool exhaustion for the best case of maxWait? > > Most of the time I've seen this kind of behavior it's due to sloppy > resource-management. > > -chris > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > -- *Sampath Rajapakse* | Senior Software Engineer | WSO2 Inc. +94717313761 | samp...@wso2.com
Re: Clarification on behaviour after pool exhaustion happen in tomcat jdbc pool 9.0.16
Sampath, On 8/6/21 08:37, Sampath Rajapakshe wrote: Hi All, In my local setup before pool exhaustion exception is thrown, all the connections seem to be in freezed and when checking processList in mysql, those connections are in sleep state and doesn't execute any queries. After waiting for maxWait period the pool exhausted exception gets thrown and seems to reset the connections and then the queries are getting processed as normally. > So, my question is, with pool exhausted scenarios, doesn't existing connections execute their queries during that time(maxWait) and try to resolve the exhausted behaviour by releasing those connections to idle queue automatically? When checking the JMX matrix during this pool exhausted time all the connections are in the active queue. https://blog.christopherschultz.net/2009/03/16/properly-handling-pooled-jdbc-connections/ If not, what i am experiencing is as expected behaviour where the system is stuck after pool exhaustion for the best case of maxWait? Most of the time I've seen this kind of behavior it's due to sloppy resource-management. -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Clarification on behaviour after pool exhaustion happen in tomcat jdbc pool 9.0.16
Hi All, In my local setup before pool exhaustion exception is thrown, all the connections seem to be in freezed and when checking processList in mysql, those connections are in sleep state and doesn't execute any queries. After waiting for maxWait period the pool exhausted exception gets thrown and seems to reset the connections and then the queries are getting processed as normally. So, my question is, with pool exhausted scenarios, doesn't existing connections execute their queries during that time(maxWait) and try to resolve the exhausted behaviour by releasing those connections to idle queue automatically? When checking the JMX matrix during this pool exhausted time all the connections are in the active queue. If not, what i am experiencing is as expected behaviour where the system is stuck after pool exhaustion for the best case of maxWait? Thanks and regards, Sampath -- *Sampath Rajapakse* | Senior Software Engineer | WSO2 Inc. +94717313761 | samp...@wso2.com
Re: Does Tomcat JDBC Connection Pool reset autocommit on closed connections?
Alex, On 3/15/21 23:48, My Subs wrote: On Mon, 15 Mar 2021 11:25:17 -0500 Christopher Schultz wrote > Alex, > > On 3/13/21 10:20, My Subs wrote: > > On Fri, 12 Mar 2021 20:24:48 -0500 Christopher Schultz wrote > > > > > > > > Alex, > > > > > > On 3/12/21 16:32, My Subs wrote: > > > > On Fri, 12 Mar 2021 02:35:27 -0500 Mark Thomas wrote > > > > > > > > > On 12/03/2021 03:57, My Subs wrote: > > > > > > Hello, > > > > > > > > > > > > I'm using Tomcat 10.0.0. Suppose I call setAutoCommit(false) on a connection obtained from a Tomcat JDBC Connection Pool. Then I do some stuff with the connection, call commit() or rollback() and finally call close() on it without ever calling setAutocommit(true). > > > > > > > > > > > > What will the autocommit state of that connection be, the next time the pool gives it to my code? Will it be in the same state I left it, that is, with autocommit set to false, or will it be reverted back to the default state (autocommit set to true)? > > > > > > > > > > The simplest way to be sure is to run a test with a pool size of 1. > > > > > > > > > > A quick look at the code (I might have missed something) suggests that > > > > > if defaultAutoCommit is configured then it will be reset to that default > > > > > value. Otherwise it will be unchanged from when the connection was > > > > > returned to the pool. > > > > > > > > > > Mark > > > > > > > > > > ----- > > > > > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > > > > > For additional commands, e-mail: users-h...@tomcat.apache.org > > > > > > > > Hi Mark, > > > > > > > > Thanks for your comment. I found this on https://tomcat.apache.org/tomcat-10.0-doc/jdbc-pool.html: > > > > > > > > "The only state the pool itself inserts are defaultAutoCommit, defaultReadOnly, defaultTransactionIsolation, defaultCatalog if these are set. These 4 properties are only set upon connection creation. Should these properties be modified during the usage of the connection, the pool itself will not reset them." > > > > > > > > It seems to say that connections will not be reverted back to the default auto-commit state even if defaultAutoCommit is set. Given your reading of the source code, might it be that the docs are wrong? > > > > > > I think the docs can easily be misunderstood. > > > > > > I don't use the tomcat-pool but I do use the *other* pool provided by > > > Tomcat and they are generally expected to be (mostly) interchangeable. > > > > > > A connection pool which doesn't reset the auto-commit state on > > > connection-return operation would IMO be considered very badly broken. > > > > > > tomcat-pool allows you to NOT specify a default in which case > > > Connection.setAutoCommit() will never be called *at all* by the pool. > > > That seems like reasonable behavior (don't mess with my stuff!), but it > > > means that the application will *always* have to reset the auto-commit > > > state to a known value *every single time* a connection is borrowed. > > > > > > Since the whole point of the pool is to manage this kind of thing, I > > > would argue that having defaultAutoCommit NOT set to anything would be > > > considered very bad practice. > > > > > > If you set defaultAutoCommit="true", you should expect that, when your > > > connections are returned to the pool, that setAutoCommit(true) will be > > > called every single time the connection is returned to the pool -- > > > usually by the application calling Connection.close(). > > > > > > Are you worried about a particular use-case or are you just being > > > extra-vigilant? Or are you observing some unexpected behavior? > > > > > > -chris > > > > > > - > > > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > >
Re: Does Tomcat JDBC Connection Pool reset autocommit on closed connections?
On Mon, 15 Mar 2021 11:25:17 -0500 Christopher Schultz wrote > Alex, > > On 3/13/21 10:20, My Subs wrote: > > On Fri, 12 Mar 2021 20:24:48 -0500 Christopher Schultz > > wrote > > > > > > > > Alex, > > > > > > On 3/12/21 16:32, My Subs wrote: > > > > On Fri, 12 Mar 2021 02:35:27 -0500 Mark Thomas > > wrote > > > > > > > > > On 12/03/2021 03:57, My Subs wrote: > > > > > > Hello, > > > > > > > > > > > > I'm using Tomcat 10.0.0. Suppose I call setAutoCommit(false) > > on a connection obtained from a Tomcat JDBC Connection Pool. Then I do > > some stuff with the connection, call commit() or rollback() and finally > > call close() on it without ever calling setAutocommit(true). > > > > > > > > > > > > What will the autocommit state of that connection be, the next > > time the pool gives it to my code? Will it be in the same state I left > > it, that is, with autocommit set to false, or will it be reverted back to > > the default state (autocommit set to true)? > > > > > > > > > > The simplest way to be sure is to run a test with a pool size of > > 1. > > > > > > > > > > A quick look at the code (I might have missed something) > > suggests that > > > > > if defaultAutoCommit is configured then it will be reset to that > > default > > > > > value. Otherwise it will be unchanged from when the connection > > was > > > > > returned to the pool. > > > > > > > > > > Mark > > > > > > > > > > > > - > > > > > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > > > > > For additional commands, e-mail: users-h...@tomcat.apache.org > > > > > > > > Hi Mark, > > > > > > > > Thanks for your comment. I found this on > > https://tomcat.apache.org/tomcat-10.0-doc/jdbc-pool.html: > > > > > > > > "The only state the pool itself inserts are defaultAutoCommit, > > defaultReadOnly, defaultTransactionIsolation, defaultCatalog if these are > > set. These 4 properties are only set upon connection creation. Should > > these properties be modified during the usage of the connection, the pool > > itself will not reset them." > > > > > > > > It seems to say that connections will not be reverted back to the > > default auto-commit state even if defaultAutoCommit is set. Given your > > reading of the source code, might it be that the docs are wrong? > > > > > > I think the docs can easily be misunderstood. > > > > > > I don't use the tomcat-pool but I do use the *other* pool provided by > > > Tomcat and they are generally expected to be (mostly) interchangeable. > > > > > > A connection pool which doesn't reset the auto-commit state on > > > connection-return operation would IMO be considered very badly broken. > > > > > > tomcat-pool allows you to NOT specify a default in which case > > > Connection.setAutoCommit() will never be called *at all* by the pool. > > > That seems like reasonable behavior (don't mess with my stuff!), but > > it > > > means that the application will *always* have to reset the auto-commit > > > state to a known value *every single time* a connection is borrowed. > > > > > > Since the whole point of the pool is to manage this kind of thing, I > > > would argue that having defaultAutoCommit NOT set to anything would be > > > considered very bad practice. > > > > > > If you set defaultAutoCommit="true", you should expect that, when your > > > connections are returned to the pool, that setAutoCommit(true) will be > > > called every single time the connection is returned to the pool -- > > > usually by the application calling Connection.close(). > > > > > > Are you worried about a particular use-case or are you just being > > > extra-vigilant? Or are you observing some unexpected behavior? > > > > > > -chris > >
Re: Does Tomcat JDBC Connection Pool reset autocommit on closed connections?
Alex, On 3/13/21 10:20, My Subs wrote: On Fri, 12 Mar 2021 20:24:48 -0500 Christopher Schultz wrote > > Alex, > > On 3/12/21 16:32, My Subs wrote: > > On Fri, 12 Mar 2021 02:35:27 -0500 Mark Thomas wrote > > > > > On 12/03/2021 03:57, My Subs wrote: > > > > Hello, > > > > > > > > I'm using Tomcat 10.0.0. Suppose I call setAutoCommit(false) on a connection obtained from a Tomcat JDBC Connection Pool. Then I do some stuff with the connection, call commit() or rollback() and finally call close() on it without ever calling setAutocommit(true). > > > > > > > > What will the autocommit state of that connection be, the next time the pool gives it to my code? Will it be in the same state I left it, that is, with autocommit set to false, or will it be reverted back to the default state (autocommit set to true)? > > > > > > The simplest way to be sure is to run a test with a pool size of 1. > > > > > > A quick look at the code (I might have missed something) suggests that > > > if defaultAutoCommit is configured then it will be reset to that default > > > value. Otherwise it will be unchanged from when the connection was > > > returned to the pool. > > > > > > Mark > > > > > > - > > > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > > > For additional commands, e-mail: users-h...@tomcat.apache.org > > > > Hi Mark, > > > > Thanks for your comment. I found this on https://tomcat.apache.org/tomcat-10.0-doc/jdbc-pool.html: > > > > "The only state the pool itself inserts are defaultAutoCommit, defaultReadOnly, defaultTransactionIsolation, defaultCatalog if these are set. These 4 properties are only set upon connection creation. Should these properties be modified during the usage of the connection, the pool itself will not reset them." > > > > It seems to say that connections will not be reverted back to the default auto-commit state even if defaultAutoCommit is set. Given your reading of the source code, might it be that the docs are wrong? > > I think the docs can easily be misunderstood. > > I don't use the tomcat-pool but I do use the *other* pool provided by > Tomcat and they are generally expected to be (mostly) interchangeable. > > A connection pool which doesn't reset the auto-commit state on > connection-return operation would IMO be considered very badly broken. > > tomcat-pool allows you to NOT specify a default in which case > Connection.setAutoCommit() will never be called *at all* by the pool. > That seems like reasonable behavior (don't mess with my stuff!), but it > means that the application will *always* have to reset the auto-commit > state to a known value *every single time* a connection is borrowed. > > Since the whole point of the pool is to manage this kind of thing, I > would argue that having defaultAutoCommit NOT set to anything would be > considered very bad practice. > > If you set defaultAutoCommit="true", you should expect that, when your > connections are returned to the pool, that setAutoCommit(true) will be > called every single time the connection is returned to the pool -- > usually by the application calling Connection.close(). > > Are you worried about a particular use-case or are you just being > extra-vigilant? Or are you observing some unexpected behavior? > > -chris > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > Hi Chris, I’m trying to wrap my head around on whether I can end transaction blocks in a try clause with a simple call to commit(). That would be the case if the pool resets the auto-commit state to the value of defaultAutoCommit. Try blocks would end with commit(), catch blocks with rollback(), and the pool takes care of setting auto-commit back to true. On the other hand, if as the docs say, “the pool itself will not reset” the state of connection attributes like auto-commit, then I’d need to tack to every try/catch a finally clause having setAutoCommit(true). But this would be unnecessary boilerplate if, as Mark says —and you believe should be the case—, the pool does effect the reset. I’d rather not bloat the code, hence my question. I guess that puts me in the extra-v
Re: Does Tomcat JDBC Connection Pool reset autocommit on closed connections?
Sent using Zoho Mail On Fri, 12 Mar 2021 20:24:48 -0500 Christopher Schultz wrote > > Alex, > > On 3/12/21 16:32, My Subs wrote: > > On Fri, 12 Mar 2021 02:35:27 -0500 Mark Thomas > > wrote > > > > > On 12/03/2021 03:57, My Subs wrote: > > > > Hello, > > > > > > > > I'm using Tomcat 10.0.0. Suppose I call setAutoCommit(false) on a > > connection obtained from a Tomcat JDBC Connection Pool. Then I do some > > stuff with the connection, call commit() or rollback() and finally call > > close() on it without ever calling setAutocommit(true). > > > > > > > > What will the autocommit state of that connection be, the next time > > the pool gives it to my code? Will it be in the same state I left it, > > that is, with autocommit set to false, or will it be reverted back to the > > default state (autocommit set to true)? > > > > > > The simplest way to be sure is to run a test with a pool size of 1. > > > > > > A quick look at the code (I might have missed something) suggests that > > > if defaultAutoCommit is configured then it will be reset to that > > default > > > value. Otherwise it will be unchanged from when the connection was > > > returned to the pool. > > > > > > Mark > > > > > > - > > > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > > > For additional commands, e-mail: users-h...@tomcat.apache.org > > > > Hi Mark, > > > > Thanks for your comment. I found this on > > https://tomcat.apache.org/tomcat-10.0-doc/jdbc-pool.html: > > > > "The only state the pool itself inserts are defaultAutoCommit, > > defaultReadOnly, defaultTransactionIsolation, defaultCatalog if these are > > set. These 4 properties are only set upon connection creation. Should > > these properties be modified during the usage of the connection, the pool > > itself will not reset them." > > > > It seems to say that connections will not be reverted back to the default > > auto-commit state even if defaultAutoCommit is set. Given your reading of > > the source code, might it be that the docs are wrong? > > I think the docs can easily be misunderstood. > > I don't use the tomcat-pool but I do use the *other* pool provided by > Tomcat and they are generally expected to be (mostly) interchangeable. > > A connection pool which doesn't reset the auto-commit state on > connection-return operation would IMO be considered very badly broken. > > tomcat-pool allows you to NOT specify a default in which case > Connection.setAutoCommit() will never be called *at all* by the pool. > That seems like reasonable behavior (don't mess with my stuff!), but it > means that the application will *always* have to reset the auto-commit > state to a known value *every single time* a connection is borrowed. > > Since the whole point of the pool is to manage this kind of thing, I > would argue that having defaultAutoCommit NOT set to anything would be > considered very bad practice. > > If you set defaultAutoCommit="true", you should expect that, when your > connections are returned to the pool, that setAutoCommit(true) will be > called every single time the connection is returned to the pool -- > usually by the application calling Connection.close(). > > Are you worried about a particular use-case or are you just being > extra-vigilant? Or are you observing some unexpected behavior? > > -chris > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > > Hi Chris, I’m trying to wrap my head around on whether I can end transaction blocks in a try clause with a simple call to commit(). That would be the case if the pool resets the auto-commit state to the value of defaultAutoCommit. Try blocks would end with commit(), catch blocks with rollback(), and the pool takes care of setting auto-commit back to true. On the other hand, if as the docs say, “the pool itself will not reset” the state of connection attributes like auto-commit, then I’d need to tack to every try/catch a finally clause having setAutoCommit(true). But this would be unnecessary boilerplate if, as Mark says —and you believe should be the case—, the pool does effect the reset. I’d rather not bloat the code, hence my question. I guess that puts me in the extra-vigilant camp. Cheers, Alex - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Does Tomcat JDBC Connection Pool reset autocommit on closed connections?
Alex, On 3/12/21 16:32, My Subs wrote: On Fri, 12 Mar 2021 02:35:27 -0500 Mark Thomas wrote > On 12/03/2021 03:57, My Subs wrote: > > Hello, > > > > I'm using Tomcat 10.0.0. Suppose I call setAutoCommit(false) on a connection obtained from a Tomcat JDBC Connection Pool. Then I do some stuff with the connection, call commit() or rollback() and finally call close() on it without ever calling setAutocommit(true). > > > > What will the autocommit state of that connection be, the next time the pool gives it to my code? Will it be in the same state I left it, that is, with autocommit set to false, or will it be reverted back to the default state (autocommit set to true)? > > The simplest way to be sure is to run a test with a pool size of 1. > > A quick look at the code (I might have missed something) suggests that > if defaultAutoCommit is configured then it will be reset to that default > value. Otherwise it will be unchanged from when the connection was > returned to the pool. > > Mark > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org Hi Mark, Thanks for your comment. I found this on https://tomcat.apache.org/tomcat-10.0-doc/jdbc-pool.html: "The only state the pool itself inserts are defaultAutoCommit, defaultReadOnly, defaultTransactionIsolation, defaultCatalog if these are set. These 4 properties are only set upon connection creation. Should these properties be modified during the usage of the connection, the pool itself will not reset them." It seems to say that connections will not be reverted back to the default auto-commit state even if defaultAutoCommit is set. Given your reading of the source code, might it be that the docs are wrong? I think the docs can easily be misunderstood. I don't use the tomcat-pool but I do use the *other* pool provided by Tomcat and they are generally expected to be (mostly) interchangeable. A connection pool which doesn't reset the auto-commit state on connection-return operation would IMO be considered very badly broken. tomcat-pool allows you to NOT specify a default in which case Connection.setAutoCommit() will never be called *at all* by the pool. That seems like reasonable behavior (don't mess with my stuff!), but it means that the application will *always* have to reset the auto-commit state to a known value *every single time* a connection is borrowed. Since the whole point of the pool is to manage this kind of thing, I would argue that having defaultAutoCommit NOT set to anything would be considered very bad practice. If you set defaultAutoCommit="true", you should expect that, when your connections are returned to the pool, that setAutoCommit(true) will be called every single time the connection is returned to the pool -- usually by the application calling Connection.close(). Are you worried about a particular use-case or are you just being extra-vigilant? Or are you observing some unexpected behavior? -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Does Tomcat JDBC Connection Pool reset autocommit on closed connections?
On Fri, 12 Mar 2021 02:35:27 -0500 Mark Thomas wrote > On 12/03/2021 03:57, My Subs wrote: > > Hello, > > > > I'm using Tomcat 10.0.0. Suppose I call setAutoCommit(false) on a > > connection obtained from a Tomcat JDBC Connection Pool. Then I do some > > stuff with the connection, call commit() or rollback() and finally call > > close() on it without ever calling setAutocommit(true). > > > > What will the autocommit state of that connection be, the next time the > > pool gives it to my code? Will it be in the same state I left it, that > > is, with autocommit set to false, or will it be reverted back to the > > default state (autocommit set to true)? > > The simplest way to be sure is to run a test with a pool size of 1. > > A quick look at the code (I might have missed something) suggests that > if defaultAutoCommit is configured then it will be reset to that default > value. Otherwise it will be unchanged from when the connection was > returned to the pool. > > Mark > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org Hi Mark, Thanks for your comment. I found this on https://tomcat.apache.org/tomcat-10.0-doc/jdbc-pool.html: "The only state the pool itself inserts are defaultAutoCommit, defaultReadOnly, defaultTransactionIsolation, defaultCatalog if these are set. These 4 properties are only set upon connection creation. Should these properties be modified during the usage of the connection, the pool itself will not reset them." It seems to say that connections will not be reverted back to the default auto-commit state even if defaultAutoCommit is set. Given your reading of the source code, might it be that the docs are wrong? Thank you, Alex - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Does Tomcat JDBC Connection Pool reset autocommit on closed connections?
On 12/03/2021 03:57, My Subs wrote: Hello, I'm using Tomcat 10.0.0. Suppose I call setAutoCommit(false) on a connection obtained from a Tomcat JDBC Connection Pool. Then I do some stuff with the connection, call commit() or rollback() and finally call close() on it without ever calling setAutocommit(true). What will the autocommit state of that connection be, the next time the pool gives it to my code? Will it be in the same state I left it, that is, with autocommit set to false, or will it be reverted back to the default state (autocommit set to true)? The simplest way to be sure is to run a test with a pool size of 1. A quick look at the code (I might have missed something) suggests that if defaultAutoCommit is configured then it will be reset to that default value. Otherwise it will be unchanged from when the connection was returned to the pool. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Does Tomcat JDBC Connection Pool reset autocommit on closed connections?
Hello, I'm using Tomcat 10.0.0. Suppose I call setAutoCommit(false) on a connection obtained from a Tomcat JDBC Connection Pool. Then I do some stuff with the connection, call commit() or rollback() and finally call close() on it without ever calling setAutocommit(true). What will the autocommit state of that connection be, the next time the pool gives it to my code? Will it be in the same state I left it, that is, with autocommit set to false, or will it be reverted back to the default state (autocommit set to true)? Thank you! Alex Sent using Zoho Mail - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat JDBC Connection Pool question
Thanks Phil! Mensaje original On 11 feb. 2021 2:54, Phil Steitz escribió: > See maxWait for Tomcat JDBC Pool > > https://tomcat.apache.org/tomcat-9.0-doc/jdbc-pool.html > > Or for the default dbcp pool, maxWaitMillis > > https://commons.apache.org/proper/commons-dbcp/configuration.html > > Phil > > On 2/10/21 3:22 PM, xcorpius wrote: >> Hi Chris! >> >> ConnectionReserveTimeoutSeconds: >> >> The number of seconds after which a call to reserve a connection from the >> connection pool will timeout. >> >> When set to 0, a call will never timeout. >> >> When set to -1, a call will timeout immediately. >> >> Admin Console field label: Connection Reserve Timeout >> >> Units: seconds >> >> Default: 10 >> >> Minimum: -1 >> >> Maximum: 231-1 >> >> Thanks, >> >> Xcorpius >> Mensaje original >> On 10 feb. 2021 23:13, Christopher Schultz escribió: >> >>> Xcorpius, >>> >>> On 2/10/21 07:15, xcorpius wrote: >>>> Is there a parameter in "Tomcat JDBC Connection Pool" 9 equivalent to >>>> the ConnectionReserveTimeoutSeconds parameter from Weblogic? >>> Maybe. >>> >>> What does that parameter actually do? >>> >>> -chris >>> >>> - >>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >>> For additional commands, e-mail: users-h...@tomcat.apache.org > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat JDBC Connection Pool question
See maxWait for Tomcat JDBC Pool https://tomcat.apache.org/tomcat-9.0-doc/jdbc-pool.html Or for the default dbcp pool, maxWaitMillis https://commons.apache.org/proper/commons-dbcp/configuration.html Phil On 2/10/21 3:22 PM, xcorpius wrote: Hi Chris! ConnectionReserveTimeoutSeconds: The number of seconds after which a call to reserve a connection from the connection pool will timeout. When set to 0, a call will never timeout. When set to -1, a call will timeout immediately. Admin Console field label: Connection Reserve Timeout Units: seconds Default: 10 Minimum: -1 Maximum: 231-1 Thanks, Xcorpius Mensaje original On 10 feb. 2021 23:13, Christopher Schultz escribió: Xcorpius, On 2/10/21 07:15, xcorpius wrote: Is there a parameter in "Tomcat JDBC Connection Pool" 9 equivalent to the ConnectionReserveTimeoutSeconds parameter from Weblogic? Maybe. What does that parameter actually do? -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat JDBC Connection Pool question
Hi Chris! ConnectionReserveTimeoutSeconds: The number of seconds after which a call to reserve a connection from the connection pool will timeout. When set to 0, a call will never timeout. When set to -1, a call will timeout immediately. Admin Console field label: Connection Reserve Timeout Units: seconds Default: 10 Minimum: -1 Maximum: 231-1 Thanks, Xcorpius Mensaje original On 10 feb. 2021 23:13, Christopher Schultz escribió: > Xcorpius, > > On 2/10/21 07:15, xcorpius wrote: >> Is there a parameter in "Tomcat JDBC Connection Pool" 9 equivalent to >> the ConnectionReserveTimeoutSeconds parameter from Weblogic? > > Maybe. > > What does that parameter actually do? > > -chris > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Tomcat JDBC Connection Pool question
Xcorpius, On 2/10/21 07:15, xcorpius wrote: Is there a parameter in "Tomcat JDBC Connection Pool" 9 equivalent to the ConnectionReserveTimeoutSeconds parameter from Weblogic? Maybe. What does that parameter actually do? -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Tomcat JDBC Connection Pool question
Hi! Is there a parameter in "Tomcat JDBC Connection Pool" 9 equivalent to the ConnectionReserveTimeoutSeconds parameter from Weblogic? Thanks, Xcorpius
RE: jdbc connction pool issues [EXTERNAL]
Yeah I didn’t consider that relevant at the time. All examples of creating a jdbc connection pool for SQL server on tomcat did not have specifying the factory in them. So I didn’t consider it relevant. My bad. Shawn Beard• Sr. Systems Engineer Middleware Engineering [cid:image095582.png@B63DE6DB.090F1975] 3840 109th Street , Urbandale , IA 50322 Phone: +1-515-564-2528 Email: sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> Website: https://berkleytechnologyservices.com/ [cid:image070627.jpg@9AB92315.41952739] Technology Leadership Unleashing Business Potential -Original Message- From: Christopher Schultz Sent: Friday, December 18, 2020 7:22 AM To: Tomcat Users List Subject: Re: jdbc connction pool issues [EXTERNAL] ** CAUTION: External message Shawn, On 12/17/20 14:21, Beard, Shawn wrote: > Well the other tomcat servers had a custom factory specified. That was > the only difference. (devs wrote their own library for it) So they were different. It's always misleading when getting a report like this: On 12/15/20 15:35, Beard, Shawn wrote: > Other tomcat servers with exact same jdbc connection pool config(only > difference is servername, databasename, user and pass) show 50 max > connections, which is what maxActive is set to. So you can see why we were maybe confused about what was happening. -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org CONFIDENTIALITY NOTICE: This e-mail and the transmitted documents contain private, privileged and confidential information belonging to the sender. The information therein is solely for the use of the addressee. If your receipt of this transmission has occurred as the result of an error, please immediately notify us so we can arrange for the return of the documents. In such circumstances, you are advised that you may not disclose, copy, distribute or take any other action in reliance on the information transmitted.
Re: jdbc connction pool issues [EXTERNAL]
Shawn, On 12/17/20 14:21, Beard, Shawn wrote: Well the other tomcat servers had a custom factory specified. That was the only difference. (devs wrote their own library for it) So they were different. It's always misleading when getting a report like this: On 12/15/20 15:35, Beard, Shawn wrote: Other tomcat servers with exact same jdbc connection pool config(only difference is servername, databasename, user and pass) show 50 max connections, which is what maxActive is set to. So you can see why we were maybe confused about what was happening. -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: jdbc connction pool issues [EXTERNAL]
Well the other tomcat servers had a custom factory specified. That was the only difference. (devs wrote their own library for it) So I looked in tomcat documentation and tried loading a out of the box factory that was available. That’s when it was picking up the maxActive setting and I started seeing that setting properly reflected in JMX. Shawn Beard• Sr. Systems Engineer Middleware Engineering [cid:image952388.png@65A378B2.7242AA8D] 3840 109th Street , Urbandale , IA 50322 Phone: +1-515-564-2528 Email: sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> Website: https://berkleytechnologyservices.com/ [cid:image151023.jpg@DFE8510C.41F52B48] Technology Leadership Unleashing Business Potential -Original Message- From: Christopher Schultz Sent: Thursday, December 17, 2020 1:02 PM To: users@tomcat.apache.org Subject: Re: jdbc connction pool issues [EXTERNAL] ** CAUTION: External message Shawn, On 12/17/20 11:04, Beard, Shawn wrote: > I was able to fix this. I added this to the config: > > factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" > > I was then seeing maxConnections of 50 in jmx and not 8. So Phil was right: you needed to s/maxActive/maxTotal/. That doesn't sounds right if "all your other servers are working with the same config and Tomcat version" so something isn't right about that statement. *Something* is different. Switching to the Tomcat jdbc-pool again uses "maxActive" instead of "maxTotal" as the configuration option for the largest number of connections allowed in the pool, which is why it works when you change it. -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org CONFIDENTIALITY NOTICE: This e-mail and the transmitted documents contain private, privileged and confidential information belonging to the sender. The information therein is solely for the use of the addressee. If your receipt of this transmission has occurred as the result of an error, please immediately notify us so we can arrange for the return of the documents. In such circumstances, you are advised that you may not disclose, copy, distribute or take any other action in reliance on the information transmitted.
Re: jdbc connction pool issues [EXTERNAL]
Shawn, On 12/17/20 11:04, Beard, Shawn wrote: I was able to fix this. I added this to the config: factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" I was then seeing maxConnections of 50 in jmx and not 8. So Phil was right: you needed to s/maxActive/maxTotal/. That doesn't sounds right if "all your other servers are working with the same config and Tomcat version" so something isn't right about that statement. *Something* is different. Switching to the Tomcat jdbc-pool again uses "maxActive" instead of "maxTotal" as the configuration option for the largest number of connections allowed in the pool, which is why it works when you change it. -chris - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: jdbc connction pool issues [EXTERNAL]
I was able to fix this. I added this to the config: factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" I was then seeing maxConnections of 50 in jmx and not 8. Shawn Beard Sr. Systems Engineer | BTS Middleware Engineering | +1-515-564-2528 | sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> -Original Message- From: Beard, Shawn Sent: Wednesday, December 16, 2020 7:43 AM To: Tomcat Users List Subject: RE: jdbc connction pool issues [EXTERNAL] ** CAUTION: External message Yes same version of tomcat 9.0.31, however the one having issues is running java 8 where the one that shows things correctly is running java 11. Shawn Beard Sr. Systems Engineer | BTS Middleware Engineering | +1-515-564-2528 | sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> -Original Message- From: Phil Steitz Sent: Tuesday, December 15, 2020 3:37 PM To: users@tomcat.apache.org Subject: Re: jdbc connction pool issues [EXTERNAL] ** CAUTION: External message On 12/15/20 1:35 PM, Beard, Shawn wrote: > No intitialSize is not defined. > > Im getting the data to verify from JMX, however we also have an APM called > appdynamics loaded. Both verified the 8 max connections. > > Other tomcat servers with exact same jdbc connection pool config(only > difference is servername, databasename, user and pass) show 50 max > connections, which is what maxActive is set to. Are the other tomcat servers running the same tomcat version? Since TC8, the default connection pool is DBCP2 which uses maxTotal in place of maxActive. See [1]. If you are running 8+, s/maxActive/maxTotal in the config should work. Phil [1] https://urldefense.com/v3/__https://tomcat.apache.org/migration-8.html*Database_Connection_Pooling__;Iw!!Li8W9_Um1Taa!orxL7Ci-tTj7jM-90ooXXY8VTcDfIzFLc9YZw4Oh-ybxGw-BbIQv4_O0_vGUlXfF$ > > > > Shawn Beard > > Sr. Systems Engineer | > BTS > > Middleware Engineering | +1-515-564-2528 | > sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> > > > > > > > > > > -Original Message----- > From: Johnson, Jim > Sent: Tuesday, December 15, 2020 2:22 PM > To: Tomcat Users List > Subject: RE: jdbc connction pool issues [EXTERNAL] > > ** CAUTION: External message > > > Hi Shawn, > > No, I don't think that maxActive means that it's defining the maximum > number of connections for the pool, I think it's strictly referring to > the "[ .. ] maximum number of *active connections* that can be > allocated from this pool at the same time. [ .. ]" (emphasis mine on > active connections) > > Here is the doc that I've been referring to - sorry for not linking it > earlier: > https://urldefense.com/v3/__https://tomcat.apache.org/tomcat-9.0-doc/j > dbc-pool.html__;!!Li8W9_Um1Taa!vJGrxr7yc86joO5r6QoNstpipfempGFqrYRe3_N > yAIGNs-LenmBWhtjn1fRiAOex$ > > On those other Tomcat servers is there a initialSize defined? > > Jim > > -Original Message- > From: Beard, Shawn > Sent: Tuesday, December 15, 2020 2:49 PM > To: Tomcat Users List > Subject: RE: jdbc connction pool issues [EXTERNAL] > > But wouldn’t maxActive mean the connection pool has a max of 50 conenctions? > On other tomcat servers I have, maxActive is set to 50 and I verified im jmx > that there are 50 max connections on the connection pool. > > Here though I checked jmx, sure enough, its max connections is 8. > > > > Shawn Beard > > Sr. Systems Engineer | > BTS > > Middleware Engineering | +1-515-564-2528 | > sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> > > > > > > > > > > -Original Message- > From: Johnson, Jim > Sent: Tuesday, December 15, 2020 1:35 PM > To: Tomcat Users List > Subject: RE: jdbc connction pool issues [EXTERNAL] > > ** CAUTION: External message > > > Hi Shawn, > > I think you’re missing initialSize > > initialSize > (int)The initial number of connections that are created when the pool > is started. Default value is 10 > > maxActive > (int) The maximum number of active connections that can be allocated > from this pool at the same time. The default value is 100 > > It would make sense that 8 connections would be 80% utilized. > > I would try replacing maxActive with initialSize and seeing how that works > for you. > > Good luck! > > - Jim > > From: Beard, Shawn > Sent: Tuesday, December 15, 2020 2:12 PM > To: Tomcat Users List > Subject: jdbc connction pool issues > > CAUTION EXTERNAL EMAIL: This email originated from outside of the > organization. Do not click links or open attachments unless you recognize the > sender and know the content is safe. >
RE: jdbc connction pool issues [EXTERNAL]
Yes same version of tomcat 9.0.31, however the one having issues is running java 8 where the one that shows things correctly is running java 11. Shawn Beard Sr. Systems Engineer | BTS Middleware Engineering | +1-515-564-2528 | sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> -Original Message- From: Phil Steitz Sent: Tuesday, December 15, 2020 3:37 PM To: users@tomcat.apache.org Subject: Re: jdbc connction pool issues [EXTERNAL] ** CAUTION: External message On 12/15/20 1:35 PM, Beard, Shawn wrote: > No intitialSize is not defined. > > Im getting the data to verify from JMX, however we also have an APM called > appdynamics loaded. Both verified the 8 max connections. > > Other tomcat servers with exact same jdbc connection pool config(only > difference is servername, databasename, user and pass) show 50 max > connections, which is what maxActive is set to. Are the other tomcat servers running the same tomcat version? Since TC8, the default connection pool is DBCP2 which uses maxTotal in place of maxActive. See [1]. If you are running 8+, s/maxActive/maxTotal in the config should work. Phil [1] https://urldefense.com/v3/__https://tomcat.apache.org/migration-8.html*Database_Connection_Pooling__;Iw!!Li8W9_Um1Taa!orxL7Ci-tTj7jM-90ooXXY8VTcDfIzFLc9YZw4Oh-ybxGw-BbIQv4_O0_vGUlXfF$ > > > > Shawn Beard > > Sr. Systems Engineer | > BTS > > Middleware Engineering | +1-515-564-2528 | > sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> > > > > > > > > > > -Original Message- > From: Johnson, Jim > Sent: Tuesday, December 15, 2020 2:22 PM > To: Tomcat Users List > Subject: RE: jdbc connction pool issues [EXTERNAL] > > ** CAUTION: External message > > > Hi Shawn, > > No, I don't think that maxActive means that it's defining the maximum > number of connections for the pool, I think it's strictly referring to > the "[ .. ] maximum number of *active connections* that can be > allocated from this pool at the same time. [ .. ]" (emphasis mine on > active connections) > > Here is the doc that I've been referring to - sorry for not linking it > earlier: > https://urldefense.com/v3/__https://tomcat.apache.org/tomcat-9.0-doc/j > dbc-pool.html__;!!Li8W9_Um1Taa!vJGrxr7yc86joO5r6QoNstpipfempGFqrYRe3_N > yAIGNs-LenmBWhtjn1fRiAOex$ > > On those other Tomcat servers is there a initialSize defined? > > Jim > > -Original Message- > From: Beard, Shawn > Sent: Tuesday, December 15, 2020 2:49 PM > To: Tomcat Users List > Subject: RE: jdbc connction pool issues [EXTERNAL] > > But wouldn’t maxActive mean the connection pool has a max of 50 conenctions? > On other tomcat servers I have, maxActive is set to 50 and I verified im jmx > that there are 50 max connections on the connection pool. > > Here though I checked jmx, sure enough, its max connections is 8. > > > > Shawn Beard > > Sr. Systems Engineer | > BTS > > Middleware Engineering | +1-515-564-2528 | > sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> > > > > > > > > > > -Original Message- > From: Johnson, Jim > Sent: Tuesday, December 15, 2020 1:35 PM > To: Tomcat Users List > Subject: RE: jdbc connction pool issues [EXTERNAL] > > ** CAUTION: External message > > > Hi Shawn, > > I think you’re missing initialSize > > initialSize > (int)The initial number of connections that are created when the pool > is started. Default value is 10 > > maxActive > (int) The maximum number of active connections that can be allocated > from this pool at the same time. The default value is 100 > > It would make sense that 8 connections would be 80% utilized. > > I would try replacing maxActive with initialSize and seeing how that works > for you. > > Good luck! > > - Jim > > From: Beard, Shawn > Sent: Tuesday, December 15, 2020 2:12 PM > To: Tomcat Users List > Subject: jdbc connction pool issues > > CAUTION EXTERNAL EMAIL: This email originated from outside of the > organization. Do not click links or open attachments unless you recognize the > sender and know the content is safe. > > We have this jdbc connection pool set up: > > driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" > url="jdbc:sqlserver://hostname:1433;selectMethod=direct;databaseName=databasename;sendStringParametersAsUnicode=false" > username="XXX" password="XX" maxIdle="20" minIdle="10" maxActive="50" > maxWait="3" testWhileIdle="true" testOnBorrow="true" > validationQuery="SELECT 1&q
Re: jdbc connction pool issues [EXTERNAL]
On 12/15/20 1:35 PM, Beard, Shawn wrote: No intitialSize is not defined. Im getting the data to verify from JMX, however we also have an APM called appdynamics loaded. Both verified the 8 max connections. Other tomcat servers with exact same jdbc connection pool config(only difference is servername, databasename, user and pass) show 50 max connections, which is what maxActive is set to. Are the other tomcat servers running the same tomcat version? Since TC8, the default connection pool is DBCP2 which uses maxTotal in place of maxActive. See [1]. If you are running 8+, s/maxActive/maxTotal in the config should work. Phil [1] https://tomcat.apache.org/migration-8.html#Database_Connection_Pooling Shawn Beard Sr. Systems Engineer | BTS Middleware Engineering | +1-515-564-2528 | sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> -Original Message- From: Johnson, Jim Sent: Tuesday, December 15, 2020 2:22 PM To: Tomcat Users List Subject: RE: jdbc connction pool issues [EXTERNAL] ** CAUTION: External message Hi Shawn, No, I don't think that maxActive means that it's defining the maximum number of connections for the pool, I think it's strictly referring to the "[ .. ] maximum number of *active connections* that can be allocated from this pool at the same time. [ .. ]" (emphasis mine on active connections) Here is the doc that I've been referring to - sorry for not linking it earlier: https://urldefense.com/v3/__https://tomcat.apache.org/tomcat-9.0-doc/jdbc-pool.html__;!!Li8W9_Um1Taa!vJGrxr7yc86joO5r6QoNstpipfempGFqrYRe3_NyAIGNs-LenmBWhtjn1fRiAOex$ On those other Tomcat servers is there a initialSize defined? Jim -Original Message- From: Beard, Shawn Sent: Tuesday, December 15, 2020 2:49 PM To: Tomcat Users List Subject: RE: jdbc connction pool issues [EXTERNAL] But wouldn’t maxActive mean the connection pool has a max of 50 conenctions? On other tomcat servers I have, maxActive is set to 50 and I verified im jmx that there are 50 max connections on the connection pool. Here though I checked jmx, sure enough, its max connections is 8. Shawn Beard Sr. Systems Engineer | BTS Middleware Engineering | +1-515-564-2528 | sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> -Original Message- From: Johnson, Jim Sent: Tuesday, December 15, 2020 1:35 PM To: Tomcat Users List Subject: RE: jdbc connction pool issues [EXTERNAL] ** CAUTION: External message Hi Shawn, I think you’re missing initialSize initialSize (int)The initial number of connections that are created when the pool is started. Default value is 10 maxActive (int) The maximum number of active connections that can be allocated from this pool at the same time. The default value is 100 It would make sense that 8 connections would be 80% utilized. I would try replacing maxActive with initialSize and seeing how that works for you. Good luck! - Jim From: Beard, Shawn Sent: Tuesday, December 15, 2020 2:12 PM To: Tomcat Users List Subject: jdbc connction pool issues CAUTION EXTERNAL EMAIL: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe. We have this jdbc connection pool set up: However we are getting this error: Resource Pool Limit Reached Time 12/15/20 11:48:00 AM Summary JDBC Connection Pool Catalina:class=javax.sql.DataSource,context=/XX,host=X,name="jdbc/DataSource",type=DataSource has reached 80% limit. Current pool size [8, Max pool size [8] Shouldn’t the max connections of the connection pool be 50 since maxActive is 50? Shawn Beard • Sr. Systems Engineer Middleware Engineering [cid:image003.png@01D6D2E3.D5F1EFA0] 3840 109th Street Urbandale, IA 50322 Phone: +1-515-564-2528 Email: sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> Website: berkleytechnologyservices.com<https://urldefense.com/v3/__https://nam05.safelinks.protection.outlook.com/?url=https*3A*2F*2Furldefense.com*2Fv3*2F__https*3A*2F*2Fnam05.safelinks.protection.outlook.com*2F*3Furl*3Dhttps*3A*2F*2Fwww.berkleytechnologyservices.com*2F*26data*3D04*7C01*7CJ1Johnson*40unum.com*7C64e6e4965acb42aebfe708d8a12d798c*7Cd5952c785d4e41caaff07174c1f75393*7C0*7C0*7C637436563975240326*7CUnknown*7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0*3D*7C3000*26sdata*3D3nTT6swXEeC2zC*2BUb7Q7nvgxM214SGf7HJaI*2F4*2BYupA*3D*26reserved*3D0__*3BJSUlJSUlJSUlJSUlJSUlJSUlJSU!!Li8W9_Um1Taa!qrMl5L--I8QMohhvL9LXmHKdJz0jf2lM2XTvoH8FwyisGVhxNJdYs74vjiQ2KJgp*24data=04*7C01*7CJ1Johnson*40unum.com*7C016565a918474642884608d8a1328579*7Cd5952c785d4e41caaff07174c1f75393*7C0*7C0*7C637436585655273329*7CUnknown*7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0*3D*7C2000sdata=tBYkHrqnGHyaJPmtqrHIB5LPJLsZfdU4YdsK2JFVwAo*3Dreserved=0__;JSUlJSUlJSUlJSUqKioqJSUqKioqK
RE: jdbc connction pool issues [EXTERNAL]
Is there a specific factory I should be loading? Or is not specifying and allowing default good enough? It is a jdbc connection pool, catalina home is set correctly. Shawn Beard Sr. Systems Engineer | BTS Middleware Engineering | +1-515-564-2528 | sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> -Original Message- From: Jalaj Asher Sent: Tuesday, December 15, 2020 2:39 PM To: Tomcat Users List Subject: RE: jdbc connction pool issues [EXTERNAL] ** CAUTION: External message Hi Shawn, Check the Catalina home and see if your tomcat set up Is pointed to the correct path. You can check that from the registry as well to make sure the service is not pointed to another tomcat which might have these parameters setup. The registry path is HKEY_LOCAL_MACHINE --> software-->wow6432node ---> apache software foundation. Else you might want to check if the same is a problem with DBCP pool as well . As from the details shared looks like you are using jdbc pool. Regards Jalaj -Original Message- From: Johnson, Jim Sent: Tuesday, December 15, 2020 3:22 PM To: Tomcat Users List Subject: RE: jdbc connction pool issues [EXTERNAL] Attention: This email was sent from someone outside of eClinicalWorks. Always use caution when opening attachments or clicking links from unknown senders or when receiving unexpected emails. Hi Shawn, No, I don't think that maxActive means that it's defining the maximum number of connections for the pool, I think it's strictly referring to the "[ .. ] maximum number of *active connections* that can be allocated from this pool at the same time. [ .. ]" (emphasis mine on active connections) Here is the doc that I've been referring to - sorry for not linking it earlier: https://urldefense.com/v3/__https://nam05.safelinks.protection.outlook.com/?url=https*3A*2F*2Ftomcat.apache.org*2Ftomcat-9.0-doc*2Fjdbc-pool.htmldata=04*7C01*7Cjalaj.asher*40eclinicalworks.com*7C3f5dd36a4b0d458695d908d8a1371f11*7C7ce747e48f6d4e0697efa9b76a063808*7C1*7C0*7C637436605411941490*7CUnknown*7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0*3D*7C3000sdata=bPYOMGVa0dYi0ASx*2BuQ5pTdlzpuOKird7pAVi*2FjHQVs*3Dreserved=0__;JSUlJSUlJSUlJSUlJSUlJSUlJSU!!Li8W9_Um1Taa!q2MG45FC18cm0UD-N10yCZgPVqpaQaZGKILOaYz6c1kiDPaCBBP5Q1UZoCWfvJtl$ On those other Tomcat servers is there a initialSize defined? Jim -Original Message- From: Beard, Shawn Sent: Tuesday, December 15, 2020 2:49 PM To: Tomcat Users List Subject: RE: jdbc connction pool issues [EXTERNAL] But wouldn’t maxActive mean the connection pool has a max of 50 conenctions? On other tomcat servers I have, maxActive is set to 50 and I verified im jmx that there are 50 max connections on the connection pool. Here though I checked jmx, sure enough, its max connections is 8. Shawn Beard Sr. Systems Engineer | BTS Middleware Engineering | +1-515-564-2528 | sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> -Original Message- From: Johnson, Jim Sent: Tuesday, December 15, 2020 1:35 PM To: Tomcat Users List Subject: RE: jdbc connction pool issues [EXTERNAL] ** CAUTION: External message Hi Shawn, I think you’re missing initialSize initialSize (int)The initial number of connections that are created when the pool is started. Default value is 10 maxActive (int) The maximum number of active connections that can be allocated from this pool at the same time. The default value is 100 It would make sense that 8 connections would be 80% utilized. I would try replacing maxActive with initialSize and seeing how that works for you. Good luck! - Jim From: Beard, Shawn Sent: Tuesday, December 15, 2020 2:12 PM To: Tomcat Users List Subject: jdbc connction pool issues CAUTION EXTERNAL EMAIL: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe. We have this jdbc connection pool set up: However we are getting this error: Resource Pool Limit Reached Time 12/15/20 11:48:00 AM Summary JDBC Connection Pool Catalina:class=javax.sql.DataSource,context=/XX,host=X,name="jdbc/DataSource",type=DataSource has reached 80% limit. Current pool size [8, Max pool size [8] Shouldn’t the max connections of the connection pool be 50 since maxActive is 50? Shawn Beard • Sr. Systems Engineer Middleware Engineering [cid:image003.png@01D6D2E3.D5F1EFA0] 3840 109th Street Urbandale, IA 50322 Phone: +1-515-564-2528 Email: sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> Website: berkleytechnologyservices.com<https://urldefense.com/v3/__https://nam05.safelinks.protection.outlook.com/?url=https*3A*2F*2Furldefense.com*2Fv3*2F__https*3A*2F*2Fnam05.safelinks.protection.outlook.com*2F*3Furl*3Dhttps*3A*2F*2Fwww.berkleytechnologyservices.com*2F*26data*3D04*7C01*7CJ1Joh
RE: jdbc connction pool issues [EXTERNAL]
Hi Shawn, Check the Catalina home and see if your tomcat set up Is pointed to the correct path. You can check that from the registry as well to make sure the service is not pointed to another tomcat which might have these parameters setup. The registry path is HKEY_LOCAL_MACHINE --> software-->wow6432node ---> apache software foundation. Else you might want to check if the same is a problem with DBCP pool as well . As from the details shared looks like you are using jdbc pool. Regards Jalaj -Original Message- From: Johnson, Jim Sent: Tuesday, December 15, 2020 3:22 PM To: Tomcat Users List Subject: RE: jdbc connction pool issues [EXTERNAL] Attention: This email was sent from someone outside of eClinicalWorks. Always use caution when opening attachments or clicking links from unknown senders or when receiving unexpected emails. Hi Shawn, No, I don't think that maxActive means that it's defining the maximum number of connections for the pool, I think it's strictly referring to the "[ .. ] maximum number of *active connections* that can be allocated from this pool at the same time. [ .. ]" (emphasis mine on active connections) Here is the doc that I've been referring to - sorry for not linking it earlier: https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftomcat.apache.org%2Ftomcat-9.0-doc%2Fjdbc-pool.htmldata=04%7C01%7Cjalaj.asher%40eclinicalworks.com%7C3f5dd36a4b0d458695d908d8a1371f11%7C7ce747e48f6d4e0697efa9b76a063808%7C1%7C0%7C637436605411941490%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=bPYOMGVa0dYi0ASx%2BuQ5pTdlzpuOKird7pAVi%2FjHQVs%3Dreserved=0 On those other Tomcat servers is there a initialSize defined? Jim -Original Message- From: Beard, Shawn Sent: Tuesday, December 15, 2020 2:49 PM To: Tomcat Users List Subject: RE: jdbc connction pool issues [EXTERNAL] But wouldn’t maxActive mean the connection pool has a max of 50 conenctions? On other tomcat servers I have, maxActive is set to 50 and I verified im jmx that there are 50 max connections on the connection pool. Here though I checked jmx, sure enough, its max connections is 8. Shawn Beard Sr. Systems Engineer | BTS Middleware Engineering | +1-515-564-2528 | sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> -Original Message- From: Johnson, Jim Sent: Tuesday, December 15, 2020 1:35 PM To: Tomcat Users List Subject: RE: jdbc connction pool issues [EXTERNAL] ** CAUTION: External message Hi Shawn, I think you’re missing initialSize initialSize (int)The initial number of connections that are created when the pool is started. Default value is 10 maxActive (int) The maximum number of active connections that can be allocated from this pool at the same time. The default value is 100 It would make sense that 8 connections would be 80% utilized. I would try replacing maxActive with initialSize and seeing how that works for you. Good luck! - Jim From: Beard, Shawn Sent: Tuesday, December 15, 2020 2:12 PM To: Tomcat Users List Subject: jdbc connction pool issues CAUTION EXTERNAL EMAIL: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe. We have this jdbc connection pool set up: However we are getting this error: Resource Pool Limit Reached Time 12/15/20 11:48:00 AM Summary JDBC Connection Pool Catalina:class=javax.sql.DataSource,context=/XX,host=X,name="jdbc/DataSource",type=DataSource has reached 80% limit. Current pool size [8, Max pool size [8] Shouldn’t the max connections of the connection pool be 50 since maxActive is 50? Shawn Beard • Sr. Systems Engineer Middleware Engineering [cid:image003.png@01D6D2E3.D5F1EFA0] 3840 109th Street Urbandale, IA 50322 Phone: +1-515-564-2528 Email: sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> Website: berkleytechnologyservices.com<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.com%2Fv3%2F__https%3A%2F%2Fnam05.safelinks.protection.outlook.com%2F%3Furl%3Dhttps*3A*2F*2Fwww.berkleytechnologyservices.com*2F%26data%3D04*7C01*7CJ1Johnson*40unum.com*7C64e6e4965acb42aebfe708d8a12d798c*7Cd5952c785d4e41caaff07174c1f75393*7C0*7C0*7C637436563975240326*7CUnknown*7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0*3D*7C3000%26sdata%3D3nTT6swXEeC2zC*2BUb7Q7nvgxM214SGf7HJaI*2F4*2BYupA*3D%26reserved%3D0__%3BJSUlJSUlJSUlJSUlJSUlJSUlJSU!!Li8W9_Um1Taa!qrMl5L--I8QMohhvL9LXmHKdJz0jf2lM2XTvoH8FwyisGVhxNJdYs74vjiQ2KJgp%24data=04%7C01%7Cjalaj.asher%40eclinicalworks.com%7C3f5dd36a4b0d458695d908d8a1371f11%7C7ce747e48f6d4e0697efa9b76a063808%7C1%7C0%7C637436605411941490%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000sdata=j4JvD%2BB6TzoymQAJookdvrCXXLBvGncjNBlYQ%2B
RE: jdbc connction pool issues [EXTERNAL]
No intitialSize is not defined. Im getting the data to verify from JMX, however we also have an APM called appdynamics loaded. Both verified the 8 max connections. Other tomcat servers with exact same jdbc connection pool config(only difference is servername, databasename, user and pass) show 50 max connections, which is what maxActive is set to. Shawn Beard Sr. Systems Engineer | BTS Middleware Engineering | +1-515-564-2528 | sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> -Original Message- From: Johnson, Jim Sent: Tuesday, December 15, 2020 2:22 PM To: Tomcat Users List Subject: RE: jdbc connction pool issues [EXTERNAL] ** CAUTION: External message Hi Shawn, No, I don't think that maxActive means that it's defining the maximum number of connections for the pool, I think it's strictly referring to the "[ .. ] maximum number of *active connections* that can be allocated from this pool at the same time. [ .. ]" (emphasis mine on active connections) Here is the doc that I've been referring to - sorry for not linking it earlier: https://urldefense.com/v3/__https://tomcat.apache.org/tomcat-9.0-doc/jdbc-pool.html__;!!Li8W9_Um1Taa!vJGrxr7yc86joO5r6QoNstpipfempGFqrYRe3_NyAIGNs-LenmBWhtjn1fRiAOex$ On those other Tomcat servers is there a initialSize defined? Jim -Original Message- From: Beard, Shawn Sent: Tuesday, December 15, 2020 2:49 PM To: Tomcat Users List Subject: RE: jdbc connction pool issues [EXTERNAL] But wouldn’t maxActive mean the connection pool has a max of 50 conenctions? On other tomcat servers I have, maxActive is set to 50 and I verified im jmx that there are 50 max connections on the connection pool. Here though I checked jmx, sure enough, its max connections is 8. Shawn Beard Sr. Systems Engineer | BTS Middleware Engineering | +1-515-564-2528 | sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> -Original Message- From: Johnson, Jim Sent: Tuesday, December 15, 2020 1:35 PM To: Tomcat Users List Subject: RE: jdbc connction pool issues [EXTERNAL] ** CAUTION: External message Hi Shawn, I think you’re missing initialSize initialSize (int)The initial number of connections that are created when the pool is started. Default value is 10 maxActive (int) The maximum number of active connections that can be allocated from this pool at the same time. The default value is 100 It would make sense that 8 connections would be 80% utilized. I would try replacing maxActive with initialSize and seeing how that works for you. Good luck! - Jim From: Beard, Shawn Sent: Tuesday, December 15, 2020 2:12 PM To: Tomcat Users List Subject: jdbc connction pool issues CAUTION EXTERNAL EMAIL: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe. We have this jdbc connection pool set up: However we are getting this error: Resource Pool Limit Reached Time 12/15/20 11:48:00 AM Summary JDBC Connection Pool Catalina:class=javax.sql.DataSource,context=/XX,host=X,name="jdbc/DataSource",type=DataSource has reached 80% limit. Current pool size [8, Max pool size [8] Shouldn’t the max connections of the connection pool be 50 since maxActive is 50? Shawn Beard • Sr. Systems Engineer Middleware Engineering [cid:image003.png@01D6D2E3.D5F1EFA0] 3840 109th Street Urbandale, IA 50322 Phone: +1-515-564-2528 Email: sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> Website: berkleytechnologyservices.com<https://urldefense.com/v3/__https://nam05.safelinks.protection.outlook.com/?url=https*3A*2F*2Furldefense.com*2Fv3*2F__https*3A*2F*2Fnam05.safelinks.protection.outlook.com*2F*3Furl*3Dhttps*3A*2F*2Fwww.berkleytechnologyservices.com*2F*26data*3D04*7C01*7CJ1Johnson*40unum.com*7C64e6e4965acb42aebfe708d8a12d798c*7Cd5952c785d4e41caaff07174c1f75393*7C0*7C0*7C637436563975240326*7CUnknown*7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0*3D*7C3000*26sdata*3D3nTT6swXEeC2zC*2BUb7Q7nvgxM214SGf7HJaI*2F4*2BYupA*3D*26reserved*3D0__*3BJSUlJSUlJSUlJSUlJSUlJSUlJSU!!Li8W9_Um1Taa!qrMl5L--I8QMohhvL9LXmHKdJz0jf2lM2XTvoH8FwyisGVhxNJdYs74vjiQ2KJgp*24data=04*7C01*7CJ1Johnson*40unum.com*7C016565a918474642884608d8a1328579*7Cd5952c785d4e41caaff07174c1f75393*7C0*7C0*7C637436585655273329*7CUnknown*7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0*3D*7C2000sdata=tBYkHrqnGHyaJPmtqrHIB5LPJLsZfdU4YdsK2JFVwAo*3Dreserved=0__;JSUlJSUlJSUlJSUqKioqJSUqKioqKioqKioqKiolJSoqKiolJSUlJSUlJSUlJSUlJSUlJQ!!Li8W9_Um1Taa!vJGrxr7yc86joO5r6QoNstpipfempGFqrYRe3_NyAIGNs-LenmBWhtjn1ZVqcYXS$ > Technology Leadership Unleashing Business Potential Shawn Beard Sr. Systems Engineer | BTS Middleware Engineering | +1-515-564-2528 | sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> CONFIDENTIALITY NOTICE: This e-mail and the
RE: jdbc connction pool issues [EXTERNAL]
Hi Shawn, No, I don't think that maxActive means that it's defining the maximum number of connections for the pool, I think it's strictly referring to the "[ .. ] maximum number of *active connections* that can be allocated from this pool at the same time. [ .. ]" (emphasis mine on active connections) Here is the doc that I've been referring to - sorry for not linking it earlier: https://tomcat.apache.org/tomcat-9.0-doc/jdbc-pool.html On those other Tomcat servers is there a initialSize defined? Jim -Original Message- From: Beard, Shawn Sent: Tuesday, December 15, 2020 2:49 PM To: Tomcat Users List Subject: RE: jdbc connction pool issues [EXTERNAL] But wouldn’t maxActive mean the connection pool has a max of 50 conenctions? On other tomcat servers I have, maxActive is set to 50 and I verified im jmx that there are 50 max connections on the connection pool. Here though I checked jmx, sure enough, its max connections is 8. Shawn Beard Sr. Systems Engineer | BTS Middleware Engineering | +1-515-564-2528 | sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> -Original Message- From: Johnson, Jim Sent: Tuesday, December 15, 2020 1:35 PM To: Tomcat Users List Subject: RE: jdbc connction pool issues [EXTERNAL] ** CAUTION: External message Hi Shawn, I think you’re missing initialSize initialSize (int)The initial number of connections that are created when the pool is started. Default value is 10 maxActive (int) The maximum number of active connections that can be allocated from this pool at the same time. The default value is 100 It would make sense that 8 connections would be 80% utilized. I would try replacing maxActive with initialSize and seeing how that works for you. Good luck! - Jim From: Beard, Shawn Sent: Tuesday, December 15, 2020 2:12 PM To: Tomcat Users List Subject: jdbc connction pool issues CAUTION EXTERNAL EMAIL: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe. We have this jdbc connection pool set up: However we are getting this error: Resource Pool Limit Reached Time 12/15/20 11:48:00 AM Summary JDBC Connection Pool Catalina:class=javax.sql.DataSource,context=/XX,host=X,name="jdbc/DataSource",type=DataSource has reached 80% limit. Current pool size [8, Max pool size [8] Shouldn’t the max connections of the connection pool be 50 since maxActive is 50? Shawn Beard • Sr. Systems Engineer Middleware Engineering [cid:image003.png@01D6D2E3.D5F1EFA0] 3840 109th Street Urbandale, IA 50322 Phone: +1-515-564-2528 Email: sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> Website: berkleytechnologyservices.com<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.com%2Fv3%2F__https%3A%2F%2Fnam05.safelinks.protection.outlook.com%2F%3Furl%3Dhttps*3A*2F*2Fwww.berkleytechnologyservices.com*2F%26data%3D04*7C01*7CJ1Johnson*40unum.com*7C64e6e4965acb42aebfe708d8a12d798c*7Cd5952c785d4e41caaff07174c1f75393*7C0*7C0*7C637436563975240326*7CUnknown*7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0*3D*7C3000%26sdata%3D3nTT6swXEeC2zC*2BUb7Q7nvgxM214SGf7HJaI*2F4*2BYupA*3D%26reserved%3D0__%3BJSUlJSUlJSUlJSUlJSUlJSUlJSU!!Li8W9_Um1Taa!qrMl5L--I8QMohhvL9LXmHKdJz0jf2lM2XTvoH8FwyisGVhxNJdYs74vjiQ2KJgp%24data=04%7C01%7CJ1Johnson%40unum.com%7C016565a918474642884608d8a1328579%7Cd5952c785d4e41caaff07174c1f75393%7C0%7C0%7C637436585655273329%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000sdata=tBYkHrqnGHyaJPmtqrHIB5LPJLsZfdU4YdsK2JFVwAo%3Dreserved=0 > Technology Leadership Unleashing Business Potential Shawn Beard Sr. Systems Engineer | BTS Middleware Engineering | +1-515-564-2528 | sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> CONFIDENTIALITY NOTICE: This e-mail and the transmitted documents contain private, privileged and confidential information belonging to the sender. The information therein is solely for the use of the addressee. If your receipt of this transmission has occurred as the result of an error, please immediately notify us so we can arrange for the return of the documents. In such circumstances, you are advised that you may not disclose, copy, distribute or take any other action in reliance on the information transmitted. CONFIDENTIALITY NOTICE: This e-mail and the transmitted documents contain private, privileged and confidential information belonging to the sender. The information therein is solely for the use of the addressee. If your receipt of this transmission has occurred as the result of an error, please immediately notify us so we can arrange for the return of the documents. In such circumstances, you are advised that you may not disclose, copy, distribute or take any other action in reliance on the information transmitted.
RE: jdbc connction pool issues [EXTERNAL]
Hi Shawn, I can't speak to that monitoring tool or why it reports that way. I do see what you're saying though - I would expect the error message to be something like: >>name="jdbc/DataSource",type=DataSource has reached 80% limit. >>Current pool size [8, Max pool size [10] However, it could be that the number of maxActive connections at the time was 8 and they simply labeled it incorrectly. From my perspective it seemed that if you're getting an alert at 80% pool size and the current pool size is 8 then you're probably looking for a default setting of 10 somewhere that isn't being set and initialSize seemed like a good candidate for that setting. Perhaps you might check your monitoring tool thresholds - I would have to think that 80% is setting off bells and whistles so you have time to act before your JVM blows up. Cheers! - Jim -Original Message- From: Beard, Shawn Sent: Tuesday, December 15, 2020 2:42 PM To: Tomcat Users List Subject: RE: jdbc connction pool issues [EXTERNAL] If default is 10, they why would we be getting an error about 8 being max? Shawn Beard Sr. Systems Engineer | BTS Middleware Engineering | +1-515-564-2528 | sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> -Original Message- From: Johnson, Jim Sent: Tuesday, December 15, 2020 1:35 PM To: Tomcat Users List Subject: RE: jdbc connction pool issues [EXTERNAL] ** CAUTION: External message Hi Shawn, I think you’re missing initialSize initialSize (int)The initial number of connections that are created when the pool is started. Default value is 10 maxActive (int) The maximum number of active connections that can be allocated from this pool at the same time. The default value is 100 It would make sense that 8 connections would be 80% utilized. I would try replacing maxActive with initialSize and seeing how that works for you. Good luck! - Jim From: Beard, Shawn Sent: Tuesday, December 15, 2020 2:12 PM To: Tomcat Users List Subject: jdbc connction pool issues CAUTION EXTERNAL EMAIL: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe. We have this jdbc connection pool set up: However we are getting this error: Resource Pool Limit Reached Time 12/15/20 11:48:00 AM Summary JDBC Connection Pool Catalina:class=javax.sql.DataSource,context=/XX,host=X,name="jdbc/DataSource",type=DataSource has reached 80% limit. Current pool size [8, Max pool size [8] Shouldn’t the max connections of the connection pool be 50 since maxActive is 50? Shawn Beard • Sr. Systems Engineer Middleware Engineering [cid:image003.png@01D6D2E3.D5F1EFA0] 3840 109th Street Urbandale, IA 50322 Phone: +1-515-564-2528 Email: sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> Website: berkleytechnologyservices.com<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.com%2Fv3%2F__https%3A%2F%2Fnam05.safelinks.protection.outlook.com%2F%3Furl%3Dhttps*3A*2F*2Fwww.berkleytechnologyservices.com*2F%26data%3D04*7C01*7CJ1Johnson*40unum.com*7C64e6e4965acb42aebfe708d8a12d798c*7Cd5952c785d4e41caaff07174c1f75393*7C0*7C0*7C637436563975240326*7CUnknown*7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0*3D*7C3000%26sdata%3D3nTT6swXEeC2zC*2BUb7Q7nvgxM214SGf7HJaI*2F4*2BYupA*3D%26reserved%3D0__%3BJSUlJSUlJSUlJSUlJSUlJSUlJSU!!Li8W9_Um1Taa!qrMl5L--I8QMohhvL9LXmHKdJz0jf2lM2XTvoH8FwyisGVhxNJdYs74vjiQ2KJgp%24data=04%7C01%7CJ1Johnson%40unum.com%7C45da4026f80749aa4a4308d8a131bb92%7Cd5952c785d4e41caaff07174c1f75393%7C0%7C0%7C637436582286624695%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000sdata=SsGXcy8tkFZxQlLMGWv1%2BZGKqnkiDRx3UvGWqo72a7o%3Dreserved=0 > Technology Leadership Unleashing Business Potential Shawn Beard Sr. Systems Engineer | BTS Middleware Engineering | +1-515-564-2528 | sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> CONFIDENTIALITY NOTICE: This e-mail and the transmitted documents contain private, privileged and confidential information belonging to the sender. The information therein is solely for the use of the addressee. If your receipt of this transmission has occurred as the result of an error, please immediately notify us so we can arrange for the return of the documents. In such circumstances, you are advised that you may not disclose, copy, distribute or take any other action in reliance on the information transmitted. CONFIDENTIALITY NOTICE: This e-mail and the transmitted documents contain private, privileged and confidential information belonging to the sender. The information therein is solely for the use of the addressee. If your receipt of this transmission has occurred as the result of an error, please immediately notify us so we can arrange for the return of the doc
RE: jdbc connction pool issues [EXTERNAL]
But wouldn’t maxActive mean the connection pool has a max of 50 conenctions? On other tomcat servers I have, maxActive is set to 50 and I verified im jmx that there are 50 max connections on the connection pool. Here though I checked jmx, sure enough, its max connections is 8. Shawn Beard Sr. Systems Engineer | BTS Middleware Engineering | +1-515-564-2528 | sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> -Original Message- From: Johnson, Jim Sent: Tuesday, December 15, 2020 1:35 PM To: Tomcat Users List Subject: RE: jdbc connction pool issues [EXTERNAL] ** CAUTION: External message Hi Shawn, I think you’re missing initialSize initialSize (int)The initial number of connections that are created when the pool is started. Default value is 10 maxActive (int) The maximum number of active connections that can be allocated from this pool at the same time. The default value is 100 It would make sense that 8 connections would be 80% utilized. I would try replacing maxActive with initialSize and seeing how that works for you. Good luck! - Jim From: Beard, Shawn Sent: Tuesday, December 15, 2020 2:12 PM To: Tomcat Users List Subject: jdbc connction pool issues CAUTION EXTERNAL EMAIL: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe. We have this jdbc connection pool set up: However we are getting this error: Resource Pool Limit Reached Time 12/15/20 11:48:00 AM Summary JDBC Connection Pool Catalina:class=javax.sql.DataSource,context=/XX,host=X,name="jdbc/DataSource",type=DataSource has reached 80% limit. Current pool size [8, Max pool size [8] Shouldn’t the max connections of the connection pool be 50 since maxActive is 50? Shawn Beard • Sr. Systems Engineer Middleware Engineering [cid:image003.png@01D6D2E3.D5F1EFA0] 3840 109th Street Urbandale, IA 50322 Phone: +1-515-564-2528 Email: sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> Website: berkleytechnologyservices.com<https://urldefense.com/v3/__https://nam05.safelinks.protection.outlook.com/?url=https*3A*2F*2Fwww.berkleytechnologyservices.com*2F=04*7C01*7CJ1Johnson*40unum.com*7C64e6e4965acb42aebfe708d8a12d798c*7Cd5952c785d4e41caaff07174c1f75393*7C0*7C0*7C637436563975240326*7CUnknown*7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0*3D*7C3000=3nTT6swXEeC2zC*2BUb7Q7nvgxM214SGf7HJaI*2F4*2BYupA*3D=0__;JSUlJSUlJSUlJSUlJSUlJSUlJSU!!Li8W9_Um1Taa!qrMl5L--I8QMohhvL9LXmHKdJz0jf2lM2XTvoH8FwyisGVhxNJdYs74vjiQ2KJgp$ > Technology Leadership Unleashing Business Potential Shawn Beard Sr. Systems Engineer | BTS Middleware Engineering | +1-515-564-2528 | sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> CONFIDENTIALITY NOTICE: This e-mail and the transmitted documents contain private, privileged and confidential information belonging to the sender. The information therein is solely for the use of the addressee. If your receipt of this transmission has occurred as the result of an error, please immediately notify us so we can arrange for the return of the documents. In such circumstances, you are advised that you may not disclose, copy, distribute or take any other action in reliance on the information transmitted. CONFIDENTIALITY NOTICE: This e-mail and the transmitted documents contain private, privileged and confidential information belonging to the sender. The information therein is solely for the use of the addressee. If your receipt of this transmission has occurred as the result of an error, please immediately notify us so we can arrange for the return of the documents. In such circumstances, you are advised that you may not disclose, copy, distribute or take any other action in reliance on the information transmitted.
RE: jdbc connction pool issues [EXTERNAL]
If default is 10, they why would we be getting an error about 8 being max? Shawn Beard Sr. Systems Engineer | BTS Middleware Engineering | +1-515-564-2528 | sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> -Original Message- From: Johnson, Jim Sent: Tuesday, December 15, 2020 1:35 PM To: Tomcat Users List Subject: RE: jdbc connction pool issues [EXTERNAL] ** CAUTION: External message Hi Shawn, I think you’re missing initialSize initialSize (int)The initial number of connections that are created when the pool is started. Default value is 10 maxActive (int) The maximum number of active connections that can be allocated from this pool at the same time. The default value is 100 It would make sense that 8 connections would be 80% utilized. I would try replacing maxActive with initialSize and seeing how that works for you. Good luck! - Jim From: Beard, Shawn Sent: Tuesday, December 15, 2020 2:12 PM To: Tomcat Users List Subject: jdbc connction pool issues CAUTION EXTERNAL EMAIL: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe. We have this jdbc connection pool set up: However we are getting this error: Resource Pool Limit Reached Time 12/15/20 11:48:00 AM Summary JDBC Connection Pool Catalina:class=javax.sql.DataSource,context=/XX,host=X,name="jdbc/DataSource",type=DataSource has reached 80% limit. Current pool size [8, Max pool size [8] Shouldn’t the max connections of the connection pool be 50 since maxActive is 50? Shawn Beard • Sr. Systems Engineer Middleware Engineering [cid:image003.png@01D6D2E3.D5F1EFA0] 3840 109th Street Urbandale, IA 50322 Phone: +1-515-564-2528 Email: sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> Website: berkleytechnologyservices.com<https://urldefense.com/v3/__https://nam05.safelinks.protection.outlook.com/?url=https*3A*2F*2Fwww.berkleytechnologyservices.com*2F=04*7C01*7CJ1Johnson*40unum.com*7C64e6e4965acb42aebfe708d8a12d798c*7Cd5952c785d4e41caaff07174c1f75393*7C0*7C0*7C637436563975240326*7CUnknown*7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0*3D*7C3000=3nTT6swXEeC2zC*2BUb7Q7nvgxM214SGf7HJaI*2F4*2BYupA*3D=0__;JSUlJSUlJSUlJSUlJSUlJSUlJSU!!Li8W9_Um1Taa!qrMl5L--I8QMohhvL9LXmHKdJz0jf2lM2XTvoH8FwyisGVhxNJdYs74vjiQ2KJgp$ > Technology Leadership Unleashing Business Potential Shawn Beard Sr. Systems Engineer | BTS Middleware Engineering | +1-515-564-2528 | sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> CONFIDENTIALITY NOTICE: This e-mail and the transmitted documents contain private, privileged and confidential information belonging to the sender. The information therein is solely for the use of the addressee. If your receipt of this transmission has occurred as the result of an error, please immediately notify us so we can arrange for the return of the documents. In such circumstances, you are advised that you may not disclose, copy, distribute or take any other action in reliance on the information transmitted. CONFIDENTIALITY NOTICE: This e-mail and the transmitted documents contain private, privileged and confidential information belonging to the sender. The information therein is solely for the use of the addressee. If your receipt of this transmission has occurred as the result of an error, please immediately notify us so we can arrange for the return of the documents. In such circumstances, you are advised that you may not disclose, copy, distribute or take any other action in reliance on the information transmitted.
RE: jdbc connction pool issues
Hi Shawn, I think you’re missing initialSize initialSize (int)The initial number of connections that are created when the pool is started. Default value is 10 maxActive (int) The maximum number of active connections that can be allocated from this pool at the same time. The default value is 100 It would make sense that 8 connections would be 80% utilized. I would try replacing maxActive with initialSize and seeing how that works for you. Good luck! - Jim From: Beard, Shawn Sent: Tuesday, December 15, 2020 2:12 PM To: Tomcat Users List Subject: jdbc connction pool issues CAUTION EXTERNAL EMAIL: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe. We have this jdbc connection pool set up: However we are getting this error: Resource Pool Limit Reached Time 12/15/20 11:48:00 AM Summary JDBC Connection Pool Catalina:class=javax.sql.DataSource,context=/XX,host=X,name="jdbc/DataSource",type=DataSource has reached 80% limit. Current pool size [8, Max pool size [8] Shouldn’t the max connections of the connection pool be 50 since maxActive is 50? Shawn Beard • Sr. Systems Engineer Middleware Engineering [cid:image003.png@01D6D2E3.D5F1EFA0] 3840 109th Street Urbandale, IA 50322 Phone: +1-515-564-2528 Email: sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> Website: berkleytechnologyservices.com<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.berkleytechnologyservices.com%2F=04%7C01%7CJ1Johnson%40unum.com%7C64e6e4965acb42aebfe708d8a12d798c%7Cd5952c785d4e41caaff07174c1f75393%7C0%7C0%7C637436563975240326%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000=3nTT6swXEeC2zC%2BUb7Q7nvgxM214SGf7HJaI%2F4%2BYupA%3D=0> Technology Leadership Unleashing Business Potential Shawn Beard Sr. Systems Engineer | BTS Middleware Engineering | +1-515-564-2528 | sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> CONFIDENTIALITY NOTICE: This e-mail and the transmitted documents contain private, privileged and confidential information belonging to the sender. The information therein is solely for the use of the addressee. If your receipt of this transmission has occurred as the result of an error, please immediately notify us so we can arrange for the return of the documents. In such circumstances, you are advised that you may not disclose, copy, distribute or take any other action in reliance on the information transmitted.
jdbc connction pool issues
We have this jdbc connection pool set up: However we are getting this error: Resource Pool Limit Reached Time 12/15/20 11:48:00 AM Summary JDBC Connection Pool Catalina:class=javax.sql.DataSource,context=/XX,host=X,name="jdbc/DataSource",type=DataSource has reached 80% limit. Current pool size [8, Max pool size [8] Shouldn’t the max connections of the connection pool be 50 since maxActive is 50? Shawn Beard • Sr. Systems Engineer Middleware Engineering [cid:image085436.PNG@fbcb1466.43bb3916] 3840 109th Street Urbandale, IA 50322 Phone: +1-515-564-2528 Email: sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> Website: berkleytechnologyservices.com<https://www.berkleytechnologyservices.com/> Technology Leadership Unleashing Business Potential Shawn Beard Sr. Systems Engineer | BTS Middleware Engineering | +1-515-564-2528 | sbe...@wrberkley.com<mailto:sbe...@wrberkley.com> CONFIDENTIALITY NOTICE: This e-mail and the transmitted documents contain private, privileged and confidential information belonging to the sender. The information therein is solely for the use of the addressee. If your receipt of this transmission has occurred as the result of an error, please immediately notify us so we can arrange for the return of the documents. In such circumstances, you are advised that you may not disclose, copy, distribute or take any other action in reliance on the information transmitted.
Re: Problems configuring a JNDI JDBC pool to Postgres
On 27/11/2020 19:56, Hrafn Malmquist wrote: > Great. Thanks. > > Glad it was a simple fix. > > By the way, why would you choose DBCP2 over Tomcat? Intuitively, I would > assume a pool designed specifically for Tomcat would be more efficient than > a more generic Apache library? There is very little between them in terms of performance, especially if you configure them for equivalent behaviour. I'd summarise the differences as: - DBCP2 follows the JDBC specs a little more closely by default - jdbc-pool has marginally better performance under high load - jdbc-pool has better JMX monitoring - issues tend to get fixed sooner in DBCP2 I tend to value spec compliance so that gives DBCP2 the edge for me. Mark > > Hrafn > > > On Fri, Nov 27, 2020 at 8:24 AM Mark Thomas wrote: > >> On 26/11/2020 22:52, Hrafn Malmquist wrote: >>> A >>> >>> How silly of me. It's right there staring me in the face nested inside >> the >>> host in server.xml, right? >> >> Right. >> >> The changes to GlobalResources look good. >> >> You'll probably want to revert the change you made to appBase. >> >>> So, best practice is to remove contexts from host and place either under >>> [engine]/[host] or directly in META-INF in app? >> >> Generally, yes although I'd recommend changing one thing at a time so >> get the DataSource working before you start moving config files around. >> >> You'll want something like: >> >> >> > global="jdbc/dspaceWeb" >> type="javax.sql.DataSource" >> /> >> >> >> in server.xml >> >> Mark >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >> For additional commands, e-mail: users-h...@tomcat.apache.org >> >> > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Problems configuring a JNDI JDBC pool to Postgres
Great. Thanks. Glad it was a simple fix. By the way, why would you choose DBCP2 over Tomcat? Intuitively, I would assume a pool designed specifically for Tomcat would be more efficient than a more generic Apache library? Hrafn On Fri, Nov 27, 2020 at 8:24 AM Mark Thomas wrote: > On 26/11/2020 22:52, Hrafn Malmquist wrote: > > A > > > > How silly of me. It's right there staring me in the face nested inside > the > > host in server.xml, right? > > Right. > > The changes to GlobalResources look good. > > You'll probably want to revert the change you made to appBase. > > > So, best practice is to remove contexts from host and place either under > > [engine]/[host] or directly in META-INF in app? > > Generally, yes although I'd recommend changing one thing at a time so > get the DataSource working before you start moving config files around. > > You'll want something like: > > >global="jdbc/dspaceWeb" > type="javax.sql.DataSource" > /> > > > in server.xml > > Mark > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >
Re: Problems configuring a JNDI JDBC pool to Postgres
On 26/11/2020 22:52, Hrafn Malmquist wrote: > A > > How silly of me. It's right there staring me in the face nested inside the > host in server.xml, right? Right. The changes to GlobalResources look good. You'll probably want to revert the change you made to appBase. > So, best practice is to remove contexts from host and place either under > [engine]/[host] or directly in META-INF in app? Generally, yes although I'd recommend changing one thing at a time so get the DataSource working before you start moving config files around. You'll want something like: in server.xml Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Problems configuring a JNDI JDBC pool to Postgres
;> >> >2. In /home/lib/dspace/apache-tomcat-9.0.12/conf/server.xml I added >> the >> >following Resource >> > >> >> > factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" >> > type="javax.sql.DataSource" >> > auth="Container" >> > username="*" >> > password="**" >> > driverClassName="org.postgresql.Driver" >> > url="jdbc:postgresql://localhost:5432/dspace" >> > initialSize="5" >> > maxTotal="50" >> > maxIdle="15" >> > minIdle="5" /> >> >> Exactly where in server.xml did you put this? What element was it nested >> under? >> >> >There are a couple of issues that confuse me: >> >a) the official documentation about JNDI datasource examples [0] >> says "*This >> >author has not had success here, although others have reported so. >> >Clarification would be appreciated here." *in the section about >> >Postgres. In other words, we can't be sure this works? >> >> That text needs to be removed. The author clearly made an error in their >> config. This definitely works. >> >> >b) in the official documtation about JDBC connection pool it says >> that >> >if you want to define a JDBC connection pool in the Apache Container >> (which >> >I understand to be trying to do) you have to specify the factory >> attribute >> >and set the value to org.apache.tomcat.jdbc.pool.DataSourceFactory >> [1] >> >> Do you want to use Tomcat's jdbc-pool? If so leave the factory attribute >> as is. If you want to use Tomcat's built in copy for Apache Commons >> DBCP2, remove the factory attribute. >> >> Personally, I'd go with DBCP2 but either should work. >> >> >3. Created a context.xml in /dspace/webapps/xmlui/META-INF/ >> >> I think this is the problem. That location looks to be outside of the >> default appBase. If I'm right, there is already a Context element >> defined for this web application somewhere else. You need to find that >> Context definition and add the ResourceLink to it. >> >> > >> >>> name="jdbc/dspace" >> > global="jdbc/dspaceWeb" >> > type="javax.sql.DataSource" >> >/> >> > >> >> Mark >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >> For additional commands, e-mail: users-h...@tomcat.apache.org >> >>
Re: Problems configuring a JNDI JDBC pool to Postgres
Hello Rob and Mark and others Thanks for your input. > >2. In /home/lib/dspace/apache-tomcat-9.0.12/conf/server.xml I added the > >following Resource > > > > > factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" > > type="javax.sql.DataSource" > > auth="Container" > > username="*" > > password="**" > > driverClassName="org.postgresql.Driver" > > url="jdbc:postgresql://localhost:5432/dspace" > > initialSize="5" > > maxTotal="50" > > maxIdle="15" > > minIdle="5" /> > > Exactly where in server.xml did you put this? What element was it nested > under? I should have made clear, it's nested under which is in turn nested under . I have removed the factory attribute and it now reads: > >3. Created a context.xml in /dspace/webapps/xmlui/META-INF/ > > I think this is the problem. That location looks to be outside of the > default appBase. If I'm right, there is already a Context element > defined for this web application somewhere else. You need to find that > Context definition and add the ResourceLink to it. Right. It is indeed possible that the underlying configuration is not set up correctly. This is the relevant extract from server.xml: Host appBase for the domain earlier said "webapps", like it still does for localhost, but I changed to "dspace/webapps". No change when I restart Tomcat. Under /home/lib/dspace/apache-tomcat-9.0.12/conf/Catalina there are folders for the hosts that have been set up on the server but none of them contain files. I am not sure where to look elsewhere for this Context element. Any ideas? Hrafn On Thu, Nov 26, 2020 at 9:30 PM Mark Thomas wrote: > On 26/11/2020 19:57, Hrafn Malmquist wrote: > > > > > I am running: > > > > CentOS Linux release 7.8.2003 > > Tomcat 9.0.12 > > PostgreSQL 9.5.23 > > openjdk version "1.8.0_262" > > OpenJDK Runtime Environment (build 1.8.0_262-b10) > > There are good reasons to update to a more recent Tomcat 9 release but > I'm not aware of any fixes that would impact the specific issue you are > currently seeing. > > >1. I downloaded postgresql-42.2.18.jar from > >https://jdbc.postgresql.org/download/postgresql-42.2.18.jar and > placed > >it in /home/lib/dspace/apache-tomcat-9.0.12/lib > > OK. That looks good. > > >2. In /home/lib/dspace/apache-tomcat-9.0.12/conf/server.xml I added > the > >following Resource > > > > > factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" > > type="javax.sql.DataSource" > > auth="Container" > > username="*" > > password="**" > > driverClassName="org.postgresql.Driver" > > url="jdbc:postgresql://localhost:5432/dspace" > > initialSize="5" > > maxTotal="50" > > maxIdle="15" > > minIdle="5" /> > > Exactly where in server.xml did you put this? What element was it nested > under? > > >There are a couple of issues that confuse me: > >a) the official documentation about JNDI datasource examples [0] says > "*This > >author has not had success here, although others have reported so. > >Clarification would be appreciated here." *in the section about > >Postgres. In other words, we can't be sure this works? > > That text needs to be removed. The author clearly made an error in their > config. This definitely works. > > >b) in the official documtation about JDBC connection pool it says that > >if you want to define a JDBC connection pool in the Apache Container > (which > >I understand to be trying to do) you have to specify the factory > attribute > >and set the value to org.apache.tomcat.jdbc.pool.DataSourceFactory [1] > > Do you want to use Tomcat's jdbc-pool? If so leave the factory attribute > as is. If you want to use Tomcat's built in copy for Apache Commons > DBCP2, remove the factory attribute. > > Personally, I'd go with DBCP2 but either should work. > > >3. Created a context.xml in /dspace/webapps/xmlui/META-INF/ > > I think this is the problem. That location looks to be outside of the > default appBase. If I'm right, there is already a Context element > defined for this web application somewhere else. You need to find that > Context definition and add the ResourceLink to it. > > > > >> name="jdbc/dspace" > > global="jdbc/dspaceWeb" > > type="javax.sql.DataSource" > >/> > > > > Mark > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >
Re: Problems configuring a JNDI JDBC pool to Postgres
On 26/11/2020 19:57, Hrafn Malmquist wrote: > I am running: > > CentOS Linux release 7.8.2003 > Tomcat 9.0.12 > PostgreSQL 9.5.23 > openjdk version "1.8.0_262" > OpenJDK Runtime Environment (build 1.8.0_262-b10) There are good reasons to update to a more recent Tomcat 9 release but I'm not aware of any fixes that would impact the specific issue you are currently seeing. >1. I downloaded postgresql-42.2.18.jar from >https://jdbc.postgresql.org/download/postgresql-42.2.18.jar and placed >it in /home/lib/dspace/apache-tomcat-9.0.12/lib OK. That looks good. >2. In /home/lib/dspace/apache-tomcat-9.0.12/conf/server.xml I added the >following Resource > > factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" > type="javax.sql.DataSource" > auth="Container" > username="*" > password="**" > driverClassName="org.postgresql.Driver" > url="jdbc:postgresql://localhost:5432/dspace" > initialSize="5" > maxTotal="50" > maxIdle="15" > minIdle="5" /> Exactly where in server.xml did you put this? What element was it nested under? >There are a couple of issues that confuse me: >a) the official documentation about JNDI datasource examples [0] says > "*This >author has not had success here, although others have reported so. >Clarification would be appreciated here." *in the section about >Postgres. In other words, we can't be sure this works? That text needs to be removed. The author clearly made an error in their config. This definitely works. >b) in the official documtation about JDBC connection pool it says that >if you want to define a JDBC connection pool in the Apache Container (which >I understand to be trying to do) you have to specify the factory attribute >and set the value to org.apache.tomcat.jdbc.pool.DataSourceFactory [1] Do you want to use Tomcat's jdbc-pool? If so leave the factory attribute as is. If you want to use Tomcat's built in copy for Apache Commons DBCP2, remove the factory attribute. Personally, I'd go with DBCP2 but either should work. >3. Created a context.xml in /dspace/webapps/xmlui/META-INF/ I think this is the problem. That location looks to be outside of the default appBase. If I'm right, there is already a Context element defined for this web application somewhere else. You need to find that Context definition and add the ResourceLink to it. > >> name="jdbc/dspace" > global="jdbc/dspaceWeb" > type="javax.sql.DataSource" >/> > Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Problems configuring a JNDI JDBC pool to Postgres
On 26/11/2020 21:01, Rob Sargent wrote: > Looks like you named your resource jdbc/dspaceWeb and dropped the Web in your > lookup Nope. You are confusing the global and local name. The config looks right on first glance. Mark > >> On Nov 26, 2020, at 12:58 PM, Hrafn Malmquist >> wrote: >> >> Good day fellow Apache Tomcat users >> >> I have recently had reason to set a Postgres DataSource via the Tomcat JNDI >> api. My experiments have been largely unsuccessful, unfortunately I hope >> you are able to help me. I thank you in advance for taking the time to read >> this. >> >> I am coming to this problem in a rather backward way. I am not familiar >> with deploying web applications through Tomcat, this is something that was >> done in a semi-automated way and replicated so that a close look has not >> really been necessary for me until now. >> >> To provide a bit of context, the web server where I am trying to set up a >> Postgres JNDI globally shared connection is running running several DSpace >> webapps. >> >> I have been largely assisted by the official documentation here [0] and >> here [1] as well as DSpace documentation here [2] and discussion on a user >> mailing list for DSpace here [3]. >> >> I am running: >> >> CentOS Linux release 7.8.2003 >> Tomcat 9.0.12 >> PostgreSQL 9.5.23 >> openjdk version "1.8.0_262" >> OpenJDK Runtime Environment (build 1.8.0_262-b10) >> >> >> 1. I downloaded postgresql-42.2.18.jar from >> https://jdbc.postgresql.org/download/postgresql-42.2.18.jar and placed >> it in /home/lib/dspace/apache-tomcat-9.0.12/lib >> 2. In /home/lib/dspace/apache-tomcat-9.0.12/conf/server.xml I added the >> following Resource >> >> > factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" >> type="javax.sql.DataSource" >> auth="Container" >> username="*" >> password="**" >> driverClassName="org.postgresql.Driver" >> url="jdbc:postgresql://localhost:5432/dspace" >> initialSize="5" >> maxTotal="50" >> maxIdle="15" >> minIdle="5" /> >> >> There are a couple of issues that confuse me: >> a) the official documentation about JNDI datasource examples [0] says >> "*This >> author has not had success here, although others have reported so. >> Clarification would be appreciated here." *in the section about >> Postgres. In other words, we can't be sure this works? >> b) in the official documtation about JDBC connection pool it says that >> if you want to define a JDBC connection pool in the Apache Container (which >> I understand to be trying to do) you have to specify the factory attribute >> and set the value to org.apache.tomcat.jdbc.pool.DataSourceFactory [1] >> >> This is not done in the example (that the author hasn't had success >> with?) in a) >> 3. Created a context.xml in /dspace/webapps/xmlui/META-INF/ >> >> >> > global="jdbc/dspaceWeb" >> type="javax.sql.DataSource" >> /> >> >> >> >> When I start up Tomcat howere. I get this in the log: >> >> INFO [org.springframework.jndi.JndiObjectFactoryBean] JNDI lookup failed - >> returning specified default object instead: >> javax.naming.NameNotFoundException: Name [jdbc/dspace] is not bound in this >> Context. Unable to find [jdbc]. >> >> My understanding is that the webapp, DSpace, tried to look for a JNDI >> object in the namespace "jdbc/dspace" and barring that, falls back to >> instantiating it's own DataSource as a bean. See [4] >> >> But I don't understand why the above doesn't work. >> >> Thanks for your time >> >> Sources: >> [0] : >> https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#PostgreSQL >> [1] : >> https://tomcat.apache.org/tomcat-9.0-doc/jdbc-pool.html#Inside_the_Apache_Tomcat_Container >> [2] : >> https://wiki.lyrasis.org/display/DSDOC6x/Installing+DSpace#InstallingDSpace-Externaldatabaseconnectionpool >> [3] : >> http://dspace.2283337.n4.nabble.com/Notes-on-PostgreSQL-connection-pooling-with-a-Tomcat-JNDI-resource-td4687149.html >> [4]: >> https://github.com/DSpace/DSpace/blob/dspace-6_x/dspace/config/spring/api/core-hibernate.xml > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Problems configuring a JNDI JDBC pool to Postgres
Looks like you named your resource jdbc/dspaceWeb and dropped the Web in your lookup > On Nov 26, 2020, at 12:58 PM, Hrafn Malmquist > wrote: > > Good day fellow Apache Tomcat users > > I have recently had reason to set a Postgres DataSource via the Tomcat JNDI > api. My experiments have been largely unsuccessful, unfortunately I hope > you are able to help me. I thank you in advance for taking the time to read > this. > > I am coming to this problem in a rather backward way. I am not familiar > with deploying web applications through Tomcat, this is something that was > done in a semi-automated way and replicated so that a close look has not > really been necessary for me until now. > > To provide a bit of context, the web server where I am trying to set up a > Postgres JNDI globally shared connection is running running several DSpace > webapps. > > I have been largely assisted by the official documentation here [0] and > here [1] as well as DSpace documentation here [2] and discussion on a user > mailing list for DSpace here [3]. > > I am running: > > CentOS Linux release 7.8.2003 > Tomcat 9.0.12 > PostgreSQL 9.5.23 > openjdk version "1.8.0_262" > OpenJDK Runtime Environment (build 1.8.0_262-b10) > > > 1. I downloaded postgresql-42.2.18.jar from > https://jdbc.postgresql.org/download/postgresql-42.2.18.jar and placed > it in /home/lib/dspace/apache-tomcat-9.0.12/lib > 2. In /home/lib/dspace/apache-tomcat-9.0.12/conf/server.xml I added the > following Resource > >factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" > type="javax.sql.DataSource" > auth="Container" > username="*" > password="**" > driverClassName="org.postgresql.Driver" > url="jdbc:postgresql://localhost:5432/dspace" > initialSize="5" > maxTotal="50" > maxIdle="15" > minIdle="5" /> > > There are a couple of issues that confuse me: > a) the official documentation about JNDI datasource examples [0] says "*This > author has not had success here, although others have reported so. > Clarification would be appreciated here." *in the section about > Postgres. In other words, we can't be sure this works? > b) in the official documtation about JDBC connection pool it says that > if you want to define a JDBC connection pool in the Apache Container (which > I understand to be trying to do) you have to specify the factory attribute > and set the value to org.apache.tomcat.jdbc.pool.DataSourceFactory [1] > > This is not done in the example (that the author hasn't had success > with?) in a) > 3. Created a context.xml in /dspace/webapps/xmlui/META-INF/ > > > global="jdbc/dspaceWeb" > type="javax.sql.DataSource" > /> > > > > When I start up Tomcat howere. I get this in the log: > > INFO [org.springframework.jndi.JndiObjectFactoryBean] JNDI lookup failed - > returning specified default object instead: > javax.naming.NameNotFoundException: Name [jdbc/dspace] is not bound in this > Context. Unable to find [jdbc]. > > My understanding is that the webapp, DSpace, tried to look for a JNDI > object in the namespace "jdbc/dspace" and barring that, falls back to > instantiating it's own DataSource as a bean. See [4] > > But I don't understand why the above doesn't work. > > Thanks for your time > > Sources: > [0] : > https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#PostgreSQL > [1] : > https://tomcat.apache.org/tomcat-9.0-doc/jdbc-pool.html#Inside_the_Apache_Tomcat_Container > [2] : > https://wiki.lyrasis.org/display/DSDOC6x/Installing+DSpace#InstallingDSpace-Externaldatabaseconnectionpool > [3] : > http://dspace.2283337.n4.nabble.com/Notes-on-PostgreSQL-connection-pooling-with-a-Tomcat-JNDI-resource-td4687149.html > [4]: > https://github.com/DSpace/DSpace/blob/dspace-6_x/dspace/config/spring/api/core-hibernate.xml - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Problems configuring a JNDI JDBC pool to Postgres
Good day fellow Apache Tomcat users I have recently had reason to set a Postgres DataSource via the Tomcat JNDI api. My experiments have been largely unsuccessful, unfortunately I hope you are able to help me. I thank you in advance for taking the time to read this. I am coming to this problem in a rather backward way. I am not familiar with deploying web applications through Tomcat, this is something that was done in a semi-automated way and replicated so that a close look has not really been necessary for me until now. To provide a bit of context, the web server where I am trying to set up a Postgres JNDI globally shared connection is running running several DSpace webapps. I have been largely assisted by the official documentation here [0] and here [1] as well as DSpace documentation here [2] and discussion on a user mailing list for DSpace here [3]. I am running: CentOS Linux release 7.8.2003 Tomcat 9.0.12 PostgreSQL 9.5.23 openjdk version "1.8.0_262" OpenJDK Runtime Environment (build 1.8.0_262-b10) 1. I downloaded postgresql-42.2.18.jar from https://jdbc.postgresql.org/download/postgresql-42.2.18.jar and placed it in /home/lib/dspace/apache-tomcat-9.0.12/lib 2. In /home/lib/dspace/apache-tomcat-9.0.12/conf/server.xml I added the following Resource There are a couple of issues that confuse me: a) the official documentation about JNDI datasource examples [0] says "*This author has not had success here, although others have reported so. Clarification would be appreciated here." *in the section about Postgres. In other words, we can't be sure this works? b) in the official documtation about JDBC connection pool it says that if you want to define a JDBC connection pool in the Apache Container (which I understand to be trying to do) you have to specify the factory attribute and set the value to org.apache.tomcat.jdbc.pool.DataSourceFactory [1] This is not done in the example (that the author hasn't had success with?) in a) 3. Created a context.xml in /dspace/webapps/xmlui/META-INF/ When I start up Tomcat howere. I get this in the log: INFO [org.springframework.jndi.JndiObjectFactoryBean] JNDI lookup failed - returning specified default object instead: javax.naming.NameNotFoundException: Name [jdbc/dspace] is not bound in this Context. Unable to find [jdbc]. My understanding is that the webapp, DSpace, tried to look for a JNDI object in the namespace "jdbc/dspace" and barring that, falls back to instantiating it's own DataSource as a bean. See [4] But I don't understand why the above doesn't work. Thanks for your time Sources: [0] : https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#PostgreSQL [1] : https://tomcat.apache.org/tomcat-9.0-doc/jdbc-pool.html#Inside_the_Apache_Tomcat_Container [2] : https://wiki.lyrasis.org/display/DSDOC6x/Installing+DSpace#InstallingDSpace-Externaldatabaseconnectionpool [3] : http://dspace.2283337.n4.nabble.com/Notes-on-PostgreSQL-connection-pooling-with-a-Tomcat-JNDI-resource-td4687149.html [4]: https://github.com/DSpace/DSpace/blob/dspace-6_x/dspace/config/spring/api/core-hibernate.xml
Re: Tomcat JDBC Pool Cleaner Deadlock Problem
Am 31.08.20 um 18:53 schrieb Phil Steitz: > > On 8/31/20 3:21 AM, Felix Schumacher wrote: >> Am 31.08.20 um 06:15 schrieb Gokhan Akgul: >>> Dear Phil , >>> Thanks for your feedback. I forgot to mention the mysql driver >>> version. The >>> Mysql driver version is 5.1.32. >>> My plan is to upgrade the mysql driver to 5.1.46 version and monitor >>> for a >>> while. >> If I read the bug report correctly, MySQL will not change its logic and >> therefore using newer versions of the driver will not help. > > Yeah. There was a comment in another related bug report about > changing the locking model in 5.1.x, so it is possible a later version > will help, but you are right that it probably won't. > >> >> What MySQL advises is to change the pool to use the abort-Method of the >> connection to close it in the case of abandoned connections. >> >> The dbcp2 pools seems to be able to use that method, while I found no >> reference to it in the jdbc-pool module (which you are using). > > We are talking about making that change on commons-dev now [1], but > currently dbcp2 uses close as jdbc-pool does. You are of course right, I just grepped the sources for abort and skimmed the comments. Should have looked more closely. Felix > > Comments / patches welcome! > > Phil > >> >> So, maybe it is a good idea to switch the used pool from the jdbc-pool >> to the default tomcat pool (see >> http://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html). >> >> It should work equally well (I am not sure, if it supports something >> like the slowqueryreport, though). If you want to continue using the old >> jdbc-pool module, you might want to file a bug on the bugtracker asking >> for an enhancement to support the abort method. (I would use the dbcp2 >> pool.) >> >> Felix > > > [1] > https://lists.apache.org/thread.html/r598c0f654477372d112858af1c18bfc04008250156989647d883576f%40%3Cdev.commons.apache.org%3E > >> >>> On Sat, Aug 29, 2020 at 6:50 PM Phil Steitz >>> wrote: >>> >>>> On 8/27/20 2:47 AM, Gokhan Akgul wrote: >>>>> Hi , >>>>> >>>>> I have been facing the deadlock issue for the last 2 months about >>>>> JDBCPoolCleaner Thread . >>>>> >>>>> Following config set in context.xml >>>>> >>>>> >>>> auth="Container" >>>>> type="javax.sql.DataSource" >>>>> >>>>> factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" >>>>> driverClassName="com.mysql.jdbc.Driver" >>>>> >>>> >>>> url="jdbc:mysql://adress:3306/db?useUnicode=truecharacterEncoding=latin5characterResultSet=latin5zeroDateTimeBehavior=convertToNullautoReconnect=trueinteractiveClient=true" >>>>> username="user" >>>>> password="pass" >>>>> initialSize="10" >>>>> maxActive="30" >>>>> maxIdle="15" >>>>> minIdle="10" >>>>> maxWait="3" >>>>> timeBetweenEvictionRunsMillis="5000" >>>>> minEvictableIdleTimeMillis="6" >>>>> removeAbandonedTimeout="600" >>>>> removeAbandoned="true" >>>>> logAbandoned="false" >>>>> testWhileIdle="true" >>>>> testOnBorrow="true" >>>>> testOnReturn="false" >>>>> validationQuery="/* ping */ SELECT 1" >>>>> validationInterval="3" >>>>> jmxEnabled="true" >>>>> >>>> >>>> jdbcInterceptors="ConnectionState;StatementFinalizer;ResetAbandonedTimer;SlowQueryReport" >>>>> /> >>>>> >>>>> >>>>> >>>>> Thread dump >>>>> >>>>> Tomcat JDBC Pool Cleaner[63445188:1598345711425] id=16 state=BLOCKED >>>>> - waiting to lock <0x57dcb0b7> (a >>>> com.mysql.jdbc.JDBC4PreparedStatement) >&g