Grails 4 application in debug throws - ERROR --- [ restartedMain] o.a.tomcat.jdbc.pool.ConnectionPool : Unable to create initial connections of pool
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
_Originally reported by user "Art G" in Grails Slack_
I noticed the following issue with Grails. When running Grails 4 in debug mode, after changed class is reloaded, I can see that number of connections to the MySQL server is increased by initial size.
Eventually, server dies and I need to restart the debug session. So I think that after reloading, connections are not closed. Do you know what might cause it or maybe there is a fix to it.
### Task List
- [ ] Steps to reproduce provided
- [ ] Stacktrace (if present) provided
- [ ] Example that reproduces the problem uploaded to Github
- [ ] Full description of the issue provided (see below)
### Steps to Reproduce
1. Run Grails app in debug mode.
2. Set in application.groovy:
```
dataSource {
dbCreate = "update"
driverClassName = "com.mysql.cj.jdbc.Driver"
url = "jdbc:mysql://localhost:3306/DB-NAME?zeroDateTimeBehavior=convertToNull&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&serverTimezone=US/Eastern"
username = "username"
password = "password"
logSql = true
properties {
initialSize="25" //for faster failure
}
}
```
3. Keep on changing any of the .groovy files.
4. Watch console until it reloads.
5. Monitor mysql number of connections.
6. When it goes over 150, exception is thrown:
ERROR --- [ restartedMain] o.a.tomcat.jdbc.pool.ConnectionPool : Unable to create initial connections of pool
### Expected Behaviour
No error should be thrown
### Actual Behaviour
```
ERROR --- [ restartedMain] o.a.tomcat.jdbc.pool.ConnectionPool : Unable to create initial connections of pool
```
### Environment Information
- **Operating System**: TODO
- **Grails Version:** 4.0.4
- **JDK Version:** 1.8
- **Container Version (If Applicable):** TODO
Contributor guide
Research direction
Reproduce the issue in a Grails 4.0.4 application using the dataSource settings in application.groovy, with debug reloads and MySQL connection monitoring. Start by investigating connection-pool behavior after changed .groovy files are reloaded and the restartedMain error appears. Done means repeated reloads close or reuse connections without increasing the server count indefinitely or throwing the pool error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy, mysql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100