wso2 / product-apim

Welcome to the WSO2 API Manager source code! For info on working with the WSO2 API Manager repository and contributing code, click the link below.
http://wso2.github.io/
Apache License 2.0
845 stars 785 forks source link

Wso2APIM-v3.1.0 MySQL AM_DB connections exhausted when updating APIs in publisher #8665

Open Kalpanayella opened 4 years ago

Kalpanayella commented 4 years ago

Description:

With WSO2 APIM v3.1.0 configured with MySQL databases, when we create an API in the publisher UI and update it, we see the number of AM_DB connections increase on each update. Eventually, the number of connections are exhausted, and WSO2 fails to perform any further updates. This was not happening in WSO2 AM 2.6.0

Steps to reproduce:

  1. Install the vanilla version of WSO2-3.1.0.

  2. Download the MySQL Java connector JAR file, and extract it.

  3. Copy it to the /repository/components/lib/ directory.

  4. Create databases on MySQL.

  5. Execute DB scripts to create tables on the MySQL database.

  6. Open the /repository/conf/deployment.toml configuration file and locate the [database.shared_db] and [database.apim_db] configuration elements.

  7. Updated the URL pointing to your MySQL database, the username, and the password required to access the database and the MySQL driver details.

Do the changes to use the MySQL database in deployment.toml as follows:

[database.apim_db] 
type = "mysql" 
url = "jdbc:mysql://localhost:3306/apimgtdb?autoReconnect=true&useSSL=false&serverTimezone=UTC&characterEncoding=UTF-8" 
driver="com.mysql.cj.jdbc.Driver" 
pool_options.maxActive=200 
username = "root" 
password = "xxxx"

[database.shared_db] 
type = "mysql" 
url = "jdbc:mysql://localhost:3306/regdb?autoReconnect=true&useSSL=false&serverTimezone=UTC&characterEncoding=UTF-8" 
driver="com.mysql.cj.jdbc.Driver" 
pool_options.maxActive=200 
username = "root" 
password = "xxxxx"
  1. Restart the APIM server.
  2. Publish an API.
  3. Upon each update to published API, Mysql AM_DB connections are increased, and eventually the number of connections are exhausted, and WSO2 fails to perform any further updates.

Affected Product Version:

Wso2 APIM v3.1.0

Environment details (with versions):

Suggested Labels:

Priority/highest/urgent

jultabary commented 4 years ago

Hello, With the same configuration but with PostgreSQL (9.6) as a database. I observe the same behaviour. I have developped my own Cli with devportal and publisher APIs. The more i used it, the more connections are open with database until no more connections are available. The behaviour is the same if i directly use the devportal or publisher portal. Then WSO2 AM publisher and devportal are freezed and no more usable.

Is there a fix expected for this bug ?