Skip to content

Commit 43ba38b

Browse files
authored
Merge pull request #667 from jglick/GroovyClassLoader.close
Call `GroovyClassLoader.close` when build completes
2 parents dd8d2ce + 012c69f commit 43ba38b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

plugin/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsFlowExecution.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,8 +1306,18 @@ synchronized void onProgramEnd(Outcome outcome) {
13061306

13071307
void cleanUpHeap() {
13081308
LOGGER.log(Level.FINE, "cleanUpHeap on {0}", owner);
1309-
shell = null;
1310-
trusted = null;
1309+
try {
1310+
if (shell != null) {
1311+
shell.getClassLoader().close();
1312+
shell = null;
1313+
}
1314+
if (trusted != null) {
1315+
trusted.getClassLoader().close();
1316+
trusted = null;
1317+
}
1318+
} catch (IOException x) {
1319+
LOGGER.log(Level.WARNING, "failed to close class loaders from " + owner, x);
1320+
}
13111321
if (scriptClass != null) {
13121322
try {
13131323
cleanUpLoader(scriptClass.getClassLoader(), new HashSet<>(), new HashSet<>());

0 commit comments

Comments
 (0)