Discussion:
Connection pool and parallel deployment problem
Gilles SCHLIENGER
2018-11-21 11:00:15 UTC
Permalink
Hi all,

We are using Tomcat 9 and parallel deployment.

I use a connection pool defined in the xml context (myApp##1.xml, myApp##2.xml in my exemple)

I have the following problem :
- I have myApp##1.war deployed using a connection pool (configured in myApp##1.xml)
- I deploy myApp##2.war (using a connection pool defined in myApp##2.xml)
- when the last session in myApp##1 expires, myApp##1 is automatically undeployed (I have undeployOldVersions="true" in server.xml for the Host) but the connections opened by myApp##1 are not closed.

I used the Tomcat configuration from the example in :
https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#Database_Connection_Pool_(DBCP_2)_Configurations

<Resource name="jdbc/integrationGG" auth="Container" type="javax.sql.DataSource"
maxTotal="100" maxIdle="30" maxWaitMillis="10000" destroy-method="close"
username="postgres" password="password" driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/postgres?stringtype=unspecified"/>

During undeploy, I get the following messages :

21-Nov-2018 11:42:54.795 AVERTISSEMENT [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [myApp##1] registered the JDBC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.

...

21-Nov-2018 11:42:54.800 AVERTISSEMENT [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [myApp##1] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
***@10.0.1/java.lang.Object.wait(Native Method)
***@10.0.1/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:64)
***@10.0.1/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
***@10.0.1/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
***@10.0.1/java.lang.Thread.run(Thread.java:844)

I have tested adding < destroy-method=close > but it did not change anything

Is this a bug ?

Thanks for any help !

Regards
Gilles
HeeGu Lee
2018-11-21 12:23:58 UTC
Permalink
I think it is good for your mental health not to use this feature.
You just have to think of it as an experimental function like google
chrome's about://flags.

JMX has subscribe model.
However, Tomcat is no ability to receive notifications.
And most JDBC implementations are not interested in such features.
Both Tomcat and DB vendors are not going to fix it.

It's not a tragedy, it's just a comedy.
Post by Gilles SCHLIENGER
Hi all,
We are using Tomcat 9 and parallel deployment.
I use a connection pool defined in the xml context (myApp##1.xml,
myApp##2.xml in my exemple)
- I have myApp##1.war deployed using a connection pool (configured in myApp##1.xml)
- I deploy myApp##2.war (using a connection pool defined in myApp##2.xml)
- when the last session in myApp##1 expires, myApp##1 is automatically
undeployed (I have undeployOldVersions="true" in server.xml for the Host)
but the connections opened by myApp##1 are not closed.
https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#Database_Connection_Pool_(DBCP_2)_Configurations
<Resource name="jdbc/integrationGG" auth="Container"
type="javax.sql.DataSource"
maxTotal="100" maxIdle="30" maxWaitMillis="10000" destroy-method="close"
username="postgres" password="password"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/postgres?stringtype=unspecified"/>
21-Nov-2018 11:42:54.795 AVERTISSEMENT
[ContainerBackgroundProcessor[StandardEngine[Catalina]]]
org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The
web application [myApp##1] registered the JDBC driver
[org.postgresql.Driver] but failed to unregister it when the web
application was stopped. To prevent a memory leak, the JDBC Driver has been
forcibly unregistered.
...
21-Nov-2018 11:42:54.800 AVERTISSEMENT
[ContainerBackgroundProcessor[StandardEngine[Catalina]]]
org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The
web application [myApp##1] appears to have started a thread named
[Abandoned connection cleanup thread] but has failed to stop it. This is
/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:64)
/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
I have tested adding < destroy-method=close > but it did not change anything
Is this a bug ?
Thanks for any help !
Regards
Gilles
Gilles SCHLIENGER
2018-11-21 16:33:48 UTC
Permalink
Are you talking about parallel deployment or connection pools ?

Parallel deployment is in Tomcat since Tomcat 7

Gilles

-----Message d'origine-----
De : HeeGu Lee [mailto:***@gmail.com]
Envoyé : mercredi 21 novembre 2018 13:24
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem

I think it is good for your mental health not to use this feature.
You just have to think of it as an experimental function like google
chrome's about://flags.

JMX has subscribe model.
However, Tomcat is no ability to receive notifications.
And most JDBC implementations are not interested in such features.
Both Tomcat and DB vendors are not going to fix it.

It's not a tragedy, it's just a comedy.
Post by Gilles SCHLIENGER
Hi all,
We are using Tomcat 9 and parallel deployment.
I use a connection pool defined in the xml context (myApp##1.xml,
myApp##2.xml in my exemple)
- I have myApp##1.war deployed using a connection pool (configured in myApp##1.xml)
- I deploy myApp##2.war (using a connection pool defined in myApp##2.xml)
- when the last session in myApp##1 expires, myApp##1 is automatically
undeployed (I have undeployOldVersions="true" in server.xml for the Host)
but the connections opened by myApp##1 are not closed.
https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#Database_Connection_Pool_(DBCP_2)_Configurations
<Resource name="jdbc/integrationGG" auth="Container"
type="javax.sql.DataSource"
maxTotal="100" maxIdle="30" maxWaitMillis="10000" destroy-method="close"
username="postgres" password="password"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/postgres?stringtype=unspecified"/>
21-Nov-2018 11:42:54.795 AVERTISSEMENT
[ContainerBackgroundProcessor[StandardEngine[Catalina]]]
org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The
web application [myApp##1] registered the JDBC driver
[org.postgresql.Driver] but failed to unregister it when the web
application was stopped. To prevent a memory leak, the JDBC Driver has been
forcibly unregistered.
...
21-Nov-2018 11:42:54.800 AVERTISSEMENT
[ContainerBackgroundProcessor[StandardEngine[Catalina]]]
org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The
web application [myApp##1] appears to have started a thread named
[Abandoned connection cleanup thread] but has failed to stop it. This is
/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:64)
/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
I have tested adding < destroy-method=close > but it did not change anything
Is this a bug ?
Thanks for any help !
Regards
Gilles
Т���������������������������������������������������������������������ХF�V�7V'67&�&R�R���âW6W'2�V�7V'67&�&TF��6B�6�R��&pФf�"FF�F����6����G2�R�
Mark Thomas
2018-11-21 13:18:07 UTC
Permalink
Post by Gilles SCHLIENGER
Hi all,
We are using Tomcat 9 and parallel deployment.
I use a connection pool defined in the xml context (myApp##1.xml, myApp##2.xml in my exemple)
- I have myApp##1.war deployed using a connection pool (configured in myApp##1.xml)
- I deploy myApp##2.war (using a connection pool defined in myApp##2.xml)
- when the last session in myApp##1 expires, myApp##1 is automatically undeployed (I have undeployOldVersions="true" in server.xml for the Host) but the connections opened by myApp##1 are not closed.
https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#Database_Connection_Pool_(DBCP_2)_Configurations
<Resource name="jdbc/integrationGG" auth="Container" type="javax.sql.DataSource"
maxTotal="100" maxIdle="30" maxWaitMillis="10000" destroy-method="close"
username="postgres" password="password" driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/postgres?stringtype=unspecified"/>
21-Nov-2018 11:42:54.795 AVERTISSEMENT [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [myApp##1] registered the JDBC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
That is a warning you should be able to fix by unregistering the JDBC
driver in a ServletContextListener.
Post by Gilles SCHLIENGER
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:64)
That is a thread started by the MySQL driver. There should be an API
provided by the MySQL driver that you can call to stop the thread (again
in a ServletContextListener) although I'd expect that to happen
automatically as part of unloading the driver.

If there is no way to stop the thread then that would be a bug in the
MySQL driver.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org
Gilles SCHLIENGER
2018-11-23 10:07:21 UTC
Permalink
Thanks Mark for your answer

Here is what I found in case someone has the same problem.

When you use parallel deployment, you should not use a connexion pool in the context.xml file
Once the connexions are opened, they stay opened until Tomcat shuts down, whatever configuration you try.
So everytime you deploy a new version of your webapp, new connexions are being opened.
So we will configure our connexion pools directly in our Spring webapp. This way, the connexions are closed when the webapp is undeployed.

The warning/error messages are not actually linked to the connexions not closed.
To ovoid these messages, you can:
- move the jars (connexion pool, drivers...) into TOMCAT/lib
- Have a ServletContextListener that calls AbandonedConnectionCleanupThread.checkedShutdown();

Regards
Gilles

-----Message d'origine-----
De : Mark Thomas [mailto:***@apache.org]
Envoyé : mercredi 21 novembre 2018 14:18
À : Tomcat Users List; Gilles SCHLIENGER
Objet : Re: Connection pool and parallel deployment problem
Post by Gilles SCHLIENGER
Hi all,
We are using Tomcat 9 and parallel deployment.
I use a connection pool defined in the xml context (myApp##1.xml, myApp##2.xml in my exemple)
- I have myApp##1.war deployed using a connection pool (configured in myApp##1.xml)
- I deploy myApp##2.war (using a connection pool defined in myApp##2.xml)
- when the last session in myApp##1 expires, myApp##1 is automatically undeployed (I have undeployOldVersions="true" in server.xml for the Host) but the connections opened by myApp##1 are not closed.
https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-howto.html#Database_Connection_Pool_(DBCP_2)_Configurations
<Resource name="jdbc/integrationGG" auth="Container" type="javax.sql.DataSource"
maxTotal="100" maxIdle="30" maxWaitMillis="10000" destroy-method="close"
username="postgres" password="password" driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/postgres?stringtype=unspecified"/>
21-Nov-2018 11:42:54.795 AVERTISSEMENT [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [myApp##1] registered the JDBC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
That is a warning you should be able to fix by unregistering the JDBC
driver in a ServletContextListener.
Post by Gilles SCHLIENGER
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:64)
That is a thread started by the MySQL driver. There should be an API
provided by the MySQL driver that you can call to stop the thread (again
in a ServletContextListener) although I'd expect that to happen
automatically as part of unloading the driver.

If there is no way to stop the thread then that would be a bug in the
MySQL driver.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org
Christopher Schultz
2018-11-24 16:18:34 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Gilles,
Post by Gilles SCHLIENGER
Thanks Mark for your answer
Here is what I found in case someone has the same problem.
When you use parallel deployment, you should not use a connexion
pool in the context.xml file
Why not?
Post by Gilles SCHLIENGER
Once the connexions are opened, they stay opened until Tomcat
shuts down, whatever configuration you try.
I would expect that any connection pool created for a context (or
instance of a context, when parallel deployments are being done) would
be shut-down when the application is undeployed. Are you actually
undeploying the old context? It doesn't happen automatically IIRC.
Post by Gilles SCHLIENGER
So everytime you deploy a new version of your webapp, new
connexions are being opened.
This is expected. How could it work, otherwise?
Post by Gilles SCHLIENGER
So we will configure our connexion pools directly in our Spring
webapp. This way, the connexions are closed when the webapp is
undeployed.
That's one way to solve the issue, but not the only way.
Post by Gilles SCHLIENGER
The warning/error messages are not actually linked to the
connexions not closed. To ovoid these messages, you can: - move the
jars (connexion pool, drivers...) into TOMCAT/lib - Have a
ServletContextListener that calls
AbandonedConnectionCleanupThread.checkedShutdown();
The Connector/J devs haven't been able to understand how ClassLoaders
work, and have never really fixed that long-standing bug in a
satisfying way as far as I know. But you should always use a
ServletContextListener to attempt to shut-down the
AbadonedConnectionCleanuopThread.

BTW that thread does not work as documented. It's claimed that it
doesn't start unless you issue a query with a timeout, but it always
starts whether or not you use queries with timeouts. It's frustrating.

- -chris
Post by Gilles SCHLIENGER
-----Message d'origine----- De : Mark Thomas
À : Tomcat Users List; Gilles SCHLIENGER Objet : Re: Connection
pool and parallel deployment problem
Post by Gilles SCHLIENGER
Hi all,
We are using Tomcat 9 and parallel deployment.
I use a connection pool defined in the xml context (myApp##1.xml,
myApp##2.xml in my exemple)
I have the following problem : - I have myApp##1.war deployed
using a connection pool (configured in myApp##1.xml) - I deploy
myApp##2.war (using a connection pool defined in myApp##2.xml) -
when the last session in myApp##1 expires, myApp##1 is
automatically undeployed (I have undeployOldVersions="true" in
server.xml for the Host) but the connections opened by myApp##1
are not closed.
https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-how
to.html#Database_Connection_Pool_(DBCP_2)_Configurations
<Resource name="jdbc/integrationGG" auth="Container"
type="javax.sql.DataSource"
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
maxTotal="100" maxIdle="30" maxWaitMillis="10000"
destroy-method="close" username="postgres" password="password"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/postgres?stringtype=unspecified
"/>
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
21-Nov-2018 11:42:54.795 AVERTISSEMENT
[ContainerBackgroundProcessor[StandardEngine[Catalina]]]
org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc
The web application [myApp##1] registered the JDBC driver
[org.postgresql.Driver] but failed to unregister it when the web
application was stopped. To prevent a memory leak, the JDBC
Driver has been forcibly unregistered.
That is a warning you should be able to fix by unregistering the
JDBC driver in a ServletContextListener.
Post by Gilles SCHLIENGER
21-Nov-2018 11:42:54.800 AVERTISSEMENT
[ContainerBackgroundProcessor[StandardEngine[Catalina]]]
org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThrea
ds
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
The web application [myApp##1] appears to have started a thread
named [Abandoned connection cleanup thread] but has failed to
stop it. This is very likely to create a memory leak. Stack trace
ava:151)
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionC
leanupThread.java:64)
readPoolExecutor.java:1135)
***@10.0.1/java.util.concurrent.ThreadPoolExecutor$Worker.run(Thre
adPoolExecutor.java:635)
Post by Gilles SCHLIENGER
That is a thread started by the MySQL driver. There should be an
API provided by the MySQL driver that you can call to stop the
thread (again in a ServletContextListener) although I'd expect that
to happen automatically as part of unloading the driver.
If there is no way to stop the thread then that would be a bug in
the MySQL driver.
Mark
---------------------------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlv5edkACgkQHPApP6U8
pFhb9xAApqaVz+RVrKVx4Cmv7PwHl10wDeQeQFlmPXO5ydafWWOtUb5hHcuifkyE
7p+2NwtS6PoAIMMVwg4De+dedJl3sGb/n1eT/HOPmivxRL9Dl47D32OfM6nJiHzJ
mesayADVYr+wCzCYavfsj/Fkp2aiNAESWwtnzjgDlgLV8nOaj8YTknLge83pnfNP
XaMNDlChRt0OW1LewnRYK7KXCVOB3f7ZpxZK0jD8c5BZRLRgNrcyqKsWJsh289Ym
OmF3ToCw9Wv/3Jq6aE8AFK6wjA384ocuVqYAbC0IvBbXqFhE9lz1/vekWFhfltS0
Bi2aTtNxDFhHjJsbhEQPCnArjuoA75Da1eqSJvLiXdk99slDoB1q3umpxTkRy4nQ
4nIkywZcSek8o4Iq+j7tVhF7PdvtYXfrwIotuYCupni+jzos3b57q1zpZpqcCuce
Vuc2G/aM0pw+DYXUaeUTIojrQGmtWmmd94zzX6gUXz6JV0vGj9gtqN7HVqrJX3dR
uISPyk0ca1Ds4KvUkNoyO3bg/bhpgn4YpCVUOU9zt6ZFYCOnn29VATddDP/uujR7
uGvh7129vkyAQwOI1N68EiCj6zI4RQndJcgQf/l5gulBTMi4T4cDjn9sNT7UETkK
tsuQ6mMSQYNo4N0CL+279576yNOPzH2aUZ+X7GowdQnB2X9PYhc=
=IW4H
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org
Gilles SCHLIENGER
2018-11-26 08:54:28 UTC
Permalink
Hi Christopher,

Thanks for your email.

About connection pools not being closed, maybe the connection pool is closed but the connections to the database are not.

Here are the tests I did:

+ TEST 1:
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have been opened (select...)
- I undeploy my webapp through the manager webapp
- I check that the connections are still opened
- Tomcat is still running
- I redeploy the exact samed webapp and login to my application
- No other connection is being opened

+ TEST 2:
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have been opened (select...)
- I deploy a new version of my application and login with another browser
- I check on my postgresql and mysql database that new connexions have been opened (they doubled)
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections are still opened (even if I wait for a long time)

For tests 1 and 2, I used C3p0, DBCP2 and even HikariCP

+ TEST 3:
- I configure my connection pools directly in my Spring application with an external configuration file
- I do the same as TEST 2
-> this time, I can see the number of database connections going down when I undeploy the first version of the webapp

Thanks again Chris if you have any advice

Regards
Gilles

-----Message d'origine-----
De : Christopher Schultz [mailto:***@christopherschultz.net]
Envoyé : samedi 24 novembre 2018 17:19
À : ***@tomcat.apache.org
Objet : Re: Connection pool and parallel deployment problem

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Gilles,
Post by Gilles SCHLIENGER
Thanks Mark for your answer
Here is what I found in case someone has the same problem.
When you use parallel deployment, you should not use a connexion
pool in the context.xml file
Why not?
Post by Gilles SCHLIENGER
Once the connexions are opened, they stay opened until Tomcat
shuts down, whatever configuration you try.
I would expect that any connection pool created for a context (or
instance of a context, when parallel deployments are being done) would
be shut-down when the application is undeployed. Are you actually
undeploying the old context? It doesn't happen automatically IIRC.
Post by Gilles SCHLIENGER
So everytime you deploy a new version of your webapp, new
connexions are being opened.
This is expected. How could it work, otherwise?
Post by Gilles SCHLIENGER
So we will configure our connexion pools directly in our Spring
webapp. This way, the connexions are closed when the webapp is
undeployed.
That's one way to solve the issue, but not the only way.
Post by Gilles SCHLIENGER
The warning/error messages are not actually linked to the
connexions not closed. To ovoid these messages, you can: - move the
jars (connexion pool, drivers...) into TOMCAT/lib - Have a
ServletContextListener that calls
AbandonedConnectionCleanupThread.checkedShutdown();
The Connector/J devs haven't been able to understand how ClassLoaders
work, and have never really fixed that long-standing bug in a
satisfying way as far as I know. But you should always use a
ServletContextListener to attempt to shut-down the
AbadonedConnectionCleanuopThread.

BTW that thread does not work as documented. It's claimed that it
doesn't start unless you issue a query with a timeout, but it always
starts whether or not you use queries with timeouts. It's frustrating.

- -chris
Post by Gilles SCHLIENGER
-----Message d'origine----- De : Mark Thomas
À : Tomcat Users List; Gilles SCHLIENGER Objet : Re: Connection
pool and parallel deployment problem
Post by Gilles SCHLIENGER
Hi all,
We are using Tomcat 9 and parallel deployment.
I use a connection pool defined in the xml context (myApp##1.xml,
myApp##2.xml in my exemple)
I have the following problem : - I have myApp##1.war deployed
using a connection pool (configured in myApp##1.xml) - I deploy
myApp##2.war (using a connection pool defined in myApp##2.xml) -
when the last session in myApp##1 expires, myApp##1 is
automatically undeployed (I have undeployOldVersions="true" in
server.xml for the Host) but the connections opened by myApp##1
are not closed.
https://tomcat.apache.org/tomcat-9.0-doc/jndi-datasource-examples-how
to.html#Database_Connection_Pool_(DBCP_2)_Configurations
<Resource name="jdbc/integrationGG" auth="Container"
type="javax.sql.DataSource"
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
maxTotal="100" maxIdle="30" maxWaitMillis="10000"
destroy-method="close" username="postgres" password="password"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/postgres?stringtype=unspecified
"/>
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
21-Nov-2018 11:42:54.795 AVERTISSEMENT
[ContainerBackgroundProcessor[StandardEngine[Catalina]]]
org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc
The web application [myApp##1] registered the JDBC driver
[org.postgresql.Driver] but failed to unregister it when the web
application was stopped. To prevent a memory leak, the JDBC
Driver has been forcibly unregistered.
That is a warning you should be able to fix by unregistering the
JDBC driver in a ServletContextListener.
Post by Gilles SCHLIENGER
21-Nov-2018 11:42:54.800 AVERTISSEMENT
[ContainerBackgroundProcessor[StandardEngine[Catalina]]]
org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThrea
ds
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
The web application [myApp##1] appears to have started a thread
named [Abandoned connection cleanup thread] but has failed to
stop it. This is very likely to create a memory leak. Stack trace
ava:151)
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionC
leanupThread.java:64)
readPoolExecutor.java:1135)
***@10.0.1/java.util.concurrent.ThreadPoolExecutor$Worker.run(Thre
adPoolExecutor.java:635)
Post by Gilles SCHLIENGER
That is a thread started by the MySQL driver. There should be an
API provided by the MySQL driver that you can call to stop the
thread (again in a ServletContextListener) although I'd expect that
to happen automatically as part of unloading the driver.
If there is no way to stop the thread then that would be a bug in
the MySQL driver.
Mark
---------------------------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlv5edkACgkQHPApP6U8
pFhb9xAApqaVz+RVrKVx4Cmv7PwHl10wDeQeQFlmPXO5ydafWWOtUb5hHcuifkyE
7p+2NwtS6PoAIMMVwg4De+dedJl3sGb/n1eT/HOPmivxRL9Dl47D32OfM6nJiHzJ
mesayADVYr+wCzCYavfsj/Fkp2aiNAESWwtnzjgDlgLV8nOaj8YTknLge83pnfNP
XaMNDlChRt0OW1LewnRYK7KXCVOB3f7ZpxZK0jD8c5BZRLRgNrcyqKsWJsh289Ym
OmF3ToCw9Wv/3Jq6aE8AFK6wjA384ocuVqYAbC0IvBbXqFhE9lz1/vekWFhfltS0
Bi2aTtNxDFhHjJsbhEQPCnArjuoA75Da1eqSJvLiXdk99slDoB1q3umpxTkRy4nQ
4nIkywZcSek8o4Iq+j7tVhF7PdvtYXfrwIotuYCupni+jzos3b57q1zpZpqcCuce
Vuc2G/aM0pw+DYXUaeUTIojrQGmtWmmd94zzX6gUXz6JV0vGj9gtqN7HVqrJX3dR
uISPyk0ca1Ds4KvUkNoyO3bg/bhpgn4YpCVUOU9zt6ZFYCOnn29VATddDP/uujR7
uGvh7129vkyAQwOI1N68EiCj6zI4RQndJcgQf/l5gulBTMi4T4cDjn9sNT7UETkK
tsuQ6mMSQYNo4N0CL+279576yNOPzH2aUZ+X7GowdQnB2X9PYhc=
=IW4H
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org

Т���������������������������������������������������������������������ХF�V�7V'67&�&R�R���âW6W'2�V�7V'67&�&TF��6B�6�R��&pФf�"FF�F����6����G2�R�
Chris Cheshire
2018-11-26 14:27:07 UTC
Permalink
I'm interested in what solution there is for this because I have the
exact same problem but without parallel deployment.

[snip]

On Mon, Nov 26, 2018 at 3:54 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi Christopher,
Thanks for your email.
About connection pools not being closed, maybe the connection pool is closed but the connections to the database are not.
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have been opened (select...)
- I undeploy my webapp through the manager webapp
- I check that the connections are still opened
- Tomcat is still running
- I redeploy the exact samed webapp and login to my application
- No other connection is being opened
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have been opened (select...)
- I deploy a new version of my application and login with another browser
- I check on my postgresql and mysql database that new connexions have been opened (they doubled)
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections are still opened (even if I wait for a long time)
For tests 1 and 2, I used C3p0, DBCP2 and even HikariCP
My results are the same. Using mysql, connection pools defined in
server.xml (for user realm for access control to host manager app) and
in my context.xml for my application. When I use the host-manager to
reload an app, the connections are closed (no abandoned connection
warnings) but not released. It is no until I stop tomcat completely
and restart it that the connections are released in mysql. This has
been the case for tomcat 7, 8.5 and 9 versions, with constant updates
of mysql 5.7 and its driver, using both the apache connection pool and
the tomcat connection pool. The driver lives in the tomcat/lib
directory (since it is needed for the user realm datasource).
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : samedi 24 novembre 2018 17:19
Objet : Re: Connection pool and parallel deployment problem
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Gilles,
[snip]
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
The warning/error messages are not actually linked to the
connexions not closed. To ovoid these messages, you can: - move the
jars (connexion pool, drivers...) into TOMCAT/lib - Have a
ServletContextListener that calls
AbandonedConnectionCleanupThread.checkedShutdown();
The Connector/J devs haven't been able to understand how ClassLoaders
work, and have never really fixed that long-standing bug in a
satisfying way as far as I know. But you should always use a
ServletContextListener to attempt to shut-down the
AbadonedConnectionCleanuopThread.
BTW that thread does not work as documented. It's claimed that it
doesn't start unless you issue a query with a timeout, but it always
starts whether or not you use queries with timeouts. It's frustrating.
Should we be using checked or unchecked shutdown?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org
Gilles SCHLIENGER
2018-11-26 14:58:34 UTC
Permalink
Hi,
I understand your needs, but what is your problem, since you don't use parallel deployment ?
Your connections are not closed but they will not be recreated when you deploy your webapp again, so there should be no problem ?

Gilles

-----Message d'origine-----
De : Chris Cheshire [mailto:***@gmail.com]
Envoyé : lundi 26 novembre 2018 15:27
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem

I'm interested in what solution there is for this because I have the
exact same problem but without parallel deployment.

[snip]

On Mon, Nov 26, 2018 at 3:54 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi Christopher,
Thanks for your email.
About connection pools not being closed, maybe the connection pool is closed but the connections to the database are not.
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have been opened (select...)
- I undeploy my webapp through the manager webapp
- I check that the connections are still opened
- Tomcat is still running
- I redeploy the exact samed webapp and login to my application
- No other connection is being opened
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have been opened (select...)
- I deploy a new version of my application and login with another browser
- I check on my postgresql and mysql database that new connexions have been opened (they doubled)
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections are still opened (even if I wait for a long time)
For tests 1 and 2, I used C3p0, DBCP2 and even HikariCP
My results are the same. Using mysql, connection pools defined in
server.xml (for user realm for access control to host manager app) and
in my context.xml for my application. When I use the host-manager to
reload an app, the connections are closed (no abandoned connection
warnings) but not released. It is no until I stop tomcat completely
and restart it that the connections are released in mysql. This has
been the case for tomcat 7, 8.5 and 9 versions, with constant updates
of mysql 5.7 and its driver, using both the apache connection pool and
the tomcat connection pool. The driver lives in the tomcat/lib
directory (since it is needed for the user realm datasource).
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : samedi 24 novembre 2018 17:19
Objet : Re: Connection pool and parallel deployment problem
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Gilles,
[snip]
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
The warning/error messages are not actually linked to the
connexions not closed. To ovoid these messages, you can: - move the
jars (connexion pool, drivers...) into TOMCAT/lib - Have a
ServletContextListener that calls
AbandonedConnectionCleanupThread.checkedShutdown();
The Connector/J devs haven't been able to understand how ClassLoaders
work, and have never really fixed that long-standing bug in a
satisfying way as far as I know. But you should always use a
ServletContextListener to attempt to shut-down the
AbadonedConnectionCleanuopThread.
BTW that thread does not work as documented. It's claimed that it
doesn't start unless you issue a query with a timeout, but it always
starts whether or not you use queries with timeouts. It's frustrating.
Should we be using checked or unchecked shutdown?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org

B�KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB��[��X��ܚX�KK[XZ[�\�\��][��X��ܚX�P�X�] �\X�K�ܙ�B��܈Y][ۘ[��[X[��K[
Chris Cheshire
2018-11-26 17:03:30 UTC
Permalink
On Mon, Nov 26, 2018 at 9:58 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi,
I understand your needs, but what is your problem, since you don't use parallel deployment ?
Your connections are not closed but they will not be recreated when you deploy your webapp again, so there should be no problem ?
Gilles
I added my 2c because I am seeing what you describe here
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections are still opened (even if I wait for a long time)
Yes I know you are using parallel deployment and I am not, but that
doesn't necessarily mean that the problem you see is limited to only
parallel deployment. Maybe the problem can be simplified to "
Tomcat considers the connections closed, the database doesn't."

I could well be wrong, I'll leave it up to the gurus to decide :)
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : lundi 26 novembre 2018 15:27
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem
I'm interested in what solution there is for this because I have the
exact same problem but without parallel deployment.
[snip]
On Mon, Nov 26, 2018 at 3:54 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi Christopher,
Thanks for your email.
About connection pools not being closed, maybe the connection pool is closed but the connections to the database are not.
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have been opened (select...)
- I undeploy my webapp through the manager webapp
- I check that the connections are still opened
- Tomcat is still running
- I redeploy the exact samed webapp and login to my application
- No other connection is being opened
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have been opened (select...)
- I deploy a new version of my application and login with another browser
- I check on my postgresql and mysql database that new connexions have been opened (they doubled)
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections are still opened (even if I wait for a long time)
For tests 1 and 2, I used C3p0, DBCP2 and even HikariCP
My results are the same. Using mysql, connection pools defined in
server.xml (for user realm for access control to host manager app) and
in my context.xml for my application. When I use the host-manager to
reload an app, the connections are closed (no abandoned connection
warnings) but not released. It is no until I stop tomcat completely
and restart it that the connections are released in mysql. This has
been the case for tomcat 7, 8.5 and 9 versions, with constant updates
of mysql 5.7 and its driver, using both the apache connection pool and
the tomcat connection pool. The driver lives in the tomcat/lib
directory (since it is needed for the user realm datasource).
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : samedi 24 novembre 2018 17:19
Objet : Re: Connection pool and parallel deployment problem
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Gilles,
[snip]
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
The warning/error messages are not actually linked to the
connexions not closed. To ovoid these messages, you can: - move the
jars (connexion pool, drivers...) into TOMCAT/lib - Have a
ServletContextListener that calls
AbandonedConnectionCleanupThread.checkedShutdown();
The Connector/J devs haven't been able to understand how ClassLoaders
work, and have never really fixed that long-standing bug in a
satisfying way as far as I know. But you should always use a
ServletContextListener to attempt to shut-down the
AbadonedConnectionCleanuopThread.
BTW that thread does not work as documented. It's claimed that it
doesn't start unless you issue a query with a timeout, but it always
starts whether or not you use queries with timeouts. It's frustrating.
Should we be using checked or unchecked shutdown?
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org
HeeGu Lee
2018-11-27 07:35:56 UTC
Permalink
Dear Gilles,

I apologize for the delay in reply.

I make simple webapp and upload to github. In project, my test result is
included.

https://github.com/elfhazardwork/dbcp2-test

Tomcat's parallel deploy mechanism is deploy new version before undeploy
old.
So, If your webapp is use JMX, bean name will duplicate and crush.

The connection pool is used where the developer does not explicitly declare
JXM.
So this is a Tomcat bug.
Otherwise, you must set JMX bean name dynamically.

I hope this helps.
Post by Chris Cheshire
On Mon, Nov 26, 2018 at 9:58 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi,
I understand your needs, but what is your problem, since you don't use
parallel deployment ?
Post by Gilles SCHLIENGER
Your connections are not closed but they will not be recreated when you
deploy your webapp again, so there should be no problem ?
Post by Gilles SCHLIENGER
Gilles
I added my 2c because I am seeing what you describe here
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections are
still opened (even if I wait for a long time)
Yes I know you are using parallel deployment and I am not, but that
doesn't necessarily mean that the problem you see is limited to only
parallel deployment. Maybe the problem can be simplified to "
Tomcat considers the connections closed, the database doesn't."
I could well be wrong, I'll leave it up to the gurus to decide :)
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : lundi 26 novembre 2018 15:27
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem
I'm interested in what solution there is for this because I have the
exact same problem but without parallel deployment.
[snip]
On Mon, Nov 26, 2018 at 3:54 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi Christopher,
Thanks for your email.
About connection pools not being closed, maybe the connection pool is
closed but the connections to the database are not.
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have
been opened (select...)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy my webapp through the manager webapp
- I check that the connections are still opened
- Tomcat is still running
- I redeploy the exact samed webapp and login to my application
- No other connection is being opened
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have
been opened (select...)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I deploy a new version of my application and login with another
browser
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I check on my postgresql and mysql database that new connexions have
been opened (they doubled)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections are
still opened (even if I wait for a long time)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
For tests 1 and 2, I used C3p0, DBCP2 and even HikariCP
My results are the same. Using mysql, connection pools defined in
server.xml (for user realm for access control to host manager app) and
in my context.xml for my application. When I use the host-manager to
reload an app, the connections are closed (no abandoned connection
warnings) but not released. It is no until I stop tomcat completely
and restart it that the connections are released in mysql. This has
been the case for tomcat 7, 8.5 and 9 versions, with constant updates
of mysql 5.7 and its driver, using both the apache connection pool and
the tomcat connection pool. The driver lives in the tomcat/lib
directory (since it is needed for the user realm datasource).
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : samedi 24 novembre 2018 17:19
Objet : Re: Connection pool and parallel deployment problem
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Gilles,
[snip]
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
The warning/error messages are not actually linked to the
connexions not closed. To ovoid these messages, you can: - move the
jars (connexion pool, drivers...) into TOMCAT/lib - Have a
ServletContextListener that calls
AbandonedConnectionCleanupThread.checkedShutdown();
The Connector/J devs haven't been able to understand how ClassLoaders
work, and have never really fixed that long-standing bug in a
satisfying way as far as I know. But you should always use a
ServletContextListener to attempt to shut-down the
AbadonedConnectionCleanuopThread.
BTW that thread does not work as documented. It's claimed that it
doesn't start unless you issue a query with a timeout, but it always
starts whether or not you use queries with timeouts. It's frustrating.
Should we be using checked or unchecked shutdown?
---------------------------------------------------------------------
---------------------------------------------------------------------
Gilles SCHLIENGER
2018-11-27 09:03:41 UTC
Permalink
Thanks a lot Heegu,

I looked at your project on github.
1. Which part of the code is exporting JMX beans ? Is it the @ManagedBean annotation ?

2. What do you use JMX for ?

Thanks again
Regards
Gilles


-----Message d'origine-----
De : HeeGu Lee [mailto:***@gmail.com]
Envoyé : mardi 27 novembre 2018 08:36
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem

Dear Gilles,

I apologize for the delay in reply.

I make simple webapp and upload to github. In project, my test result is
included.

https://github.com/elfhazardwork/dbcp2-test

Tomcat's parallel deploy mechanism is deploy new version before undeploy
old.
So, If your webapp is use JMX, bean name will duplicate and crush.

The connection pool is used where the developer does not explicitly declare
JXM.
So this is a Tomcat bug.
Otherwise, you must set JMX bean name dynamically.

I hope this helps.
Post by Chris Cheshire
On Mon, Nov 26, 2018 at 9:58 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi,
I understand your needs, but what is your problem, since you don't use
parallel deployment ?
Post by Gilles SCHLIENGER
Your connections are not closed but they will not be recreated when you
deploy your webapp again, so there should be no problem ?
Post by Gilles SCHLIENGER
Gilles
I added my 2c because I am seeing what you describe here
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections are
still opened (even if I wait for a long time)
Yes I know you are using parallel deployment and I am not, but that
doesn't necessarily mean that the problem you see is limited to only
parallel deployment. Maybe the problem can be simplified to "
Tomcat considers the connections closed, the database doesn't."
I could well be wrong, I'll leave it up to the gurus to decide :)
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : lundi 26 novembre 2018 15:27
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem
I'm interested in what solution there is for this because I have the
exact same problem but without parallel deployment.
[snip]
On Mon, Nov 26, 2018 at 3:54 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi Christopher,
Thanks for your email.
About connection pools not being closed, maybe the connection pool is
closed but the connections to the database are not.
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have
been opened (select...)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy my webapp through the manager webapp
- I check that the connections are still opened
- Tomcat is still running
- I redeploy the exact samed webapp and login to my application
- No other connection is being opened
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have
been opened (select...)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I deploy a new version of my application and login with another
browser
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I check on my postgresql and mysql database that new connexions have
been opened (they doubled)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections are
still opened (even if I wait for a long time)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
For tests 1 and 2, I used C3p0, DBCP2 and even HikariCP
My results are the same. Using mysql, connection pools defined in
server.xml (for user realm for access control to host manager app) and
in my context.xml for my application. When I use the host-manager to
reload an app, the connections are closed (no abandoned connection
warnings) but not released. It is no until I stop tomcat completely
and restart it that the connections are released in mysql. This has
been the case for tomcat 7, 8.5 and 9 versions, with constant updates
of mysql 5.7 and its driver, using both the apache connection pool and
the tomcat connection pool. The driver lives in the tomcat/lib
directory (since it is needed for the user realm datasource).
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : samedi 24 novembre 2018 17:19
Objet : Re: Connection pool and parallel deployment problem
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Gilles,
[snip]
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
The warning/error messages are not actually linked to the
connexions not closed. To ovoid these messages, you can: - move the
jars (connexion pool, drivers...) into TOMCAT/lib - Have a
ServletContextListener that calls
AbandonedConnectionCleanupThread.checkedShutdown();
The Connector/J devs haven't been able to understand how ClassLoaders
work, and have never really fixed that long-standing bug in a
satisfying way as far as I know. But you should always use a
ServletContextListener to attempt to shut-down the
AbadonedConnectionCleanuopThread.
BTW that thread does not work as documented. It's claimed that it
doesn't start unless you issue a query with a timeout, but it always
starts whether or not you use queries with timeouts. It's frustrating.
Should we be using checked or unchecked shutdown?
---------------------------------------------------------------------
---------------------------------------------------------------------
Т���������������������������������������������������������������������ХF�V�7V'67&�&R�R���âW6W'2�V�7V'67&�&TF��6B�6�R��&pФf�"FF�F����6����G2�R�
Esther Montes
2018-11-27 09:13:26 UTC
Permalink
Buenas tardes nomás kiero saber si tengo que ir otra vez al banco para
para q me meten unas claves o asi me va a entregar los depósitos

El mar., 27 de nov. de 2018 1:03 AM, Gilles SCHLIENGER <
Post by Gilles SCHLIENGER
Thanks a lot Heegu,
I looked at your project on github.
2. What do you use JMX for ?
Thanks again
Regards
Gilles
-----Message d'origine-----
Envoyé : mardi 27 novembre 2018 08:36
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem
Dear Gilles,
I apologize for the delay in reply.
I make simple webapp and upload to github. In project, my test result is
included.
https://github.com/elfhazardwork/dbcp2-test
Tomcat's parallel deploy mechanism is deploy new version before undeploy
old.
So, If your webapp is use JMX, bean name will duplicate and crush.
The connection pool is used where the developer does not explicitly declare
JXM.
So this is a Tomcat bug.
Otherwise, you must set JMX bean name dynamically.
I hope this helps.
Post by Chris Cheshire
On Mon, Nov 26, 2018 at 9:58 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi,
I understand your needs, but what is your problem, since you don't use
parallel deployment ?
Post by Gilles SCHLIENGER
Your connections are not closed but they will not be recreated when you
deploy your webapp again, so there should be no problem ?
Post by Gilles SCHLIENGER
Gilles
I added my 2c because I am seeing what you describe here
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections are
still opened (even if I wait for a long time)
Yes I know you are using parallel deployment and I am not, but that
doesn't necessarily mean that the problem you see is limited to only
parallel deployment. Maybe the problem can be simplified to "
Tomcat considers the connections closed, the database doesn't."
I could well be wrong, I'll leave it up to the gurus to decide :)
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : lundi 26 novembre 2018 15:27
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem
I'm interested in what solution there is for this because I have the
exact same problem but without parallel deployment.
[snip]
On Mon, Nov 26, 2018 at 3:54 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi Christopher,
Thanks for your email.
About connection pools not being closed, maybe the connection pool is
closed but the connections to the database are not.
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have
been opened (select...)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy my webapp through the manager webapp
- I check that the connections are still opened
- Tomcat is still running
- I redeploy the exact samed webapp and login to my application
- No other connection is being opened
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have
been opened (select...)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I deploy a new version of my application and login with another
browser
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I check on my postgresql and mysql database that new connexions
have
Post by Chris Cheshire
been opened (they doubled)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections are
still opened (even if I wait for a long time)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
For tests 1 and 2, I used C3p0, DBCP2 and even HikariCP
My results are the same. Using mysql, connection pools defined in
server.xml (for user realm for access control to host manager app) and
in my context.xml for my application. When I use the host-manager to
reload an app, the connections are closed (no abandoned connection
warnings) but not released. It is no until I stop tomcat completely
and restart it that the connections are released in mysql. This has
been the case for tomcat 7, 8.5 and 9 versions, with constant updates
of mysql 5.7 and its driver, using both the apache connection pool and
the tomcat connection pool. The driver lives in the tomcat/lib
directory (since it is needed for the user realm datasource).
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : samedi 24 novembre 2018 17:19
Objet : Re: Connection pool and parallel deployment problem
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Gilles,
[snip]
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
The warning/error messages are not actually linked to the
connexions not closed. To ovoid these messages, you can: - move the
jars (connexion pool, drivers...) into TOMCAT/lib - Have a
ServletContextListener that calls
AbandonedConnectionCleanupThread.checkedShutdown();
The Connector/J devs haven't been able to understand how ClassLoaders
work, and have never really fixed that long-standing bug in a
satisfying way as far as I know. But you should always use a
ServletContextListener to attempt to shut-down the
AbadonedConnectionCleanuopThread.
BTW that thread does not work as documented. It's claimed that it
doesn't start unless you issue a query with a timeout, but it always
starts whether or not you use queries with timeouts. It's
frustrating.
Post by Chris Cheshire
Post by Gilles SCHLIENGER
Should we be using checked or unchecked shutdown?
---------------------------------------------------------------------
---------------------------------------------------------------------
André Warnier (tomcat)
2018-11-27 09:46:38 UTC
Permalink
Buenas tardes nomás kiero saber si tengo que ir otra vez al banco para
para q me meten unas claves o asi me va a entregar los depósitos
Either this is some fiendishly elaborate new scam method of which I haven't heard before,
or else there is someone hopelessly confused out there..
El mar., 27 de nov. de 2018 1:03 AM, Gilles SCHLIENGER <
Post by Gilles SCHLIENGER
Thanks a lot Heegu,
I looked at your project on github.
2. What do you use JMX for ?
Thanks again
Regards
Gilles
-----Message d'origine-----
Envoyé : mardi 27 novembre 2018 08:36
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem
Dear Gilles,
I apologize for the delay in reply.
I make simple webapp and upload to github. In project, my test result is
included.
https://github.com/elfhazardwork/dbcp2-test
Tomcat's parallel deploy mechanism is deploy new version before undeploy
old.
So, If your webapp is use JMX, bean name will duplicate and crush.
The connection pool is used where the developer does not explicitly declare
JXM.
So this is a Tomcat bug.
Otherwise, you must set JMX bean name dynamically.
I hope this helps.
Post by Chris Cheshire
On Mon, Nov 26, 2018 at 9:58 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi,
I understand your needs, but what is your problem, since you don't use
parallel deployment ?
Post by Gilles SCHLIENGER
Your connections are not closed but they will not be recreated when you
deploy your webapp again, so there should be no problem ?
Post by Gilles SCHLIENGER
Gilles
I added my 2c because I am seeing what you describe here
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections are
still opened (even if I wait for a long time)
Yes I know you are using parallel deployment and I am not, but that
doesn't necessarily mean that the problem you see is limited to only
parallel deployment. Maybe the problem can be simplified to "
Tomcat considers the connections closed, the database doesn't."
I could well be wrong, I'll leave it up to the gurus to decide :)
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : lundi 26 novembre 2018 15:27
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem
I'm interested in what solution there is for this because I have the
exact same problem but without parallel deployment.
[snip]
On Mon, Nov 26, 2018 at 3:54 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi Christopher,
Thanks for your email.
About connection pools not being closed, maybe the connection pool is
closed but the connections to the database are not.
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have
been opened (select...)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy my webapp through the manager webapp
- I check that the connections are still opened
- Tomcat is still running
- I redeploy the exact samed webapp and login to my application
- No other connection is being opened
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have
been opened (select...)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I deploy a new version of my application and login with another
browser
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I check on my postgresql and mysql database that new connexions
have
Post by Chris Cheshire
been opened (they doubled)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections are
still opened (even if I wait for a long time)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
For tests 1 and 2, I used C3p0, DBCP2 and even HikariCP
My results are the same. Using mysql, connection pools defined in
server.xml (for user realm for access control to host manager app) and
in my context.xml for my application. When I use the host-manager to
reload an app, the connections are closed (no abandoned connection
warnings) but not released. It is no until I stop tomcat completely
and restart it that the connections are released in mysql. This has
been the case for tomcat 7, 8.5 and 9 versions, with constant updates
of mysql 5.7 and its driver, using both the apache connection pool and
the tomcat connection pool. The driver lives in the tomcat/lib
directory (since it is needed for the user realm datasource).
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : samedi 24 novembre 2018 17:19
Objet : Re: Connection pool and parallel deployment problem
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Gilles,
[snip]
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
The warning/error messages are not actually linked to the
connexions not closed. To ovoid these messages, you can: - move the
jars (connexion pool, drivers...) into TOMCAT/lib - Have a
ServletContextListener that calls
AbandonedConnectionCleanupThread.checkedShutdown();
The Connector/J devs haven't been able to understand how ClassLoaders
work, and have never really fixed that long-standing bug in a
satisfying way as far as I know. But you should always use a
ServletContextListener to attempt to shut-down the
AbadonedConnectionCleanuopThread.
BTW that thread does not work as documented. It's claimed that it
doesn't start unless you issue a query with a timeout, but it always
starts whether or not you use queries with timeouts. It's
frustrating.
Post by Chris Cheshire
Post by Gilles SCHLIENGER
Should we be using checked or unchecked shutdown?
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org

HeeGu Lee
2018-11-27 09:17:16 UTC
Permalink
1. JMX registration is call by BasicDataSource of apache commons-dbcp2
library.
It is hidden inside and can not be controlled.

The name of the spring bean is referenced as part of the JMX name.
You can change the bean name for each distribution.
But that is not smart.

2. Usually, JMX is use for system monitoring.
Using tool like grafana, you will see jvm heap momory, running thread
count, network traffic of Tomcat.
Post by Gilles SCHLIENGER
Thanks a lot Heegu,
I looked at your project on github.
2. What do you use JMX for ?
Thanks again
Regards
Gilles
-----Message d'origine-----
Envoyé : mardi 27 novembre 2018 08:36
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem
Dear Gilles,
I apologize for the delay in reply.
I make simple webapp and upload to github. In project, my test result is
included.
https://github.com/elfhazardwork/dbcp2-test
Tomcat's parallel deploy mechanism is deploy new version before undeploy
old.
So, If your webapp is use JMX, bean name will duplicate and crush.
The connection pool is used where the developer does not explicitly declare
JXM.
So this is a Tomcat bug.
Otherwise, you must set JMX bean name dynamically.
I hope this helps.
Post by Chris Cheshire
On Mon, Nov 26, 2018 at 9:58 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi,
I understand your needs, but what is your problem, since you don't use
parallel deployment ?
Post by Gilles SCHLIENGER
Your connections are not closed but they will not be recreated when you
deploy your webapp again, so there should be no problem ?
Post by Gilles SCHLIENGER
Gilles
I added my 2c because I am seeing what you describe here
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections are
still opened (even if I wait for a long time)
Yes I know you are using parallel deployment and I am not, but that
doesn't necessarily mean that the problem you see is limited to only
parallel deployment. Maybe the problem can be simplified to "
Tomcat considers the connections closed, the database doesn't."
I could well be wrong, I'll leave it up to the gurus to decide :)
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : lundi 26 novembre 2018 15:27
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem
I'm interested in what solution there is for this because I have the
exact same problem but without parallel deployment.
[snip]
On Mon, Nov 26, 2018 at 3:54 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi Christopher,
Thanks for your email.
About connection pools not being closed, maybe the connection pool is
closed but the connections to the database are not.
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have
been opened (select...)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy my webapp through the manager webapp
- I check that the connections are still opened
- Tomcat is still running
- I redeploy the exact samed webapp and login to my application
- No other connection is being opened
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have
been opened (select...)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I deploy a new version of my application and login with another
browser
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I check on my postgresql and mysql database that new connexions
have
Post by Chris Cheshire
been opened (they doubled)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections are
still opened (even if I wait for a long time)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
For tests 1 and 2, I used C3p0, DBCP2 and even HikariCP
My results are the same. Using mysql, connection pools defined in
server.xml (for user realm for access control to host manager app) and
in my context.xml for my application. When I use the host-manager to
reload an app, the connections are closed (no abandoned connection
warnings) but not released. It is no until I stop tomcat completely
and restart it that the connections are released in mysql. This has
been the case for tomcat 7, 8.5 and 9 versions, with constant updates
of mysql 5.7 and its driver, using both the apache connection pool and
the tomcat connection pool. The driver lives in the tomcat/lib
directory (since it is needed for the user realm datasource).
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : samedi 24 novembre 2018 17:19
Objet : Re: Connection pool and parallel deployment problem
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Gilles,
[snip]
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
The warning/error messages are not actually linked to the
connexions not closed. To ovoid these messages, you can: - move the
jars (connexion pool, drivers...) into TOMCAT/lib - Have a
ServletContextListener that calls
AbandonedConnectionCleanupThread.checkedShutdown();
The Connector/J devs haven't been able to understand how ClassLoaders
work, and have never really fixed that long-standing bug in a
satisfying way as far as I know. But you should always use a
ServletContextListener to attempt to shut-down the
AbadonedConnectionCleanuopThread.
BTW that thread does not work as documented. It's claimed that it
doesn't start unless you issue a query with a timeout, but it always
starts whether or not you use queries with timeouts. It's
frustrating.
Post by Chris Cheshire
Post by Gilles SCHLIENGER
Should we be using checked or unchecked shutdown?
---------------------------------------------------------------------
---------------------------------------------------------------------
Gilles SCHLIENGER
2018-11-27 09:20:23 UTC
Permalink
Thanks,

I don't have this problem using C3p0

Parallel deployment is working fine so far, especially now that we will use connection pools configured inside the webapp (no more context xml file)

Regards
Gilles

-----Message d'origine-----
De : HeeGu Lee [mailto:***@gmail.com]
Envoyé : mardi 27 novembre 2018 10:17
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem

1. JMX registration is call by BasicDataSource of apache commons-dbcp2
library.
It is hidden inside and can not be controlled.

The name of the spring bean is referenced as part of the JMX name.
You can change the bean name for each distribution.
But that is not smart.

2. Usually, JMX is use for system monitoring.
Using tool like grafana, you will see jvm heap momory, running thread
count, network traffic of Tomcat.
Post by Gilles SCHLIENGER
Thanks a lot Heegu,
I looked at your project on github.
2. What do you use JMX for ?
Thanks again
Regards
Gilles
-----Message d'origine-----
Envoyé : mardi 27 novembre 2018 08:36
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem
Dear Gilles,
I apologize for the delay in reply.
I make simple webapp and upload to github. In project, my test result is
included.
https://github.com/elfhazardwork/dbcp2-test
Tomcat's parallel deploy mechanism is deploy new version before undeploy
old.
So, If your webapp is use JMX, bean name will duplicate and crush.
The connection pool is used where the developer does not explicitly declare
JXM.
So this is a Tomcat bug.
Otherwise, you must set JMX bean name dynamically.
I hope this helps.
Post by Chris Cheshire
On Mon, Nov 26, 2018 at 9:58 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi,
I understand your needs, but what is your problem, since you don't use
parallel deployment ?
Post by Gilles SCHLIENGER
Your connections are not closed but they will not be recreated when you
deploy your webapp again, so there should be no problem ?
Post by Gilles SCHLIENGER
Gilles
I added my 2c because I am seeing what you describe here
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections are
still opened (even if I wait for a long time)
Yes I know you are using parallel deployment and I am not, but that
doesn't necessarily mean that the problem you see is limited to only
parallel deployment. Maybe the problem can be simplified to "
Tomcat considers the connections closed, the database doesn't."
I could well be wrong, I'll leave it up to the gurus to decide :)
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : lundi 26 novembre 2018 15:27
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem
I'm interested in what solution there is for this because I have the
exact same problem but without parallel deployment.
[snip]
On Mon, Nov 26, 2018 at 3:54 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi Christopher,
Thanks for your email.
About connection pools not being closed, maybe the connection pool is
closed but the connections to the database are not.
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have
been opened (select...)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy my webapp through the manager webapp
- I check that the connections are still opened
- Tomcat is still running
- I redeploy the exact samed webapp and login to my application
- No other connection is being opened
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have
been opened (select...)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I deploy a new version of my application and login with another
browser
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I check on my postgresql and mysql database that new connexions
have
Post by Chris Cheshire
been opened (they doubled)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections are
still opened (even if I wait for a long time)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
For tests 1 and 2, I used C3p0, DBCP2 and even HikariCP
My results are the same. Using mysql, connection pools defined in
server.xml (for user realm for access control to host manager app) and
in my context.xml for my application. When I use the host-manager to
reload an app, the connections are closed (no abandoned connection
warnings) but not released. It is no until I stop tomcat completely
and restart it that the connections are released in mysql. This has
been the case for tomcat 7, 8.5 and 9 versions, with constant updates
of mysql 5.7 and its driver, using both the apache connection pool and
the tomcat connection pool. The driver lives in the tomcat/lib
directory (since it is needed for the user realm datasource).
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : samedi 24 novembre 2018 17:19
Objet : Re: Connection pool and parallel deployment problem
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Gilles,
[snip]
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
The warning/error messages are not actually linked to the
connexions not closed. To ovoid these messages, you can: - move the
jars (connexion pool, drivers...) into TOMCAT/lib - Have a
ServletContextListener that calls
AbandonedConnectionCleanupThread.checkedShutdown();
The Connector/J devs haven't been able to understand how ClassLoaders
work, and have never really fixed that long-standing bug in a
satisfying way as far as I know. But you should always use a
ServletContextListener to attempt to shut-down the
AbadonedConnectionCleanuopThread.
BTW that thread does not work as documented. It's claimed that it
doesn't start unless you issue a query with a timeout, but it always
starts whether or not you use queries with timeouts. It's
frustrating.
Post by Chris Cheshire
Post by Gilles SCHLIENGER
Should we be using checked or unchecked shutdown?
---------------------------------------------------------------------
---------------------------------------------------------------------
B�KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB��[��X��ܚX�KK[XZ[�\�\��][��X��ܚX�P�X�] �\X�K�ܙ�B��܈Y][ۘ[��[X[��K[
HeeGu Lee
2018-11-27 09:27:44 UTC
Permalink
I'm glad to solve problem.
But I am concerned that the C3p0 is not updated since 2015.

Let's hope for a better library.
Bye~
Post by Gilles SCHLIENGER
Thanks,
I don't have this problem using C3p0
Parallel deployment is working fine so far, especially now that we will
use connection pools configured inside the webapp (no more context xml file)
Regards
Gilles
-----Message d'origine-----
Envoyé : mardi 27 novembre 2018 10:17
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem
1. JMX registration is call by BasicDataSource of apache commons-dbcp2
library.
It is hidden inside and can not be controlled.
The name of the spring bean is referenced as part of the JMX name.
You can change the bean name for each distribution.
But that is not smart.
2. Usually, JMX is use for system monitoring.
Using tool like grafana, you will see jvm heap momory, running thread
count, network traffic of Tomcat.
Post by Gilles SCHLIENGER
Thanks a lot Heegu,
I looked at your project on github.
2. What do you use JMX for ?
Thanks again
Regards
Gilles
-----Message d'origine-----
Envoyé : mardi 27 novembre 2018 08:36
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem
Dear Gilles,
I apologize for the delay in reply.
I make simple webapp and upload to github. In project, my test result is
included.
https://github.com/elfhazardwork/dbcp2-test
Tomcat's parallel deploy mechanism is deploy new version before undeploy
old.
So, If your webapp is use JMX, bean name will duplicate and crush.
The connection pool is used where the developer does not explicitly
declare
Post by Gilles SCHLIENGER
JXM.
So this is a Tomcat bug.
Otherwise, you must set JMX bean name dynamically.
I hope this helps.
Post by Chris Cheshire
On Mon, Nov 26, 2018 at 9:58 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi,
I understand your needs, but what is your problem, since you don't
use
Post by Gilles SCHLIENGER
Post by Chris Cheshire
parallel deployment ?
Post by Gilles SCHLIENGER
Your connections are not closed but they will not be recreated when
you
Post by Gilles SCHLIENGER
Post by Chris Cheshire
deploy your webapp again, so there should be no problem ?
Post by Gilles SCHLIENGER
Gilles
I added my 2c because I am seeing what you describe here
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections
are
Post by Gilles SCHLIENGER
Post by Chris Cheshire
still opened (even if I wait for a long time)
Yes I know you are using parallel deployment and I am not, but that
doesn't necessarily mean that the problem you see is limited to only
parallel deployment. Maybe the problem can be simplified to "
Tomcat considers the connections closed, the database doesn't."
I could well be wrong, I'll leave it up to the gurus to decide :)
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : lundi 26 novembre 2018 15:27
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem
I'm interested in what solution there is for this because I have the
exact same problem but without parallel deployment.
[snip]
On Mon, Nov 26, 2018 at 3:54 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi Christopher,
Thanks for your email.
About connection pools not being closed, maybe the connection pool
is
Post by Gilles SCHLIENGER
Post by Chris Cheshire
closed but the connections to the database are not.
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have
been opened (select...)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy my webapp through the manager webapp
- I check that the connections are still opened
- Tomcat is still running
- I redeploy the exact samed webapp and login to my application
- No other connection is being opened
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have
been opened (select...)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I deploy a new version of my application and login with another
browser
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I check on my postgresql and mysql database that new connexions
have
Post by Chris Cheshire
been opened (they doubled)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections
are
Post by Gilles SCHLIENGER
Post by Chris Cheshire
still opened (even if I wait for a long time)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
For tests 1 and 2, I used C3p0, DBCP2 and even HikariCP
My results are the same. Using mysql, connection pools defined in
server.xml (for user realm for access control to host manager app)
and
Post by Gilles SCHLIENGER
Post by Chris Cheshire
Post by Gilles SCHLIENGER
in my context.xml for my application. When I use the host-manager to
reload an app, the connections are closed (no abandoned connection
warnings) but not released. It is no until I stop tomcat completely
and restart it that the connections are released in mysql. This has
been the case for tomcat 7, 8.5 and 9 versions, with constant updates
of mysql 5.7 and its driver, using both the apache connection pool
and
Post by Gilles SCHLIENGER
Post by Chris Cheshire
Post by Gilles SCHLIENGER
the tomcat connection pool. The driver lives in the tomcat/lib
directory (since it is needed for the user realm datasource).
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : samedi 24 novembre 2018 17:19
Objet : Re: Connection pool and parallel deployment problem
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Gilles,
[snip]
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
The warning/error messages are not actually linked to the
connexions not closed. To ovoid these messages, you can: - move
the
Post by Gilles SCHLIENGER
Post by Chris Cheshire
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
jars (connexion pool, drivers...) into TOMCAT/lib - Have a
ServletContextListener that calls
AbandonedConnectionCleanupThread.checkedShutdown();
The Connector/J devs haven't been able to understand how
ClassLoaders
Post by Gilles SCHLIENGER
Post by Chris Cheshire
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
work, and have never really fixed that long-standing bug in a
satisfying way as far as I know. But you should always use a
ServletContextListener to attempt to shut-down the
AbadonedConnectionCleanuopThread.
BTW that thread does not work as documented. It's claimed that it
doesn't start unless you issue a query with a timeout, but it
always
Post by Gilles SCHLIENGER
Post by Chris Cheshire
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
starts whether or not you use queries with timeouts. It's
frustrating.
Post by Chris Cheshire
Post by Gilles SCHLIENGER
Should we be using checked or unchecked shutdown?
---------------------------------------------------------------------
---------------------------------------------------------------------
Gilles SCHLIENGER
2018-11-27 09:29:40 UTC
Permalink
You can try HikariCP, it is mentionned in the Spring documentation


-----Message d'origine-----
De : HeeGu Lee [mailto:***@gmail.com]
Envoyé : mardi 27 novembre 2018 10:28
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem

I'm glad to solve problem.
But I am concerned that the C3p0 is not updated since 2015.

Let's hope for a better library.
Bye~
Post by Gilles SCHLIENGER
Thanks,
I don't have this problem using C3p0
Parallel deployment is working fine so far, especially now that we will
use connection pools configured inside the webapp (no more context xml file)
Regards
Gilles
-----Message d'origine-----
Envoyé : mardi 27 novembre 2018 10:17
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem
1. JMX registration is call by BasicDataSource of apache commons-dbcp2
library.
It is hidden inside and can not be controlled.
The name of the spring bean is referenced as part of the JMX name.
You can change the bean name for each distribution.
But that is not smart.
2. Usually, JMX is use for system monitoring.
Using tool like grafana, you will see jvm heap momory, running thread
count, network traffic of Tomcat.
Post by Gilles SCHLIENGER
Thanks a lot Heegu,
I looked at your project on github.
2. What do you use JMX for ?
Thanks again
Regards
Gilles
-----Message d'origine-----
Envoyé : mardi 27 novembre 2018 08:36
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem
Dear Gilles,
I apologize for the delay in reply.
I make simple webapp and upload to github. In project, my test result is
included.
https://github.com/elfhazardwork/dbcp2-test
Tomcat's parallel deploy mechanism is deploy new version before undeploy
old.
So, If your webapp is use JMX, bean name will duplicate and crush.
The connection pool is used where the developer does not explicitly
declare
Post by Gilles SCHLIENGER
JXM.
So this is a Tomcat bug.
Otherwise, you must set JMX bean name dynamically.
I hope this helps.
Post by Chris Cheshire
On Mon, Nov 26, 2018 at 9:58 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi,
I understand your needs, but what is your problem, since you don't
use
Post by Gilles SCHLIENGER
Post by Chris Cheshire
parallel deployment ?
Post by Gilles SCHLIENGER
Your connections are not closed but they will not be recreated when
you
Post by Gilles SCHLIENGER
Post by Chris Cheshire
deploy your webapp again, so there should be no problem ?
Post by Gilles SCHLIENGER
Gilles
I added my 2c because I am seeing what you describe here
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections
are
Post by Gilles SCHLIENGER
Post by Chris Cheshire
still opened (even if I wait for a long time)
Yes I know you are using parallel deployment and I am not, but that
doesn't necessarily mean that the problem you see is limited to only
parallel deployment. Maybe the problem can be simplified to "
Tomcat considers the connections closed, the database doesn't."
I could well be wrong, I'll leave it up to the gurus to decide :)
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : lundi 26 novembre 2018 15:27
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem
I'm interested in what solution there is for this because I have the
exact same problem but without parallel deployment.
[snip]
On Mon, Nov 26, 2018 at 3:54 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi Christopher,
Thanks for your email.
About connection pools not being closed, maybe the connection pool
is
Post by Gilles SCHLIENGER
Post by Chris Cheshire
closed but the connections to the database are not.
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have
been opened (select...)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy my webapp through the manager webapp
- I check that the connections are still opened
- Tomcat is still running
- I redeploy the exact samed webapp and login to my application
- No other connection is being opened
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have
been opened (select...)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I deploy a new version of my application and login with another
browser
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I check on my postgresql and mysql database that new connexions
have
Post by Chris Cheshire
been opened (they doubled)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections
are
Post by Gilles SCHLIENGER
Post by Chris Cheshire
still opened (even if I wait for a long time)
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
For tests 1 and 2, I used C3p0, DBCP2 and even HikariCP
My results are the same. Using mysql, connection pools defined in
server.xml (for user realm for access control to host manager app)
and
Post by Gilles SCHLIENGER
Post by Chris Cheshire
Post by Gilles SCHLIENGER
in my context.xml for my application. When I use the host-manager to
reload an app, the connections are closed (no abandoned connection
warnings) but not released. It is no until I stop tomcat completely
and restart it that the connections are released in mysql. This has
been the case for tomcat 7, 8.5 and 9 versions, with constant updates
of mysql 5.7 and its driver, using both the apache connection pool
and
Post by Gilles SCHLIENGER
Post by Chris Cheshire
Post by Gilles SCHLIENGER
the tomcat connection pool. The driver lives in the tomcat/lib
directory (since it is needed for the user realm datasource).
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : samedi 24 novembre 2018 17:19
Objet : Re: Connection pool and parallel deployment problem
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Gilles,
[snip]
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
The warning/error messages are not actually linked to the
connexions not closed. To ovoid these messages, you can: - move
the
Post by Gilles SCHLIENGER
Post by Chris Cheshire
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
jars (connexion pool, drivers...) into TOMCAT/lib - Have a
ServletContextListener that calls
AbandonedConnectionCleanupThread.checkedShutdown();
The Connector/J devs haven't been able to understand how
ClassLoaders
Post by Gilles SCHLIENGER
Post by Chris Cheshire
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
work, and have never really fixed that long-standing bug in a
satisfying way as far as I know. But you should always use a
ServletContextListener to attempt to shut-down the
AbadonedConnectionCleanuopThread.
BTW that thread does not work as documented. It's claimed that it
doesn't start unless you issue a query with a timeout, but it
always
Post by Gilles SCHLIENGER
Post by Chris Cheshire
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
starts whether or not you use queries with timeouts. It's
frustrating.
Post by Chris Cheshire
Post by Gilles SCHLIENGER
Should we be using checked or unchecked shutdown?
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-m
Gilles SCHLIENGER
2018-11-27 08:57:26 UTC
Permalink
Just one more thing I forgot to mention :
When I see the conections opened on databases using an sql query, I also see the Threads of the connection pool still present using jConsole to connect to tomcat
Gilles


-----Message d'origine-----
De : Chris Cheshire [mailto:***@gmail.com]
Envoyé : lundi 26 novembre 2018 18:04
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem

On Mon, Nov 26, 2018 at 9:58 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi,
I understand your needs, but what is your problem, since you don't use parallel deployment ?
Your connections are not closed but they will not be recreated when you deploy your webapp again, so there should be no problem ?
Gilles
I added my 2c because I am seeing what you describe here
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections are still opened (even if I wait for a long time)
Yes I know you are using parallel deployment and I am not, but that
doesn't necessarily mean that the problem you see is limited to only
parallel deployment. Maybe the problem can be simplified to "
Tomcat considers the connections closed, the database doesn't."

I could well be wrong, I'll leave it up to the gurus to decide :)
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : lundi 26 novembre 2018 15:27
À : Tomcat Users List
Objet : Re: Connection pool and parallel deployment problem
I'm interested in what solution there is for this because I have the
exact same problem but without parallel deployment.
[snip]
On Mon, Nov 26, 2018 at 3:54 AM Gilles SCHLIENGER
Post by Gilles SCHLIENGER
Hi Christopher,
Thanks for your email.
About connection pools not being closed, maybe the connection pool is closed but the connections to the database are not.
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have been opened (select...)
- I undeploy my webapp through the manager webapp
- I check that the connections are still opened
- Tomcat is still running
- I redeploy the exact samed webapp and login to my application
- No other connection is being opened
- I deploy my war
- I login to my webapp
- I check on my postgresql and mysql database that connections have been opened (select...)
- I deploy a new version of my application and login with another browser
- I check on my postgresql and mysql database that new connexions have been opened (they doubled)
- I undeploy the first version of the webapp
- I check on my postgresql and mysql database and all connections are still opened (even if I wait for a long time)
For tests 1 and 2, I used C3p0, DBCP2 and even HikariCP
My results are the same. Using mysql, connection pools defined in
server.xml (for user realm for access control to host manager app) and
in my context.xml for my application. When I use the host-manager to
reload an app, the connections are closed (no abandoned connection
warnings) but not released. It is no until I stop tomcat completely
and restart it that the connections are released in mysql. This has
been the case for tomcat 7, 8.5 and 9 versions, with constant updates
of mysql 5.7 and its driver, using both the apache connection pool and
the tomcat connection pool. The driver lives in the tomcat/lib
directory (since it is needed for the user realm datasource).
Post by Gilles SCHLIENGER
-----Message d'origine-----
Envoyé : samedi 24 novembre 2018 17:19
Objet : Re: Connection pool and parallel deployment problem
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Gilles,
[snip]
Post by Gilles SCHLIENGER
Post by Gilles SCHLIENGER
The warning/error messages are not actually linked to the
connexions not closed. To ovoid these messages, you can: - move the
jars (connexion pool, drivers...) into TOMCAT/lib - Have a
ServletContextListener that calls
AbandonedConnectionCleanupThread.checkedShutdown();
The Connector/J devs haven't been able to understand how ClassLoaders
work, and have never really fixed that long-standing bug in a
satisfying way as far as I know. But you should always use a
ServletContextListener to attempt to shut-down the
AbadonedConnectionCleanuopThread.
BTW that thread does not work as documented. It's claimed that it
doesn't start unless you issue a query with a timeout, but it always
starts whether or not you use queries with timeouts. It's frustrating.
Should we be using checked or unchecked shutdown?
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org

Т���������������������������������������������������������������������ХF�V�7V'67&�&R�R���âW6W'2�V�7V'67&�&TF��6B�6�R��&pФf�"FF�F����6����G2�R�
Loading...