ClassLoader leak due to shutdown hooks

Description

We use SpringLiquibase to execute Liquibase during the startup of our web application. Since updating from 3.1.1 to 3.3.1 our integration test for classloader leaks fails. When I look at a heap dump in VisualVM and use "Show Nearest GC Root" on the WebappClassLoader (WCL) it returns the ApplicationShutdownHooks (ASH) class.

Shutdown hooks cannot be used in web applications due to the following references:
RootClassLoader -> ASH
ASH -> Hook
Hook -> WCL

This leaks the entire WCL and will result in PermGen exceptions (JDK<1.8) or heap problems (JDK>=1.8).

Our workaround is to stay at 3.1.1.

Testing in 3.2.1 and 3.2.0 was not possible due to other bugs.

Environment

Liquibase 3.1.1
Spring Platform 1.1.0

Status

Assignee

Unassigned

Reporter

ArloK

Labels

None

Fix versions

Affects versions

3.3.1
3.3.0
3.2.3
3.2.2

Priority

Major