Re: tomcat connection pool not closing properly

2018-04-26 Thread Chris Cheshire
On Thu, Apr 26, 2018 at 10:23 AM, Chris Cheshire  wrote:
[snip]

I've done some more testing with older and newer versions of tomcat,
and also swapping to use commons dbcp. All of them exhibit the same
behaviour.

So the question becomes is this expected behaviour (previous
connection pool instances lingering on webapp reload), or is it mysqld
misbehaving?

It's not a critical problem as restarting tomcat itself clears all the
connections, which isn't an issue on sandboxes and rare on the live
site anyway.

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



tomcat connection pool not closing properly

2018-04-26 Thread Chris Cheshire
[ tomcat 8.5.30, mysql server 5.7.22, connector/j 5.1.46, centos 6, debian 8. ]

I recently upgraded my sandboxes from 8.5.24 to 8.5.28 and now .30 and
I have noticed that when a webapp is reloaded via the host manager,
the associated connection pool is not getting closed down properly in
the database.

I am not getting abandoned connection warnings in tomcat, rather mysql
eventually complains because its max connections has been exceeded. If
I run "show full processlist" in mysql after every reload, there are
now an extra 5 open connections for the webapp user. It seems that the
connection pools are still active, because the connection time column
cycles between 0 and timeBetweenEvictionRunsMillis (in seconds). The
connections themselves are not showing anything running on them
however.

Once I shutdown the tomcat process entirely, everything closes and
there are no errors in the tomcat logs about abandoned connections.

This wasn't the case sometime around 8.5.24. I'm not sure if this is a
problem in mysql or tomcat as I have upgraded mysql, the connector and
tomcat. I don't know where to look so I'll start here.

I have the following in my context.xml for my webapp's connection pool

  

I start tomcat via a systemd service unit.

# /etc/systemd/system/tomcat1.service
[Unit]
Description=Apache Tomcat Web Application Container (sandbox1)
Wants=network.target
After=syslog.target network.target

[Service]
Type=forking

EnvironmentFile=-/etc/default/tomcat1

ExecStart=/opt/apache-tomcat-8.5.30/bin/catalina.sh start
ExecStop=/opt/apache-tomcat-8.5.30/bin/catalina.sh stop

User=sandbox1
Group=sandbox1
UMask=0007

[Install]
WantedBy=multi-user.target

# /etc/default/tomcat1
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
CATALINA_HOME=/opt/apache-tomcat-8.5.30
CATALINA_BASE=/home/sandbox1/tomcat
CATALINA_OUT=/home/sandbox1/tomcat/logs/catalina.out
CATALINA_PID=/home/sandbox1/tomcat/tomcat.pid

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