Spring-boot: Liquibase update doesn't close connections, when web application keeps running

Created on 13 May 2017  路  5Comments  路  Source: spring-projects/spring-boot

Given I have web application and enable liquibase updates with liquibase.enabled=true.
The application connects to Oracle db.
Let's say I have 2 users/schemas, one for deployment, second one for the application:

  • appdeploy
  • appuser

Application properties look like:

When I boot up the application (whereas liquibase update is executed) and I try to DROP USER appdeploy CASCADE;
Then I get ORA-01940: cannot drop a user that is currently connected
what indicates web application didn't release db connections

bug

All 5 comments

It's possible that the appuser connection is established before liquibase gets a chance to run with the appdeploy connection. Do you have a sample application that you can share that demonstrates the problem?

Hi Phil,
I pushed sample app here: https://github.com/pmihalcin/liquibase-sample

I think the problem is that we use DataSourceBuilder to create the Liquibase-specific DataSource. It will be using a connection pool so it will create and keep open whatever the default number of connections is for the pool. I think we need to do one of the following:

  • Bypass the connection pool entirely
  • Tune it so that it doesn't keep any connections open
  • Close it once Liquibase has migrated the database.

Hi Andy,
Thanks for the fix!
Will this fix also appear in 1.5.x boot version?
@wilkinsona

Yeah, it will. It's only marked as being in 1.4.7 as GitHub only allows a single milestone to be assigned to an issue. Anything fixed in 1.4.x (as this was) is also merged forwards into 1.5.x and master.

Was this page helpful?
0 / 5 - 0 ratings